Answer the question
In order to leave comments, you need to log in
Setting primary ip for outgoing CentOS connections?
We have a dedicated server, one network port, 3 IP addresses, there are aliases
1 IP address from one subnet and 2 from another
For example
85.114.132.84
89.163.252.14
89.163.252.15
[[email protected] ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 90:2B:34:A1:4B:53
inet addr:89.163.252.14 Bcast:89.163.252.255 Mask:255.255.255.0
inet6 addr: fe80::922b:34ff:fea1:4b53/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21691 errors:0 dropped:0 overruns:0 frame:0
TX packets:4872 errors:1 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2111154 (2.0 MiB) TX bytes:6388222 (6.0 MiB)
eth0:0 Link encap:Ethernet HWaddr 90:2B:34:A1:4B:53
inet addr:89.163.252.15 Bcast:89.163.252.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:1 Link encap:Ethernet HWaddr 90:2B:34:A1:4B:53
inet addr:85.114.132.84 Bcast:85.114.132.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[[email protected] network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
GATEWAY="85.114.132.1"
HWADDR="90:2B:34:A1:4B:53"
IPADDR="89.163.252.14"
IPV6INIT="yes"
NETMASK="255.255.255.0"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
[[email protected] network-scripts]# cat ifcfg-eth0:0
DEVICE="eth0:0"
BOOTPROTO="static"
GATEWAY="85.114.132.1"
IPADDR="89.163.252.15"
NETMASK="255.255.255.0"
NM_CONTROLLED="no"
ONBOOT="yes"
[[email protected] network-scripts]# cat ifcfg-eth0:1
DEVICE="eth0:1"
BOOTPROTO="static"
GATEWAY="85.114.132.1"
IPADDR="85.114.132.84"
NETMASK="255.255.255.0"
NM_CONTROLLED="no"
ONBOOT="yes"
[[email protected] ~]# ip r
85.114.132.0/24 dev eth0 proto kernel scope link src 85.114.132.84
89.163.252.0/24 dev eth0 proto kernel scope link src 89.163.252.14
169.254.0.0/16 dev eth0 scope link metric 1002
default via 85.114.132.1 dev eth0 src 85.114.132.84
sudo ip route change default via 85.114.132.1 dev eth0 src 89.163.252.14
gives the desired result only until the reboot Answer the question
In order to leave comments, you need to log in
Centos is not available to check, but, it seems to me, something like this:
1. Remove GATEWAY is all ifcfg-eth0*
2. Create a file /etc/network-scripts/route-eth0:1 and enter there:
default via 85.114.132.1 dev eth0 src 89.163.252.14
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question