I have a server with two NICs, configured each with a static IP (both public, if it makes any difference). They belong to the same subnet. Eg (fake ips but following the same logic):
# cat ifcfg-enp4s0 TYPE="Ethernet" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" NAME="enp4s0" DEVICE="enp4s0" ONBOOT="yes" DNS1="192.168.1.1" IPADDR=192.168.0.1 PREFIX=24 GATEWAY=192.168.0.254 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_PRIVACY=no
# cat ifcfg-enp2s0f0 TYPE=Ethernet BOOTPROTO=none IPADDR=192.168.0.2 PREFIX=24 GATEWAY=192.168.0.254 DNS1=192.168.1.1 DEFROUTE=no IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp2s0f0 DEVICE=enp2s0f0 ONBOOT=yes
I would like outgoing connections to go through NIC1 by default, unless it's down - then it should go through NIC2.
Packets to 192.168.0.1 should go to NIC1 and replies should come out of NIC1. Equally, packets to 192.168.0.2 should go to NIC2 and replies come out of NIC2.
With the above configuration, I get the following route:
# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.254 0.0.0.0 UG 100 0 0 enp4s0 192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 enp2s0f0 192.168.0.0 0.0.0.0 255.255.255.0 U 101 0 0 enp4s0
Now, the server is connected but only 192.168.0.1 is pingable from outside. 192.168.0.2 is unreacheable.
The network guys tell me that 192.168.0.2 is reachable from within the same subnet, so it must be an error in my configuration that makes is unavailable outside.
What did I do wrong? Can you advise on a fix?