The resolving host issue

I’m using Ubuntu 10.04 and everything seemed fine after installation. One of the very first things that I did was to configure the wireless connection to work with the router at home. Everything seemed fine; I installed Elementary, the Faenza icon set, firefox addons to get the rid of title and menu bars, tweaked this, tweaked that and I felt that it was all coming together sweetly. At this point I decided to setup the ethernet connectivity to an iMac by enabling the connection using Network Manager and specifying a static IP. That’s when the troubles began.

I kept seeing “Connecting …” and “Resolving host…” for long stretches ultimately leading to the page not loading. The really frustrating thing was its intermittent nature. I was quite puzzled and annoyed. There was nothing wrong with my ISP because I was able to connect and surf on the Mac over the air without a hitch in near simultaneous tests. I tried pinging some DNS servers and got nothing back. When I disabled the ethernet connection the problem went away. I figured that I had messed up the networking configuration somehow or maybe the packets don’t know where to go; what I wanted was packets destined for the Internet should go via the wireless device (wlan0) and not through the ethernet card (eth1). I’m no network admin but I had no choice but to learn a little about routing. (At the back of my mind I wondered “Is there a wizard for this somewhere? This is Ubuntu!” Or maybe I just didn’t understand how to use the network manager properly.)

Original setup was as follows:

  • eth1 = 192.168.1.13/24 (static)
  • eth0 = not used
  • wlan0 = 192.168.1.102/24 (allocated by the dhcp program on the router)
  • gateway (on the router) = 192.168.1.1/24
  • ethernet on mac = 192.168.1.3/24 (static)
  • airport on mac = 192.168.1.101/24 (dhcp)
  • wireless asks router to send the dns addresses automatically configuring it (cat /etc/resolv.conf)

Useful routing commands can be learnt from ‘man route’ and [1]. I found the following very useful

  • netstat -i
  • netstat -rn
  • ip -s route get
  • route add/del
  • ip addr | grep inet

More importantly, I messed around with the routing table (which contained just four entries) adding, deleting and modifying entries to see what would happen. The routing table looked like this

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlan0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0

How does the OS actually use this table? Does it read from top to bottom? The gateway is on the same network as eth1. If the OS decides to send a packet to the gateway will it travel via eth1 since it’s the first entry in the table? I couldn’t be bothered to learn more about networking to answer these questions. Instead I decided to put copper connections on a different network; I arbitrarily chose 172.16.1.0. And the problem happily went away 🙂

[1] http://linux-ip.net/html/tools-ip-route.html

Advertisements
Explore posts in the same categories: networking

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: