ubuntu批量添加IP

发布时间:2020-07-19 08:26:50 作者:爆炒恐龙肉
来源:网络 阅读:1266

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





推荐阅读:
  1. 批量添加ip出错误之二
  2. centos添加批量添加ip提示无效参数

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

批量添加 unutun un

上一篇:windows2008内存使用过高问题

下一篇:wuzhicms模版语法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》