0

I am going nuts since I have been trying to solve this for nearly a week now.

Scenario: One Server with two different network devices. Each device is plugged into a different company subnet.

eth0 is plugged in x.y.5.184/29, while eth1 is plugged into x.y.88.224/27. I want the server to listen on both devices.

Server-IP in .5.184/29 shall be x.y.5.186, Server-IP in .88.224/27 shall be x.y.88.253. I'd like to run two different VMs with Apache, so the Server shall – with natpf to the respective VM – listen on x.y.5.186:p1 for VM1 and on x.y.88.253:p2 for VM2

x and y have to be hidden due to privacy issues, but are given values.

So here is the problem: If I turn up eth1, the server is not responding on eth0 and I don't really know why.

Here is some output with both devices up:

[user@server ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet x.y.5.186  netmask 255.255.255.248  broadcast x.y.5.191
    ether <MAC>  txqueuelen 1000  (Ethernet)
    RX packets 77141  bytes 50779367 (48.4 MiB)
    RX errors 27  dropped 0  overruns 26  frame 1
    TX packets 83841  bytes 63781133 (60.8 MiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet x.y.88.253  netmask 255.255.255.224  broadcast x.y.88.255
    ether <MAC>  txqueuelen 1000  (Ethernet)
    RX packets 77911  bytes 6285521 (5.9 MiB)
    RX errors 0  dropped 836  overruns 0  frame 0
    TX packets 6502  bytes 1057860 (1.0 MiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 0  (Local Loopback)
    RX packets 740  bytes 606784 (592.5 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 740  bytes 606784 (592.5 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
    ether 52:54:00:67:e6:77  txqueuelen 0  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 [user@server ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         x.y.5.185    0.0.0.0         UG    0      0        0 eth0
0.0.0.0         x.y.88.225   0.0.0.0         UG    10     0        0 eth1
x.y.5.184    0.0.0.0         255.255.255.248 U     0      0        0 eth0
x.y.88.224   0.0.0.0         255.255.255.224 U     10     0        0 eth1
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

[user@server ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
# ifcfg-eth0
HWADDR=<MAC>
TYPE=Ethernet
BOOTPROTO=none
#DNS1=x.y.company.dns
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV4_ROUTE_METRIC=0
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=SERVER
UUID=<uuid>
DEVICE=eth0
ONBOOT=yes
IPADDR=x.y.5.186
PREFIX=29
GATEWAY=x.y.5.185


[user@server ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth1
# ifcfg-eth1
HWADDR=<MAC2>
TYPE=Ethernet
BOOTPROTO=none
#DNS1=x.y.company.dns
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV4_ROUTE_METRIC=10
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=CLIENT
UUID=<uuid2>
DEVICE=eth1
ONBOOT=no
IPADDR=x.y.88.253
PREFIX=27
GATEWAY=x.y.88.225

So my thought is that it might be a route. I deleted /etc/sysconfig/network-scripts/route-eth0 and route-eth1, so those are the defaults.

[user@server ~]$ ip route
default via x.y.5.185 dev eth0  proto static
default via x.y.88.225 dev eth1  proto static  metric 10
x.y.5.184/29 dev eth0  proto kernel  scope link  src x.y.5.186
x.y.88.224/27 dev eth1  proto kernel  scope link  src x.y.88.253  metric 1
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1

I deleted the default route for eth1

[root@server user]#  ip route del default via x.y.88.225 dev eth1  prot

And still nothing changes. Ping to eth0 IP fails but if I delete the other route with

[root@server user]#  ip route del x.y.88.224/27 dev eth1  proto kernel ric 10

eth0 works again, every connection to x.y.5.186 works again, but eth1 stops to work. As far as I know the metric I used on eth1 should solve the issue, but it doesn't. Any routing expert with a thought on this?

Edit: fresh CentOS

1 Answer 1

0

This question has been asked a zillion times, here.

It cannot be done as you are trying to do it, you will need policy routing. You can find a barebone introduction to it here.

You shall have to specify, as an ip rule that determines which of the two routing tables is to be applied, one that specifies that, if the packet comes from the IP address of VM1 then use table 1, otherwise use table 2. This is why it is called sometimes source routing, instead of policy routing: because which table is to be applied is chosen on the basis of the source IP address, not of the destination address.

1
  • i actually did read both of your links and nearly every solution google gave me before posting this question. Solution was calling the network admin to properly configure the first subnet sigh. Still marking your answer as solution since it's not working without tables
    – volpe
    Jun 22, 2016 at 23:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .