在ubuntu中添加新IP

vi /etc/network/interfaces

 

会显示如下:

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

 

添加新行

auto eth0:1

 在这行下面

auto eth0

 

添加新的interface信息

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和网关是否正确

 

添加完毕, 会显示如下

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

 

电子书下载

你可能感兴趣的:(ubuntu)