Last year I set up a CentOS 6 machine with two NICs, each using a separate gateway. Multiple aliases exist under NIC#1 (em1, em1:0, em1:1, ect), but currently only one interface exists under NIC#2 (em2).
I need to add an aliases to NIC#2 and am unsure how best to proceed.
Here is a quick summary of how I arrived at a working config as of now:
em1 DEVICE=em1 NAME=siteABC IP=22.214.171.124 GATEWAY=126.96.36.199 NETMASK=255.255.255.0 GATEWAY=188.8.131.52 DNS1=184.108.40.206 DNS2=220.127.116.11 TYPE=Ethernet ONBOOT=yes BOOTPROTO=none em1:0 DEVICE=em1:0 NAME=siteABC IPADDR=18.104.22.168 GATEWAY=22.214.171.124 NETMASK=255.255.255.0 GATEWAY=126.96.36.199 DNS1=188.8.131.52 DNS2=184.108.40.206 TYPE=Ethernet ONBOOT=yes BOOTPROTO=none em2 DEVICE=em2 NAME=sitetwo HWADDR=$MACADDRESS IPADDR=220.127.116.11 NETMASK=255.255.255.0 #GATEWAY= ### commented out per below ### DNS1=18.104.22.168 DNS2=22.214.171.124 TYPE=Ethernet ONBOOT=yes BOOTPROTO=none
/etc/iproute2/rt_tables was edited to add a new line at the bottom (below #1 inr.ruhep). The new line contains 200 MGMT.
# # reserved values # 255 local 254 main 253 default 0 unspec # # local # #1 inr.ruhep 200 MGMT
/etc/sysconfig/network-scripts/route-em2 was created with the following:
default table MGMT via 126.96.36.199 ** Note that 188.8.131.52 is the gateway of the second NIC (the public WAN). **
Lastly, I created a rules file called
/etc/sysconfig/network-scripts/rule-em2 with the following:
from 184.108.40.206 table MGMT
The default gateway has multiple aliases configured (em1, em1:0, em1:1, ect). The second gateway only has one interface (em2) however I need to add alias em2:0 for another site IP hosted by the machine.
What I've tried today
I configured an alias called em2:0 which mirrors em2 except for DEVICE, NAME, and IPADDR. The network restarted without a problem, but I'm not able to access the newly configured IPADDR under em2:0.
Do I just need to add another entry in the
/etc/sysconfig/network-scripts/rule-em2 file (shown above)? Or is there more to do to add an alias under em2? This is a production system and I am hesitant to make a quick change to see what happens.