[CentOS] Need help getting two NICs to work on CentOS 7

Mon Nov 7 07:16:00 UTC 2016
Frank Cox <theatre at melvilletheatre.com>

On Mon, 7 Nov 2016 02:00:24 -0500
Sean Son wrote:

>  When I ping the VM, the first NIC's IP is
> not pingable at all, but the second NIC's IP is pingable. How do I
> configure the networking so that both IPs are pingable and the VM is
> reachable via both IPs? 

The last time I did that I did it on Centos 5.  Here are my notes from back then.

First, add two lines to /etc/iproute2/rt_tables, so it looks like this:

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
50      access1
60      access2

Then add the following routes:

ip route add 1.2.3.0/24 dev eth1 table access1
ip route add default via 1.2.3.1 dev eth1 table access1
ip rule add from 1.2.3.178/32 lookup access1

ip route add 1.2.3.0/24 dev eth2 table access2
ip route add default via 1.2.3.1 dev eth2 table access2
ip rule add from 1.2.3.180/32 lookup access2

Of course, in this example 1.2.3.178 is the IP address of the first nic and 1.2.3.180 is the address of the second nic.


-- 
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com