在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