天啊!我好像忘了介紹這個重要而不起眼的東東
它的設定檔只有一個在
/etc/network/interfaces
引用:
#本機介面 lo
auto lo
iface lo inet loopback
#第一片網卡eth0( 自動取得IP)
auto eth0
iface eth0 inet dhcp
如果我們要設定它的IP
就這樣改
引用:
auto eth0
iface eth0 inet static
address 163.23.89.65 #網卡IP
network 163.23.89.64 #網路
netmask 255.255.255.192 #遮罩
broadcast 163.23.89.127 #廣播
gateway 163.23.89.126 #通訊閘道
如果有兩個IP我們就這樣改
引用:
auto eth0
iface eth0 inet static
address 163.23.89.65 #網卡IP
network 163.23.89.64 #網路
netmask 255.255.255.192 #遮罩
broadcast 163.23.89.127 #廣播
gateway 163.23.89.126 #通訊閘道
auto eth1
iface eth1 inet static
address 192.168.1.2 #網卡IP
network 192.168.1.0 #網路
netmask 255.255.255.0 #遮罩
broadcast 192.168.1.255 #廣播
設好後重新啟動網路就可以了
sudo /etc/init.d/networking restart