I’ve wanted my Linux server (Arch Linux 2.6.30-ARCH) to act as a wireless access point. I had to overcome a few issues while configuring the access point. I will be using WEP as encryption for my new wireless access point.
I had to install a few packages before I could start:
pacman -S bridge-utils hostapd wireless-tools
Here you can see my NIC and my wireless pci card:
4 root@archserver $ lspci | grep Ethernet
00:08.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)
00:09.0 Ethernet controller: D-Link System Inc DGE-528T Gigabit Ethernet Adapter (rev 10)
Arch Linux comes with the ath5k module for this wireless card, unfortunately I wasn’t able to put my wlan0 into Master Mode with this module.
I needed the ath_pci module, which is delivered by madwifi. So I’ve executed:
pacman -S madwifi
So in order to put my wireless into Master mode I’ve commited a few necessary changes.
First of all, I had to blacklist the default ath5k module. You can do this by modifying your /etc/rc.conf file.
Change the MODULES array of your rc.conf, and make sure an note of exclamation is present before ath5k. This module has been blacklisted now.
16 root@archserver $ cat /etc/rc.conf | grep MODULES
# MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
# NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array.
Then I’ve inserted the new module who supports Master Mode into the Linux kernel. Executing
iwconfig ath0 mode Master did not give any error.
iwconfig ath0 mode Master
Now you have to modify /etc/modprobe.d/modprobe.conf in order to use ath_pci with the ap option (for access point).
alias ath0 hostap_pci
options ath_pci autocreate=ap
After that I had to modify /etc/rc.conf, Arch Linux its main configuration file. I’m using dhcp for eth0. The interfaces array declares all the available interfaces. (deuh!) The bridge device is named br0, and it will be a bridge between eth0 (wired) and ath0. (wireless)
br0="br0 192.168.0.101 netmask 255.255.255.0 up"
INTERFACES=(lo eth0 ath0 br0)
Changing /etc/conf.d/wireless or /etc/conf.d/bridges gave me some trouble, I’ve decided to edit /etc/rc.local (the multi-user start-up script.) This is my /etc/rc.local:
29 root@archserver $ cat /etc/rc.local
# /etc/rc.local: Local multi-user startup script.
iwconfig ath0 mode master essid phar0z key A1B3C5D7E0 channel 1
brctl addbr br0
brctl addif br0 ath0
brctl addif br0 eth0
ifconfig br0 up
You may have noticed I prefer dhclient above dhcpcd.
pacman -R dhcpcd && pacman -S dhclient
I noticed there wasn’t a good Arch-oriented access point guide on the net. As you can see this configuration worked fine for me:
30 root@archserver $ brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.00179a76b010 no ath0
Now I will scan for wireless essids on my Ubuntu laptop. I execute
iwlist wlan0 scan on my notebook:
wlan0 Scan completed :
Cell 01 - Address: 00:15:E9:F5:62:58
Frequency:2.412 GHz (Channel 1)
Quality=47/70 Signal level=-63 dBm
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s
Bit Rates:9 Mb/s; 18 Mb/s; 48 Mb/s; 54 Mb/s
Extra: Last beacon: 4300ms ago
IE: Unknown: 0005646C696E6B
IE: Unknown: 010882848B960C183048
IE: Unknown: 030101
IE: Unknown: DD0600032F010001
IE: Unknown: 2A0100
IE: Unknown: 32041224606C
IE: Unknown: DD0900037F010100060000
IE: Unknown: DD0C00037F020101DB0002A44000
Cell 02 - Address: 00:17:9A:76:B0:10
Frequency:2.437 GHz (Channel 6)
Quality=70/70 Signal level=-27 dBm
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Extra: Last beacon: 4040ms ago
IE: Unknown: 000670686172307A
IE: Unknown: 010882848B0C12961824
IE: Unknown: 030106
IE: Unknown: 07064E4149010D14
IE: Unknown: 200100
IE: Unknown: 2A0100
IE: Unknown: 32043048606C
IE: Unknown: DD180050F2020101830002A3400027A4000042435E0062322F00
IE: Unknown: DD0900037F01010034FF7F
“dlink” is the essid of my router, whereas “phar0z” is the essid of my own software access point on my server.
I’ve changed my /etc/network/interfaces file on my Linux laptop.
iface lo inet loopback
iface wlan0 inet dhcp
Then I ran
/etc/init.d/networking restart. And this is the new output of
wlan0 IEEE 802.11abgn ESSID:"phar0z"
Mode:Managed Frequency:2.437 GHz Access Point: 00:17:9A:76:B0:10
Bit Rate=24 Mb/s Tx-Power=15 dBm
Retry min limit:7 RTS thr:off Fragment thr:off
Encryption key:A1B3-C5D7-E0 Security mode:open
Link Quality=62/70 Signal level=-26 dBm Noise level=-127 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Everything is working fine.