码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu批量添加IP

时间:2015-08-27 19:14:13      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:unutun   批量添加   

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







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




上为一个脚本程序(ip较多的时候)

下为ip数量较少

ubuntu批量添加IP

标签:unutun   批量添加   

原文地址:http://9283898.blog.51cto.com/9273898/1688876

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!