From charlesreid1

Note: These notes cover Kali version 1 and are out of date.

After booting into Kali v 1, I had no ability to reach the internet.

$ ping google.com
ping: unknown host: google.com

I was sitting on a small network on a wireless router, with another installation of Kali Linux also on the network and able to get out to the internet. So, the problem was with the laptop running Kali Linux.

First thing to check is the IP address.

IP Address

ifconfig

I could see my ip address with

$ ifconfig

and I could type 10.0.0.1 into a browser and connect to my router. But I couldn't get past the router. I tried resetting the eth0 network interface:

$ ifconfig eth0 down
$ ifconfig eth0 up

No such luck. Still couldn't reach the outside.

$ ping -c 4 google.com
ping: could not reach host: google.com

network-manager

Also tried restarting the network manager service:

$ service network-manager restart

But no luck there.

dhclient

I tried using dhclient to obtain a new IP address for eth0:

dhclient -v eth0

but this simply acquired a new IP address from the router that was the same as the old IP address.

Still no luck.

Gateway

The next thing to check was the gateway. Since I could reach my router, which is my gateway, I figured this was okay, but checked anyway.

route

I used route to check the current routing path:

$ route -n

This showed that my gateway was 10.0.0.1, and my subnet was 255.255.255.0, as expected.

Nothing to see here.

DNS

resolvconf

I suspected that the problem with reaching the host had something to do with DNS. The resolvconf file, in /etc/resolv.conf, lists a couple of nameserver entries. If an IP address is listed as a nameserver, it means that server is providing you with DNS information. Because ping was returning "unknown host", I suspected this was due to a DNS error.

In the resolvconf file were some nameservers added automatically by the network manager:

nameserver 75.75.75.75
nameserver 75.75.76.76

Okay, these seem fine. But they don't work.

I tried a couple of other pairs:

OpenDNS: 208.67.222.222 and 208.67.220.220

Google: 8.8.8.8 and 8.8.4.4

None of these led to any changes.

hosts

Just in case, I checked /etc/hosts for anything unusual, but all I saw were the loopback interfaces for 127.0.0.1/localhost.

Connection

ping

The next step, at this point in debugging, is to run ping to see if you can connect to anything. But that's exactly the problem...

If ping returns "unknown host" it indicates an issue with the DNS address.

If ping returns "destination host unreachable", you have a DNS route or gateway address issue.

So, at this point I was completely stumped.

Digging Deeper

I really didn't want to have to spend another 2-3 hours reinstalling Kali just because of some dumb network configuration that I had screwed up, so I kept digging...

Using Router for DNS

At this point, I knew I was dealing with a DNS issue - ping was returning "destination host unreachable," I couldn't reach Google.com, but I could reach any computer inside the network.

I also knew I was dealing with a DNS issue between my laptop and the router - since I knew that the DNS service worked fine for the other Kali Linux desktop running on the local network.

I started by forcing the DNS server to be the router itself:

$ echo "nameserver 10.0.0.1" > /etc/resolv.conf

Then I gave ping another try:

$ ping linux.org
PING linux.org (107.170.40.56) 56(84) bytes of data.

At this point, we had SOME success - the router worked as a DNS server, and we were able to successfully turn a domain name (linux.org) into an IP address. But we still had a problem: ping wasn't actually returning anything. Everything was being dropped.

Network Dropping Everything

Okay, now the problem was that the network was dropping everything. I had no idea what was going on.

I rebooted into Mac OS X. I left the network cable plugged in. I got to the desktop, and opened a browser, and typed linux.org.

It said "Connecting to host..."

and nothing.

Wireless Network Not Dropping Everything

I pulled out the network cable and hit refresh - and there it was! Linux.org!

Something very fishy was going on with the ethernet wire I was using.

Changing Wired Cable and Port

At this point, I tried switching ethernet cables and ports with the Kali Linux desktop that I knew was working. This cable was guaranteed to work, this port was guaranteed to work.

I rebooted into Kali, and tried to ping google.com and linux.org.

Nothing.

The Clues

Here are the clues we have:

  • The problem is particular to the connection between my laptop and my router.
  • (Wireless wasn't working in Kali.)
  • Ethernet problems in Kali showed up in Mac, too (couldn't find a route to the host).
  • Wireless works ok in Mac, so it isn't a problem with the laptop itself.
  • Another computer on the network works, so it isn't a problem with the router itself.

With all of these clues, I determined that the problem was with THE MAC ADDRESS OF MY MAC LAPTOP'S WIRED PORT.

So anytime I tried to connect, FROM my laptop's wired network port, TO the router, using any cable or any port, the problem would arise.

The Solution

I opened the router's configuration page in a browser at 10.0.0.1 and logged in.

I released the network address for my wired mac laptop connection (it was plugged into the network - remember, I could access 10.0.0.1 and the whole subnet just fine using the wired connection).

I refreshed the router configuration page.

I got a new IP address.

I opened a browser window and typed "Linux.org". Voila! Linux.org came up! The wired router connection now worked!

It just came down to some crud in the network cache.