多IP云服务器批量添加IP,对于购买IP数量较多时可以利用exl表格减去手工操作
首先,我们购买一台10IP的云服务器,进入产品管理-网络查看我们的IP,复制出所有IP加子网粘贴到exl表格中,利用表格把IP和网关分开,windows和linux绑定多IP都不需要在绑定网关,只需要把IP绑定上就可以了
windows批量绑定,开始菜单-运行-cmd,粘贴以下代码回车,请注意把教程中的IP替换成你自己的服务器IP
netsh interface ip add address name="本地连接" 103.228.169.96 255.255.255.192
netsh interface ip add address name="本地连接" 103.228.169.107 255.255.255.192
netsh interface ip add address name="本地连接" 103.228.169.113 255.255.255.192
netsh interface ip add address name="本地连接" 43.225.28.165 255.255.255.192
netsh interface ip add address name="本地连接" 43.225.28.171 255.255.255.192
netsh interface ip add address name="本地连接" 154.91.166.74 255.255.255.192
netsh interface ip add address name="本地连接" 154.91.167.87 255.255.255.192
netsh interface ip add address name="本地连接" 154.91.167.97 255.255.255.192
netsh interface ip add address name="本地连接" 154.91.167.123 255.255.255.192
Centos批量绑定,编辑 vi /etc/sysconfig/network-scripts/ifcfg-eth0,粘贴到文件最下面,保存后重启网络测试是否生效
IPADDR0=103.228.169.96
NETMASK0=255.255.255.192
IPADDR1=103.228.169.107
NETMASK1=255.255.255.192
IPADDR2=103.228.169.113
NETMASK2=255.255.255.192
IPADDR3=43.225.28.165
NETMASK3=255.255.255.192
IPADDR4=43.225.28.171
NETMASK4=255.255.255.192
IPADDR5=154.91.166.74
NETMASK5=255.255.255.192
IPADDR6=154.91.167.87
NETMASK6=255.255.255.192
IPADDR7=154.91.167.97
NETMASK7=255.255.255.192
IPADDR8=154.91.167.123
NETMASK8=255.255.255.192
以上例子是8个IP,如果是10个,如下依次增加
IPADDR9=x.x.x.x
NETMASK9=x.x.x.x
重启网络 systemctl network restart
Label:
- 多IP云服务器命令行批量添加IP