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:
/etc/sysconfig/network-scripts/
em1
DEVICE=em1
NAME=siteABC
IP=22.22.22.214
GATEWAY=22.22.22.2
NETMASK=255.255.255.0
GATEWAY=22.22.22.2
DNS1=1.1.1.1
DNS2=1.1.1.2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
em1:0
DEVICE=em1:0
NAME=siteABC
IPADDR=22.22.22.215
GATEWAY=22.22.22.2
NETMASK=255.255.255.0
GATEWAY=22.22.22.2
DNS1=1.1.1.1
DNS2=1.1.1.2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
em2
DEVICE=em2
NAME=sitetwo
HWADDR=$MACADDRESS
IPADDR=44.44.44.69
NETMASK=255.255.255.0
#GATEWAY= ### commented out per below ###
DNS1=1.1.1.1
DNS2=1.1.1.2
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 44.44.44.2
** Note that 44.44.44.2 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 44.44.44.69 table MGMT
Continued:
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.
Question
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.