歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

ubuntu中如何添加新IP

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

Copyright © Linux教程網 All Rights Reserved