installing openwrt as an access point

21 Jul 2014

In previous post I wrote about how to use openwrt as a wireless repeater, this time I’ll use it as an access point, how practical!

The target device is a TP-Link N750, and I’m using the latest trunk build.

$ wget downloads.openwrt.org/snapshots/trunk/ar71xx/generic/openwrt-ar71xx-generic-tl-wdr4300-v1-squashfs-factory.bin

Or, when there is a previous openwrt version already installed:

$ wget downloads.openwrt.org/snapshots/trunk/ar71xx/generic/openwrt-ar71xx-generic-tl-wdr4300-v1-squashfs-sysupgrade.bin

After completing the download, it can be installed by going to the “Firmware Upgrade” menu of the Link web interface and selecting the openwrt firmware.

Be aware that the trunk build is minimal, it doesn’t include the luci web interface, so it’s up to every person to decide if they want it or not.

To install additional software connect to the device and share temporary your laptop/desktop internet

# flush previous iptables rules
$ sudo iptables -F
$ sudo iptables -X
$ sudo iptables -t nat -F
$ sudo iptables -t nat -X
$ sudo iptables -t mangle -F
$ sudo iptables -t mangle -X
$ sudo iptables -P INPUT ACCEPT
$ sudo iptables -P FORWARD ACCEPT
$ sudo iptables -P OUTPUT ACCEPT
# route laptop traffic through wlan0 (wireless) interface
$ sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
$ while true; do sudo ifconfig eth0 192.168.1.2; sleep 1; done
$ telnet 192.168.1.1 #type "passwd" to set the root passwd
# be aware than in current openwrt releases telnet is no longer provided
# in those cases just skip this step
$ ssh root@192.168.1.1 #from other terminal window
openwrt # passwd #set the root passwd in case telnet service isn't available
openwrt # ifconfig br-lan 10.9.8.7
$ while true; do sudo ifconfig eth0 10.9.8.10; sleep 1; done #bypass networkmanager
$ ssh root@10.9.8.7
openwrt # route add default gw 10.9.8.10
openwrt # echo "nameserver 8.8.8.8" > /etc/resolv.conf
openwrt # opkg update
openwrt # opkg install luci
openwrt # /etc/init.d/uhttpd enable
openwrt # /etc/init.d/uhttpd start

Upon completing the installation, go to the web interface, http://10.9.8.7, and reconfigure the LAN interface to make permanent the IP address:

Create the Access Point (linked to the lan interface)

Connect a ethernel cable to the WAN interface (on this device it’s a blue port behind), that’s it, profit!, happy browsing ✌