I have Kali Linux configured with a static IP address. Detailed version information is shown below.

I cannot resolve hostnames. If I put nameserver IP addresses in /etc/resolv.conf, they get lost because that file (actually, the linked file /etc/resolv.conf points to) gets deleted on boot (even though resolvconf is not installed, as shown below). If I add nameserver IP addresses to /etc/network/interfaces via the "dns-nameservers" keyword, it seems they are simply ignored.

How may I properly configure name resolution services?

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
   dns-search example.com

auto eth1
iface eth1 inet static
root@myHostname:~# nslookup example.com
;; connection timed out; no servers could be reached
  • I have tried from elsewhere on the same network, and names resolve fine. In fact, the Kali Linux machine my post is about was resolving fine when it had a dynamic IP address (DHCP). It was only when I switched over to a static IP address that I could not resolve names.
    – Dave
    Jul 16, 2017 at 5:55
  • Which interface are you going out to the Internet on from this machine? eth0 or eth1? Are you sure you are configuring the correct NIC you are going out to the Internet from on that machine? Jul 16, 2017 at 6:04
  • eth0 is the intetface out to the Internet.
    – Dave
    Jul 16, 2017 at 6:12
  • 1
    On my Kali VPS /etc/resolv.conf links to /run/NetworkManager/resolv.conf. On yours does resolv.conf exist in /run/NetworkManager ? If so you should try adding your nameservers there and changing the /etc/resolv.conf softlink.
    – n8te
    Jul 16, 2017 at 6:50


You must log in to answer this question.

Browse other questions tagged .