2012年11月15日 星期四

[Linux] 設定 static ip @ Ubuntu 12.04

每次要用都又查了一次 Orz 筆記一下吧


$ sudo vim /etc/network/interfaces


auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 10.0.0.180
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.1
dns-nameservers 8.8.8.8


$ sudo /etc/init.d/networking restart


最後一行 dns-nameservers 若不加的話,從開機時 /etc/resolv.conf 會被清空。


沒有留言:

張貼留言