1. 程式人生 > >ubuntu ifconfig新增新網段

ubuntu ifconfig新增新網段

在ubuntu中新增新的網段,方法如下

vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.13
gateway 192.168.1.1

netmask 255.255.255.0

broadcast 192.168.1.255

auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card
address 192.168.2.13
netmask 255.255.255.0
broadcast 192.168.2.255
network 192.168.2.1

儲存退出,重啟網路/etc/init.d/networking restart

這樣就可以在不同的網段訪問該系統。