One, mode one
1. Modify/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP2S0 to: (Note: The file name must be the NIC device name)
DEVICE=enp2s0
BOOTPROTO=static
ONBOOT=yes
DNS1=10.0.10.10
DNS2=8.8.8.8
HWADDR=B8:88:E3:73:7A:7B
IPADDR=10.0.57.114
PREFIX=24
GATEWAY=10.0.57.1
2.CP Ifcfg-enp2s0 for Ifcfg-enp2s0:1, and fix the ifcfg-enp2s0:1 content as:
DEVICE=enp2s0:1
BOOTPROTO=static
ONBOOT=yes
DNS1=10.0.10.10
DNS2=8.8.8.8
HWADDR=B8:88:E3:73:7A:7B
IPADDR=10.0.57.115
PREFIX=24
GATEWAY=10.0.57.1
3. Restart the NIC, and then ifconfig to see it. ?
Two, mode two
1. Configure multiple network cards directly in the/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP2S0,
However, to use IP addr to see multiple IP information, the configuration is as follows:
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=za209
UUID=7e917b8e-2d35-4630-b314-2d64a2f1f52f
ONBOOT=no
DNS1=10.0.10.10
DOMAIN=10.0.15.11
HWADDR=B8:88:E3:73:7A:7B
IPADDR=10.0.57.230
PREFIX=24
GATEWAY=10.0.57.1
IPADDR1=10.0.57.231
PREFIX1=24
GATEWAY1=10.0.57.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
2. Restart the network card, using the IP addr command to view, shown as follows:
2 : Enp2s0 : < broadcast Span class= "pun", multicast up lower_up > MTU 1500 Qdisc pfifo_fast state up Qlen 1000
link / ether b8 : Span class= "lit" >88 : e3 : 73 : 7a : 7b BRD FF : ff : ff : ff : ff : ff
inet 10.0.57.230/24 brd 10.0.57.255 scope global enp2s0
valid_lft forever preferred_lft forever
inet 10.0.57.231/24 brd 10.0.57.255 scope global secondary enp2s0
valid_lft forever preferred_lft forever
inet6 fe80::ba88:e3ff:fe73:7a7b/64 scope link
valid_lft forever preferred_lft forever
From for notes (Wiz)
Linux single-NIC multi-IP configuration