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

分类:CentOS教程 阅读:2725 次

单网卡批量添加不同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

servicenetworkrestart

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

把命令大全装进口袋

微信关注