加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

ubuntu中如何添加新IP

发布时间:2016-10-29 02:50:23 所属栏目:Linux 来源:网络整理
导读:vi /etc/network/interfaces 会显示如下: Java代码 auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 207.210.118.56 netmask 255.2

vi /etc/network/interfaces

会显示如下:

Java代码

auto lo  
iface lo inet loopback  
      
auto eth0  
iface eth0 inet static
        address 207.210.118.56
        netmask 255.255.255.224
        broadcast 207.210.118.63
        network 207.210.118.32
        gateway 207.210.118.33

添加新行

Java代码

auto eth0:1

在这行下面

Java代码

auto eth0

添加新的interface信息

Java代码

iface eth0:1 inet static
        address 207.210.118.58
        netmask 255.255.255.224
        broadcast 207.210.118.63
        network 207.210.118.32
        gateway 207.210.118.33

检查MASK和网关是否正确

添加完毕, 会显示如下

Java代码

auto lo  
iface lo inet loopback  
      
auto eth0  
auto eth0:1
iface eth0 inet static
        address 207.210.118.56
        netmask 255.255.255.224
        broadcast 207.210.118.63
        network 207.210.118.32
        gateway 207.210.118.33
iface eth0:1 inet static
        address 207.210.118.58
        netmask 255.255.255.224
        broadcast 207.210.118.63
        network 207.210.118.32
        gateway 207.210.118.33

之后重启网络

/etc/init.d/networking restart

本文URL地址:http://www.bianceng.cn/OS/Linux/201410/45338.htm

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读