CentOS单网卡如何批量添加不同IP段?

乐清SEO_开发应用_Centos_ 乐清SEO2021-04-25 转载自:

单网卡批量添加不同IP段

70.39.112.194 添加IP: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=255.255.255.224

NO_ALIASROUTING=yes

service network restart

ifconfig 后 看到 IP:70.39.112.195-222 对应网卡号:eth0:0-eth0:27,

所以再批量添加IP,网卡从eth0:28以后开始就行,

网卡eth0不变,创建新文件:ifcfg-eth0-range1

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

vi /etc/sysconfig/network-scripts/ifcfg-eth0-range1  #注意这个第二次要变

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=static

IPADDR_START=70.39.83.226

IPADDR_END=70.39.83.254

CLONENUM_START=28            #注意这个第二次要变

GATEWAY=70.39.83.225

NETMASK=255.255.255.224

NO_ALIASROUTING=yes