第一步,設置ip。
用root權限編輯文件/etc/network/interfaces
auto lo
iface lo inet loopback
#這兩行一般都有,不需要更改。
auto eth0
iface eth0 inet static
#這兩句表示eth0使用靜態ip地址(static)。如果是動態獲取ip地址,那麼將static改成dhcp,後面的ip地址就不用設置了。
#如果是無線網絡需要設置,那麼對應的,將eth0改成wlan0
#如果需要更改mac地址
hwaddress ether xx:xx:xx:xx:xx:xx
#ip地址
address x.x.x.x
#網關
gateway x.x.x.x
#掩碼
netmaskx.x.x.x
#將dns設置在這裏,似乎沒有作用
dns-nameserver x.x.x.x
第二步,設置dns
用root權限編輯/etc/resolv.conf
#添加dnsnameserver x.x.x.x
nameserver x.x.x.x
重啓網絡服務
#cd /etc/init.d
#./networking restart