AP OPENWRT PC
From M1Research
Contents |
Hardware
For target platform we will use standard PC with D-link DWA-520G (Atheros chipset) WiFi board compatible with hostapd. We install 2 NIC (Intel Ethernet 100) to provide WAN and LAN interfaces.
Build OpenWrt
Downloading
I recommend download latest trunk version. Use subversion repo:[verem@aipetry ~]$ svn checkout https://svn.openwrt.org/openwrt/trunk kamikazeAfter downloading rename directory - append trunk version suffix. I my case:
mv kamikaze kamikaze-r11772
Building prerequisites
For build OpenWrt images i used FC8 (Fedora Core 8) distro. Make sure you have installed:
- gcc
- g++
- compat-gcc-34 (required due to some news changes in supplied gcc with FC8)
- compat-g++-34
- bison
- flex
- ncurses-devel
- zlib-devel
Configuration
Goto to source directory and configure:[verem@dev-2 src]$ cd kamikaze-r11772 [verem@dev-2 kamikaze-r11772]$ CC=gcc34 make menuconfig
Select:
-
Target system
x86 [2.6] - Check:
- Select all packages by default
- Advanced configuration options (for developers)
- Buildsystem settings
- Build the OpenWrt Image Builder
- Image configuration
- override built-in for Network:
- hostapd
- hostapd-mini
- hostapd-utils
- wpa-supplicant
- override built-in for Kernel modules - Network Devices that will be used in your platform, in my case Intel(R) PRO/100+ cards.
- override built-in for Kernel modules - Wireless Drivers that will be used in your platform, in my case Driver for Atheros wireless chipsets
After this changes made exit and confirm changes saving
Building
Start building process:[verem@dev-2 kamikaze-r11772]$ CC=gcc34 make ++ mkdir -p /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2 ++ cd /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2 ++ mkdir -p bin lib include stamp ............ make[3] -C target/linux install make[3] -C target/sdk install make[3] -C target/imagebuilder install make[2] package/index [verem@dev-2 kamikaze-r11772]$
Installation
Resulting images located in
Configure OpenWrt
After firmware starts goto shell and edit (use vi) some configuration files.
Edit network configuration/etc/config/network
:config interface loopback option ifname lo option proto static option ipaddr 127.0.0.1 option netmask 255.0.0.0 config interface wan option ifname eth0 option proto static option ipaddr 10.1.5.190 option netmask 255.255.0.0 option gateway 10.1.1.1 option dns 10.1.1.1 config interface lan option type bridge option ifname "eth1 ath0" option proto static option ipaddr 192.168.1.1 option netmask 255.255.255.0Edit wireless configuration
/etc/config/wireless
:config wifi-device wifi0 option type atheros option channel 2 config wifi-iface option device wifi0 option mode ap option ssid home-home-openwrt option encryption psk2 option key 0123456789ABCDEF
Customize channel and key used for your case.
Change root password to enable ssh login:root@OpenWrt:~# passwd Changing password for root New password: Retype password: Password for root changed by root root@OpenWrt:~#Allow ssh access to device from WAN port,
/etc/firewall.user
:[...] ### Open port to WAN ## -- This allows port 22 to be answered by (dropbear on) the router iptables -t nat -A prerouting_wan -p tcp --dport 22 -j ACCEPT iptables -A input_wan -p tcp --dport 22 -j ACCEPT [...]Reboot system:
root@OpenWrt:~# reboot