在 /etc/sysconfig/network-scripts 下创建一个 range 文件
比如,vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0 DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR_START=192.168.1.111 IPADDR_END=192.168.1.115
CLONENUM_START=0
GATEWAY=192.168.1.11 NETMASK=255.255.255.000
NO_ALIASROUTING=yes
其中: IPADDR_START 是起始IP地址, IPADDR_END 是结束IP地址, CLONENUM_START 是起始IP别名网卡名(本例中是 eth0:0)
然后重启网络让IP生效: service network restart
NETMASK 子网掩码 参考表: /29 (5 usable) NETMASK = 255.255.255.248 /28 (13 usable) NETMASK = 255.255.255.240 /27 (29 usable) NETMASK = 255.255.255.224 /26 (61 usable) NETMASK = 255.255.255.192 /25 (125 usable) NETMASK = 255.255.255.128 /24 (253 usable) NETMASK = 255.255.255.0 |