Centos6,Centos7绑定多ip

Centos7


for I in $(seq 1 254); do nmcli con mod eth0 +ipv4.addresses 192.168.242.${I}/24; donedone

Centos6

在/etc/sysconfig/network-scripts/中新建文件ifcfg-eth0-range0

vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
#输入以下文件内容格式:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR_START=起始IP地址
IPADDR_END=结束IP地址
CLONENUM_START=0
GATEWAY=网关地址
NETMASK=子网掩码
NO_ALIASROUTING=yes 保存后,运行service network restart重启网络服务即可



win系统批量绑定IP脚本:

23.249.177.128/27
@echo off
for /l %%a in (129,1,159) do netsh interface ip add address name="本地连接 2" addr=23.249.177.%%a mask=255.255.255.224

头像
About sun 55 Articles
85后青年,自诩为伪文艺青年

Be the first to comment

Leave a Reply

Your email address will not be published.


*