[root@test ~]# ll /sys/class/net/
total 0
lrwxrwxrwx. 1 root root 0 Jul 4 02:28 eno33554992 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:06.0/net/eno33554992
lrwxrwxrwx. 1 root root 0 Jul 4 02:28 eth0 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/eth0
lrwxrwxrwx. 1 root root 0 Jul 4 02:28 lo -> ../../devices/virtual/net/lo
Please note that, nmtui is a text-based user interface for replacing system-network-config-tui on Enterprise Linux 7. Let's configure the second NIC manually.
- Make sure the device name and MAC address of the second NIC
- Add a udev persistent rule and rename the device as eth1
- Copy a configuration file named ifcfg-eth1 from ifcfg-eth0 for the second NIC.
- Modify the content of the configuration file of eth1
- Bounce the server
- Check the ifconfig
- Check the routing table
- Ping the gateway of eth1
[root@test ~]# ifconfig
...
eno33554992: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::20c:29ff:fe97:5f8c prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:97:4e:76 txqueuelen 1000 (Ethernet)
...
[root@test ~]# vi /etc/udev/rules.d/70-persistent-ipoib.rules
...
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="00:0c:29:97:4e:76", NAME="eth1"
Or on this file:
[root@test ~]# vi /etc/udev/rules.d/70-persistent-net.rules
Both files can result in the same effects.
[root@test ~]# cp -p /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
[root@test ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
...
#UUID=...
DEFROUTE=no
NAME=eth1
DEVICE=eth1
...
HWADDR=00:0c:29:97:4e:76
IPADDR=192.168.68.32
PREFIX=24
GATEWAY=192.168.68.1
...
Please notice that I commented out the UUID for avoiding accidental conflicts with other NICs and set DEFROUTE=no to indicate that this is NOT the default route.
[root@test ~]# init 6
[root@test ~]# ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
...
[root@test ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 100 0 0 eth0
192.168.15.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
192.168.68.0 0.0.0.0 255.255.255.0 U 100 0 0 eth1
...
As you can see, the second NIC (eth1) is working now and it's NOT the default route.
[root@test ~]# ping -c 4 192.168.68.1
PING 192.168.68.1 (192.168.68.1) 56(84) bytes of data.
64 bytes from 192.168.68.1: icmp_seq=1 ttl=128 time=0.412 ms
64 bytes from 192.168.68.1: icmp_seq=2 ttl=128 time=0.368 ms
64 bytes from 192.168.68.1: icmp_seq=3 ttl=128 time=0.360 ms
64 bytes from 192.168.68.1: icmp_seq=4 ttl=128 time=0.372 ms
--- 192.168.68.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.360/0.378/0.412/0.020 ms
[root@test ~]# ll /sys/class/net/
total 0
lrwxrwxrwx. 1 root root 0 Jul 4 04:20 eth0 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/eth0
lrwxrwxrwx. 1 root root 0 Jul 4 04:20 eth1 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:06.0/net/eth1
lrwxrwxrwx. 1 root root 0 Jul 4 04:20 lo -> ../../devices/virtual/net/lo
Now the second NIC is activated!