Ubuntu 設(shè)定靜態(tài)IP:
切換到root用戶,然后進(jìn)入/etc/network目錄。備份interfaces文件(備份文件是一個(gè)好習(xí)慣)
下面編輯interfaces文件,添加如下語句:
1 # Assgin static IP by eric on 26-SEP-20122 iface eth0 inet static3 address 192.168.196.135 #change to your static IP4 netmask 255.255.255.0 #change to your netmask5 gateway 192.168.196.255 #change to your getway6 #We must specify dns-nameserver here7 #in order to get internet access from host8 dns-nameservers 192.168.196.2559 auto eth0
編輯完成后的interfaces文件內(nèi)容如下:
root@ubuntu:/etc/network# cat interfaces# interfaces(5) file used by ifup(8) and ifdown(8)auto loiface lo inet loopback#add by andy at 2014-08-14# Assgin static IP by eric on 26-SEP-2012iface eth0 inet staticaddress 192.168.196.135 #change to your static IPnetmask 255.255.255.0 #change to your netmaskgateway 192.168.196.255 #change to your getway#We must specify dns-nameserver here#in order to get internet access from hostdns-nameservers 192.168.196.255auto eth0
下一步就是重啟網(wǎng)卡:
root@ubuntu:/etc/network# /etc/init.d/networking restart重啟完成后,測試一下: root@ubuntu:/etc/network# ping www.baidu.com.cn PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data. 64 bytes from 220.181.112.244: icmp_req=1 ttl=128 time=6.12 ms 64 bytes from 220.181.112.244: icmp_req=2 ttl=128 time=14.7 ms
OK。靜態(tài)IP設(shè)置完成。
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選