Debian静态IP地址和DNS
一、配置文件及路径/etc/network/interfaces
# The primary network interfaceallow-hotplug eth0iface eth0 inet dhcp
allow-hotplug eth0iface eth0 inet staticaddress 192.168.11.100netmask 255.255.255.0gateway 192.168.11.1
/etc/resolv.conf
添加实际的dns地址:
nameserver 8.8.8.8
有多个就添加多行。
2.如果安装了resolvconf接着在gateway的下面一行添加(注意是/etc/network/interfaces这个文件)dns-nameservers 8.8.8.8
sudo apt-get install dnsutils
1.2 执行dig
;; Query time: 2 msec;; SERVER: 127.0.1.1#53(127.0.1.1);; WHEN: Mon Oct 23 11:52:23 CST 2017;; MSG SIZE rcvd: 239
SERVER:这一行就是配置生效的DNS地址
五、网卡重启systemctl restart networking