歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> ubuntu指定靜態IP

ubuntu指定靜態IP

日期:2017/3/3 16:43:41   编辑:關於Linux

默認情況下ubuntu是用dhcp來獲取IP的,對於但用戶來說比較方便,免去了配置網絡的步驟,但是如果是對於多用戶的局域網來說就比較不利,因為dhcp偶爾會更換IP,從而是想要連接的用戶必須更改IP配置。

指定靜態IP的方法如下:

1.編輯/etc/network/interfaces,內容如下

auto eth0
iface eth0 inet static
address  192.168.1.100    #靜態ip
gateway  192.168.1.1      #網關
netmask  255.255.255.0    #子網掩碼

2.編輯/etc/resolv.conf,指定DNS

nameserver 192.168.1.1

3.重新啟動網絡服務

/etc/init.d/networking restart

OK,IP已經指定!

Copyright © Linux教程網 All Rights Reserved