Centos如何快速绑定多个IP(一个配置文件即可)
有时候,我们有数十个IP,难道都要一个一个的来写配置文件吗?Centos如何快速绑定多个IP?可否做到一个配置文件即可?可以!
可以在/etc/sysconfig/network-scripts下创建一个range文件
比如,vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:1c:c0:fd:0f:27
IPADDR_START=64.120.228.163
IPADDR_END=64.120.228.166
CLONENUM_START=1
NETMASK=255.255.255.248
ONBOOT=yes
TYPE=Ethernet
CLONENUM_START — 网络克隆接口的启始号. # eg “1″ 生成的网络接口会从 eth0:1开始。
然后重启网络让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
IP段/28举例: 64.120.220.224/28
The first two IPs (network & gateway) and the last IP (broadcast) in your assignment are unusable for you.
Network: 64.120.220.224
Gateway: 64.120.220.225
Broadcast: 64.120.220.239
Useable IPs: 64.120.220.226-238 (13 useable)
NETMASK = 255.255.255.240
版权声明:
作者:Kiyo
链接:https://www.wkiyo.cn/html/2010-08/i674.html
来源:Kiyo's space
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论