It may not be long before wireless networks[1] are widely used everywhere. From libraries to coffee shops, from tram stations to airports, hotels, from your home to your neighbor’s house, everyone will be using wireless networks. Did you know that if your home has a wireless network, your neighbors could ‘share’ the connection with you without needing an internet account? Or if you are planning to design a network for multiple offices in a building, or from one building to another (approximately 457m or 1500ft apart) without cables, then wireless networking is likely one of the designs you can use. But, Larry, wireless networks are very expensive! Not necessarily! Mr. Chương Đào mentioned that wireless network cards can be purchased for about $27 (USB type) or even less.
The following article will explain how to set up a wireless network using 802.11b with Linux. There are many types of wireless networks, but this article will focus on 802.11b, and in about half an hour, you can use the wireless network to read the VietLUG mailing list 🙂
To design a wireless network, you need:
1. A Linux machine to act as the Access Point (AP)
2. A wireless network card
3. An internet connection (DSL, cable modem, dial-up modem)
4. And of course, a client machine.
Oh, I almost forgot number 1 should read ‘A Linux machine will act as the Access Point’, not Windows.
To use a Linux machine as an AP, you need a network card that uses Intersil’s Prism2/2.5/3 chipset. So, what program allows Linux to function as an Access Point? It is HostAP, written by Jouni Malinen. For the purposes of this article, I will use two machines:
1. The Access Point is a Gentoo machine with a NetGear PCI MA311 network card
2. The wireless client is a Mandrake laptop with a NetGear MA401 network card.
Some cards that also use the Prism2 chipset include Compaq WL100 and WL200, D-Link DWL-650 (not 650A or 650B), and Linksys WPC11 (older model), Orinoco/Lucent/Agere/Avaya cards. Remember, you only need the AP machine to use the Prism2/2.5/3 chipset, while the client machines can use any card that works on Linux. Check out the list of Prism2 cards [2].
Preparation Steps for the Access Point on Gentoo:
1. Install hostap with the command:
emerge hostap
If you are not using Gentoo, you can download the HostAP driver from here. Then install it with the command:
. tar xvzf hostap-version.tar.gz
. cd hostap-version
. make pci
If everything goes smoothly, type make install
2. Start the card with the command:
modprobe hermes
Note: If your Linux distribution has already started the card, you do not need to run this command again.
3. Start the HostAP driver with the command:
modprobe hostap_pci
4. Assign an IP to the card with the command:
ifconfig wlan0 192.168.1.1
5. Create an ID, channel, and mode for the card with the command:
iwconfig wlan0 essid em_thèm_mạng_không_dây channel 1 mode master
essid: You can use any word you like. This is the ID of the wireless network.
channel: I use values from 1 to 11.
mode: If it is an Access Point, the mode must be Master. There are 7 different modes: Master (Access Point), Managed, Ad-Hoc, Repeater, Secondary, Monitor, Auto.
6. Open port forwarding and MASQUERADING with the command:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
The six steps above complete the setup for the AP machine. If you encounter an error when running the iwconfig command, it means your machine does not have wireless-tools installed. You can download wireless-tools from here.
Preparation Steps for the Mandrake Laptop:
1. Assign IP, essid, and mode for the card:
Mandrake will automatically detect and start the NetGear MA401 card; you just need to assign an IP 192.168.1.[2..254], set the essid to match that of the AP (in this case ’em_mê_mạng_không_dây’), and the mode will be ‘Managed’, with the default gateway set to 192.168.1.1 using MandrakeControlCenter (command mcc) under the Network section.
Non-Mandrake users can run the following commands:
ifconfig eth0 192.168.1.2
iwconfig eth0 mode managed essid em_mê_mạng_không_dây channel 1
2. Set the gateway value with the command:
route add -net default gw 192.168.1.1
3. Review the DNS values: You should use the same DNS servers as the AP by filling in /etc/resolv.conf.
Voilà! Now try ping 192.168.1.1
to see if it replies. If it does, congratulations! Your wireless network is up and running.
Wireless Network Security Issues:
Wireless networks are notorious for being vulnerable to crackers. That’s why users often employ WEP (Wired Equivalent Privacy) encryption. You can use WEP with the command $iwconfig wlan0 key your_encryption_key_or_alphanumerical_letters_here. You can also have more than one key, simply replace key with key1, key2, etc.
However, using WEP is still not the optimal solution. Recently, researchers have been preparing to introduce a new encryption method for wireless networks (Wi-Fi Protected Access – WPA) as part of 802.11i. Don’t worry, 802.11i will still work well with 802.11a and b. Currently, 802.11g is also available on the market, which differs from a and b in that it can achieve speeds of up to 54Mbps instead of 11Mbps.
Thanks to Mr. Hoàng (dr bsd) and Mr. Chương (dr foobar) for enthusiastically sharing their wireless experiences with me. Please send feedback regarding this article to mạng_không_dâ[email protected]. I hope you can use some of this information for your future network design.
HostAP http://hostap.epitest.fi/
Wireless tools for Linux http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
[1] Wireless network: wireless network. Wi-Fi (wireless fidelity) is a common term for wireless networks. You may also hear WLAN: wireless local area network.
[2] List of cards using the Prism2 chipset http://www.personaltelco.net/index.cgi/Prism2Card
Author: Larry – vnLinux.org