Ubuntu下修改IP地址 DNS

sudo vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# 動態IP
# 內容如下:
# The primary network interface
auto eth0
iface eth0 inet dhcp

# 靜態IP地址:
# 內容如下:
# The primary network interface
auto eth0
iface eth0 inet static
address 172.19.0.10
netmask 255.255.255.0
#network 172.19.0.0
#broadcast 172.19.0.255
gateway 172.19.0.1

然後重啓網絡服務,使IP地址生效

sudo /etc/init.d/networking restart

再來添加DNS解析服務器

sudo vi /etc/resolv.conf

內容如下:
search domain.com
nameserver xxx.xxx.xxx.xxx

如:
nameserver 218.85.157.99
nameserver 218.85.152.99
完畢!
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章