[Ubuntu]如何设置静态IP和DNS-创新互联
编辑 /etc/network/interfaces 来设置 IP 和 DNS 解析服务器: ![[Ubuntu]如何设置静态IP
和DNS [Ubuntu]如何设置静态IP
和DNS](/upload/otherpic25/2167348.jpg)
分享题目:[Ubuntu]如何设置静态IP和DNS-创新互联
网址分享:http://azwzsj.com/article/joejg.html
![[Ubuntu]如何设置静态IP
和DNS [Ubuntu]如何设置静态IP
和DNS](/upload/otherpic25/2167348.jpg)
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address192.168.1.6
gateway192.168.1.1
netmask255.255.255.0
dns-nameservers 192.168.1.1
#network192.168.1.0
#broadcast192.168.1.255
多个 DNS 解析服务器之间使用空格分隔:
dns-nameservers 192.168.1.1 8.8.8.8
使修改立即生效:
sudo ifdown eth0 && sudo ifup eth0
若未能即时生效,可尝试将 /etc/resolv.conf 设置为 /run/resolvconf/resolv.conf 的软连接:
ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
如果只是临时更改 DNS 服务器,编辑 /etc/resolv.conf,添加以下内容:
nameserver 8.8.8.8
resolv.conf 是个动态文件,每次开机会被重新覆盖,因此要添加永久性DNS,采用第一种方式为佳,第一种方式每次开机后会将 dns-nameservers 值写入 resolv.conf 文件中。
分享题目:[Ubuntu]如何设置静态IP和DNS-创新互联
网址分享:http://azwzsj.com/article/joejg.html