Wireless on the Road
Wireless Internet access has become easy to find in large cities. But I take vacations in more out-of-the-way places, where "the Internet" still is a new concept. Getting Internet access in most small towns isn't always a straightforward task. Here are some tips that might help you keep your Linux laptop connected on your next trip.
A few preparations before you leave home may help a lot down the road. Test your wireless card thoroughly. If you don't have a wireless network at home, work or school, try to find a local Internet cafe. You don't want to be diagnosing the problems of an unfamiliar network when you're not even sure if your card's driver works or if your hotplug setup is handling PCMCIA cards properly.
Add entries to /etc/hosts for important sites you need to contact, such as your mail server. Make a copy of your /etc/resolv.conf file while you're at home, along with the IP addresses of any other nameservers you trust. As we'll see, you can't always rely on getting accurate DNS information on the road.
The ideal situation is to find a hotel that offers Wi-Fi access, but this is harder than it sounds. Auto-club road guides are no help; they offer a symbol for data port, which means the telephone has an extra place to plug in a phone cable. Why anyone thinks this matters is beyond me. If you want modem access, simply unplug the phone from the wall.
Watch for hotel billboards as you drive in to a town; sometimes the snazzier hotels advertise "High-Speed Internet". If the billboards are no help, read the hotel signs and watch for banners on the hotels as you drive through town.
But beware! High-speed Internet does not mean "We have Wi-Fi that reaches your room". Sometimes it means, "We have one public Windows computer with a DSL connection in the hotel lobby, and you can use it if you don't mind typing your e-mail info and all your passwords into Internet Explorer or Outlook on a public terminal that a hundred guests will use right after you." Look for key phrases, such as "wireless Internet" or "in-room Internet".
If you see no billboards or banners, you may have to go from door to door and ask. Most hotel desk clerks do understand the question these days, and if they don't offer wireless, they may be able to direct you to a hotel that does.
Side note: many hotel clerks, when describing their wireless Internet services, start to hand you a card and a CD with Windows drivers. Assure them that you have your own laptop and wireless card, and they become much happier and stop scaring you with driver discs.
So, you've found a hotel with Wi-Fi access. You're using your own wireless card, which you tested before you left home. You're all set, right? Nope--there still are a lot of potential issues to work through.
The first issue is range. In my experience, fewer than half of the hotels that claim in-room Wi-Fi actually have a signal that can reach a typical PCMCIA card's antenna in most of the rooms. When you check in, be sure to tell them you care about Internet access, as they may give you a room closer to the access point. But don't count on it, even then. If you don't get a signal from the room, try the hotel lobby and see if it's any better from there.
An external antenna can help with reception, either a purchased antenna or a homemade cantenna--a wireless antenna made from a soup can. The trick is finding a way to connect an antenna to the wireless card. Many internal wireless cards already have an antenna connector; it may be as simple as unplugging the wire to the built-in antenna and replacing it with an external one, although you may have to make your own connector. If you use a PCMCIA wireless card, it's more difficult, as few of these cards offer an external antenna option. If you can't find such a card, all is not lost; it's sometimes possible to modify an existing card to add an antenna. Try a Web search on the model of your card plus the phrase "antenna modification". Obviously, don't try this with your only wireless card or with a card that's so expensive you can't risk destroying one or two.
Now you have a signal. Most hotel and cafe wireless access is set up as an open line (no WEP encryption) with dynamic addressing using DHCP, the dynamic host configuration protocol. So, you obviously should set up your machine for DHCP. But what if the server doesn't give you an address? Try running /sbin/ifconfig -a. You should see output something like this:
eth0 Link encap:Ethernet HWaddr 00:03:6D:00:83:CF inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:47 errors:0 dropped:0 overruns:0 frame:0 TX packets:3 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:7112 (6.9 MiB) TX bytes:1522 (1.4 KiB) Interrupt:11 Base address:0xd000
If the card is marked UP and there is no inet addr, then DHCP probably isn't working. In this case, you may be able to connect using a static address.
How do you choose a suitable address? That's tricky. Most public wireless networks use the 192.168.1.* address range, so you could choose an IP address between 192.168.1.1 and 192.168.1.254 and try it. That's somewhat unfriendly, but it may work. Alternatively, you can use a Net sniffer, such as Kismet or Airsnort, to snoop on the Net and see what sort of addressing scheme they're using. But in small-town hotels, you might find that no one else is on the Net, especially if it's not working correctly. In this case, guessing might be the only option.
A static address also may help with a flaky connection. If you're on the ragged edge of reception, constantly losing a connection and then getting a new one, as so often happens with hotel networks, not needing to make a new DHCP query every time can make the difference between a connection that is merely slow and one that doesn't work at all.
Much more common is to get a valid DHCP address but no nameserver, the service that maps domain names such as example.com to Internet addresses. If this is the case, your network will be up and you'll be able to get to IP addresses or hosts specified in /etc/hosts, but you'll hang any time you try to reference any other host by name.
On Linux, user cat /etc/resolv.conf to find out what DNS information you've been given. It may be wrong in some fairly obvious way. For instance, one hotel listed 0.0.0.2 as the nameserver, but DHCP had assigned our machines addresses of the form 10.0.0.18. After editing /etc/resolv.conf to change the nameserver's address to 10.0.0.2, everything worked fine.
If there's no obvious error in resolv.conf, try using the DNS server you use at home. Pull out the resolv.conf you copied at home and install it in /etc. It may help.
August 27, 2015
12:00 PM CDT
Free to Linux Journal readers.Register Now!
- Django Models and Migrations
- Hacking a Safe with Bash
- Secure Server Deployments in Hostile Territory, Part II
- The Controversy Behind Canonical's Intellectual Property Policy
- Home Automation with Raspberry Pi
- Huge Package Overhaul for Debian and Ubuntu
- Shashlik - a Tasty New Android Simulator
- KDE Reveals Plasma Mobile
- Embed Linux in Monitoring and Control Systems
- diff -u: What's New in Kernel Development