Multiple SSID on OpenWRT with bandwidth limit


If you’re a network junkie and not been living under the rocks, you must have heard of OpenWRT. It’s a Linux distribution for embedded devices (routers) and gives you power to do things usually impossible or difficult with inbuilt router firmware. Wireless Freedom indeed.

This was my scenario: I had to create two wireless APs, one for the guests (no password but bandwidth limited) and another for myself (password protected but no limit on bandwidth). That way the visitors will have free wireless internet, but with limited bandwidth. The office staffs will have to connect to a password protected wifi for unrestricted bandwidth.

The requirements for the APs are,

Free Wifi for visitors
– SSID: ShadhinFree
– Password: none
– Bandwidth limit: 256Kbps uplink, 128Kbps downlink

For myself
– SSID: Shadhin
– Password: 1234567890
– Encryption: WPA2
– Bandwidth limit: none

Here’s how I did it on OpenWRT. Connect to OpenWRT shell.

1. First create two wireless APs with above configuration. Add the following lines to /etc/config/wireless (Remove any existing ‘wifi-iface’ configurations)
#myfi

config wifi-iface
option device ‘radio0’
option network ‘lan’
option mode ‘ap’
option ssid ‘7uxBo7’
option key ‘tuxfi123’
option encryption ‘psk2’

#free

config wifi-iface
option device ‘radio0’
option network ‘lan’
option mode ‘ap’
option ssid ‘7uxBo7-free’
option key ‘457tththgh’
option encryption ‘none’

As simple as that! Now to enable the wifi, go to shell and 

# wifi down; wifi up

2. Now to limit bandwidth, we’ll be using wondershaper. To install:

# opkg update
# opkg install wshaper


3. Now find which interface is the FreeWifi assigned to

# iwconfig

On mine, it was on wlan0

4. Modify /etc/config/wshaper and start wondershaper

config 'wshaper' 'settings'
option 'network' 'wlan0-1'
option 'downlink' '256'
option 'uplink' '128'


Now, start wondershaper.

# /etc/init.d/wshaper start

5. By default, wshaper isnt enabled at startup. so,

# ln -s /etc/init.d/wshaper /etc/rc.d/S99wshaper

Advertisements

One thought on “Multiple SSID on OpenWRT with bandwidth limit”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s