Tuesday, February 6, 2018

Cluster 4. Mapping physical interfaces to device names

If you are going to use OvS networking, then skip this article and go to the "Cluster 5" article.

SubnetVIDNICLink 1NICLink 2BondNet IP
BCN100eno1bcn_link1eno4back_link.100bcn_bond10.10.53.0/24
SN200eno2sn_link1eno4back_link.200sn_bond10.10.52.0/24
IFN51eno3ifn_link1eno4back_link.51ifn_bond172.16.51.0/24

First we'll disable new NIC naming which comes with CentOS7 by default:
biosdevname=0
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

Lets add MAC addresses to all ifcfg files (on the both nodes):
cd /etc/sysconfig/network-scripts
for int in $(ls -1 ifcfg-eno* | cut -d'-' -f2);
do
   mac=$(ip link show $int | grep ether | awk '{print $2}');
   echo "HWADDR=\"$mac\"" >> ifcfg-$int;
done

Now rename device names according to the table above:
mv ifcfg-eno1 ifcfg-bcn_link1
mv ifcfg-eno2 ifcfg-sn_link1
mv ifcfg-eno3 ifcfg-ifn_link1
mv ifcfg-eno4 ifcfg-back_link1

Now change NAME and DEVICE parameters in the appropriate files:
for name in bcn_link1 sn_link1 ifn_link1 back_link:
do
   sed -i "s/DEVICE=.*/DEVICE=$name/" ifcfg-$name;
   sed -i "s/NAME=.*/NAME=$name/" ifcfg-$name;
done

Now we can reboot each node and verify NIC names:
reboot
After reboot to verify proper naming, execute:
ip link

The last step will be manual test (on both nodes):

  1. tail -f -n 0 /var/log/messages # -f means "as file growth" , -n 0 means "initially show no lines"
  2. then unplug and plug-in cables
  3. if every cable becomes "Link is down" and then "Link is up", then everything is OK 
  4. backup new configs:
  5. rsync -av /etc/sysconfig/network-scripts /root/backups

This tutorial was used to understand and setup clustering: AN!Cluster

No comments:

Post a Comment