我已将 Kali Linux 配置为静态 IP 地址。详细版本信息如下所示。
我无法解析主机名。如果我将名称服务器 IP 地址放入 /etc/resolv.conf,它们会丢失,因为该文件(实际上是链接文件 /etc/resolv.conf 指向的)在启动时会被删除(即使未安装 resolvconf,如下所示)。如果我通过“dns-nameservers”关键字将名称服务器 IP 地址添加到 /etc/network/interfaces,它们似乎被忽略了。
如何正确配置名称解析服务?
root@myHostname:~# uname -a
Linux myHostname 4.9.0-kali3-amd64 #1 SMP Debian 4.9.18-1kali1 (2017-04-04) x86_64 GNU/Linux
root@myHostname:~# cat /etc/debian_version
Kali Linux Rolling
root@myHostname:~# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 35 Jul 15 18:32 /etc/resolv.conf -> /var/run/NetworkManager/resolv.conf
root@myHostname:~# ls -l /var/run/NetworkManager/resolv.conf
ls: cannot access '/var/run/NetworkManager/resolv.conf': No such file or directory
root@myHostname:~# dpkg --list | grep resolvconf
root@myHostname:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.25.100.2
netmask 255.255.255.0
gateway 172.25.100.1
dns-search example.com
dns-nameservers 8.8.8.8
auto eth1
iface eth1 inet static
address 192.168.101.2
netmask 255.255.255.0
root@myHostname:~# nslookup example.com
;; connection timed out; no servers could be reached