Normally this works fine in Linux. But, a small number of routers (including my own, a D-Link wireless router), don't seem to play well with Linux. The router has its own IP address and when you request data (ie enter a URL or click on a link) the request will reach the router's IP address and will then be forwarded to the ISP's domain name server. For some reason, that doesn't seem to work with these routers, and they fail to forward the request on to the domain name server.
This can be very frustrating, as it means that many applications will not be able to access the Internet. I found that Firefox and apt-get could not access the Internet, but Konqueror could, so I could browse but I couldn't install anything new. This doesn't always happen - it happened with Ubuntu Edgy and also happens with Ubuntu Gutsy, but wasn't present in Ubuntu Feisty, and it very nearly stopped me from using Kubuntu Gutsy at all.
Fortunately, there's a great service which can help with this. Open DNS is a third-party domain name server you can use instead, and also works better and faster than most ISP's DNS service.
You can configure your router to use Open DNS if you want - just follow this link to get full instructions. Or to just configure your Ubuntu machine, here's full instructions:
First, enter the following in a terminal:
Please note, this works on Ubuntu and Xubuntu only. Kubuntu users will need to open KnetworkManager (which normally starts up at outset, and is in the system tray on the bottom right by default - look for a picture of a cable if you're connected via Ethernet, a signal strength meter if you're using Wi-Fi, or an unplugged socket if you're not connected to the Internet), and then click on Manual Configuration to open the configuration screen.
Whichever program you're using, you'll see a tab marked "DNS". Click on that, remove the existing domain name servers, and replace them with the following:
- 220.127.116.11 as your preferred DNS (or just first in line)
- 18.104.22.168 as your alternate DNS (or just second)
That will set Open DNS as your domain name server, so you can now exit the program. To make sure it sticks though, we're going to have to edit a text file. Enter the following in a terminal:
sudo cp /etc/resolv.conf /etc/resolv.conf.auto
This copies a text file into a new name. Now enter the following:
sudo nano /etc/dhcp3/dhclient.conf
That opens the text file /etc/dhcp3/dhclient.conf. Add the following line to the end of the document:
prepend domain-name-servers 22.214.171.124,126.96.36.199;
Then save and exit the document. You will now also have to switch off IPv6, which is easy:
sudo nano /etc/modprobe.d/aliases
Now look for a line that reads as follows:
alias net-pf-10 ipv6
and edit it to this:
alias net-pf-10 off
Now all you need to do is restart your connection. Enter the following:
sudo ifdown eth0
substituting the name of your connection for eth0. Then:
sudo ifup eth0
That should restart your connection. If not, and you still can't get online, try rebooting.
This method is what I used to get online. Apparently it's not an issue with Linux, but with the router's firmware, and some people have reported success in overcoming this issue simply by updating their router's firmware. In addition, I've found that some Ubuntu-based distros, such as Linux Mint, have already taken care of this issue before release. However, you may wish to use your laptop running Ubuntu in a public place such as a cafe where there is free wi-fi, and under those circumstances you can't expect to be able to update the router, so you may need to do this anyway.
It also goes to show that with wireless routers, you get what you pay for - if you're thinking of getting one, don't just opt for the cheapest. I was confronted with the choice between a Belkin and a D-Link, and I opted to save £10 by going for the D-Link. Two weeks later I read an article in a magazine that had a round-up of wireless routers, and they had both of them in there, and it said the D-Link was terrible and to get the Belkin instead as it had a stronger signal and was a lot more reliable. I'm willing to bet it would probably work better with Linux too!