Ubuntu16.04設定ip,dns
阿新 • • 發佈:2019-01-08
Ubuntu16.04設定ip/dns
注意:在設定完ip/dns後,需要自己重新開啟一下網路服務(有時甚至需要重啟電腦):
sudo /etc/init.d/networking restart
設定ip
sudo gedit /etc/network/interfaces
開啟的檔案如下:
- [注] 新增時,在終端先查一下自己想要設定的網絡卡的名稱,不一定是eth0,將eth0替換為自己網絡卡的名稱,然後將自己設定的地址等資訊更換即可
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.88
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if instatlled
dns-nameservers 192.168.0.1
設定DNS
sudo vi /etc/resolvconf/resolv.conf .d/base
開啟檔案寫入:
search localdomain #如果本Server為DNS伺服器,可以加上這一句,如果不是,可以不加
nameserver 8.8.8.8 #希望修改成的DNS
nameserver 114.114.114.114 #希望修改成的DNS