Add multiple IP segments to a single network card in CentOS
Batch add different IP segments for a single Nic
Add IP address 70.39.112.194: 70.39.112.195-222/70. 39.83.226-254
Vi/etc/sysconfig/network-scripts/ifcfg-eth0-range0
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = static
IPADDR_START = 70.39.112.195
IPADDR_END = 70.39.112.222
CLONENUM_START = 0
GATEWAY = 70.39.112.193
NETMASK = zookeeper
NO_ALIASROUTING = yes
Servicenetworkrestart
After ifconfig, the IP address 70.39.112.195-222 corresponds to the nic id: eth0: 0-eth0: 27,
Therefore, add IP addresses in batches. The NIC will start from eth0: 28 and later,
Nic eth0 unchanged, create new file: ifcfg-eth0-range1
++ ++
Vi/etc/sysconfig/network-scripts/ifcfg-eth0-range1 # Note this second minor change
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = static
IPADDR_START = 70.39.83.226
IPADDR_END = 70.39.83.254
CLONENUM_START = 28 # Pay attention to the second minor change
GATEWAY = 70.39.83.225
NETMASK = zookeeper
NO_ALIASROUTING = yes