ubuntu批量添加IP
ubuntu 批量添加ip脚本
成都创新互联公司是一家集网站建设,格尔木企业网站建设,格尔木品牌网站建设,网站定制,格尔木网站建设报价,网络营销,网络优化,格尔木网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
# !/bin/bash
for ((i=0;i<=3;i=i+1))
do
echo "auto eth0:$i">>/etc/network/interfaces
echo "iface eth0:$i inet static">>/etc/network/interfaces
let j=$i+179
echo "address 45.41.89.$j">>/etc/network/interfaces
echo "netmask 255.255.255.248">>/etc/network/interfaces
echo "gateway 45.41.89.177">>/etc/network/interfaces
echo " ">>/etc/network/interfaces
done
# end
上为一个脚本程序(ip较多的时候)
下为ip数量较少
auto eth0:1
iface eth0:1 inet static
address 104.237.51.90
netmask 255.255.255.248
gateway 104.237.51.89
auto eth0:2
iface eth0:2 inet static
address 104.237.51.91
netmask 255.255.255.248
gateway 104.237.51.89
auto eth0:3
iface eth0:3 inet static
address 104.237.51.92
netmask 255.255.255.248
gateway 104.237.51.89
auto eth0:4
iface eth0:4 inet static
address 104.237.51.93
netmask 255.255.255.248
gateway 104.237.51.89
文章名称:ubuntu批量添加IP
文章来源:http://ybzwz.com/article/jieeji.html