侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

ubuntu批量添加IP

2022-07-09 星期六 / 0 评论 / 0 点赞 / 51 阅读 / 1732 字

ubuntu 批量添加ip脚本# !/bin/bashfor ((i=0;i<=3;i=i+1))do echo "auto eth0:$i">>/etc/network/interfaces e

.

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





.

广告 广告

评论区