Setting GuruPlug to be a WiFi Access Point

From PlugWiki
Jump to: navigation, search

Contents

Scope

  • GuruPlug can be used as wireless Access Point.
  • It can also act as a default router/gateway for the devices connected to this Access Point.
  • The wired interface (eth0) acts as the WAN interface for the plug.

AP Mode

  • The default mode upon bootup is AP mode.
  • There is a provision to switch to WiFi client mode (in the webpages) but upon every reboot, GuruPlug will come up in the AP mode.
  • In order to switch the mode, please follow these instructions.
  • The bluetooth functionality is available in both the modes.
  • When you are in AP mode, and you associate your laptop with the WiFi GuruPlug, you will, by default, get an IP address from the range of 192.168.1.100 to 192.168.1.200. (Note: your uplink better not also be using 192.168.1/24 as the network...)

Guruplug as a Wireless Router

A script /root/init_setup.sh is bundled with the default root file system which does the task of setting up the GuruPlug in wireless AP mode.

If you want to set it up yourself as a router, follow the below steps

  • modprobe the wireless driver. - uap0 interface will be created as a result.

Also note that two firmware binaries - helper_sd.bin & sd8688_ap.bin need to be kept at /lib/firmware/mrvl/
These firmware binaries are bundled with the default root file system itself and they will be present at the above mentioned location.

guruplug-debian:~# modprobe uap8xxx
  • Set up the wireless paramateres.
guruplug-debian:~# ifconfig uap0 192.168.1.1 up
guruplug-debian:~# /usr/bin/uaputl sys_cfg_ssid "<SSID-you-want-to-assign>"
guruplug-debian:~# /usr/bin/uaputl bss_start
  • Set up the NATing and ip forwarding.
guruplug-debian:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
guruplug-debian:~# echo 1 > /proc/sys/net/ipv4/ip_forward
  • Start a dhcp server on uap0 interface and dnsmasq service.
guruplug-debian:~# /etc/init.d/udhcpd start
guruplug-debian:~# /etc/init.d/dnsmasq start

Once you have associated with the Guruplug AP, you can start browsing the internet (again, assuming the wired interface of the plug is connected to WAN) or resolve some outside domain like yahoo.com from client. This will verify Router Functionality.

Configuring the Wireless AP parameters of Guruplug

  • Let us have a look at a bunch of standard configuration operations that you can do in order to setup the Guruplug-wireless-AP as-per your desired configuration.
  • A userspace utility - /usr/bin/uaputl is bundled with file system which is to be used for issuing commands to the wireless driver for setting up AP parameters.
  • Run /usr/bin/uaputl --help to have a look at all the available options.

Viewing the current Wireless Configuration

guruplug-debian:~# uaputl sys_config

Getting a list of connected clients

guruplug-debian:~# uaputl sta_list
  • NOTE - Before configuring any wireless parameter, you need to first stop the bss broadcasting using '/usr/bin/uaputl bss_stop'
    and after the configuration, restart the bss broadcasting by doing '/usr/bin/uaputl bss_start'

Changing the SSID

guruplug-debian:~# uaputl bss_stop                      # Stop the BSS
BSS stopped!
guruplug-debian:~# uaputl sys_cfg_ssid                  # Display current SSID
SSID = GuruPlug-300b
guruplug-debian:~# uaputl sys_cfg_ssid "GuruPlug-My-AP" # Change the SSID
SSID setting successful
guruplug-debian:~# uaputl bss_start                     # Start the BSS
BSS started!
  • uaputl followed by only the parameter name does a 'GET' on the current value of the parameter.
  • uaputl <paramater-name> <value> does a 'SET' of the specified value on the specified parameter.
  • uaputl <parameter-name> --help will display the help related to setting the particular parameter.

Changing the Security Mode

  • We will have a look at the steps that need to be followed in order to set

Wireless Security -> WPA2
Passphrase -> 12345678
Cipher Type -> AES CCMP

guruplug-debian:~# uaputl bss_stop           # Stop BSS
BSS stopped!
guruplug-debian:~# uaputl sys_cfg_protocol   # Display current security protocol
PROTOCOL = No security
KeyMgmt = PSK
guruplug-debian:~# uaputl sys_cfg_protocol --help  # Lets find out the value required for WPA2

Usage : sys_cfg_protocol [PROTOCOL]

Options: PROTOCOL:              1 - No RSN
                                2 - WEP Static
                                8 - WPA
                                32 - WPA2
                                40 - WPA2 Mixed
                                empty - Get current protocol
guruplug-debian:~# uaputl sys_cfg_protocol 32    # Set protocol to WPA2
protocol setting successful

guruplug-debian:~# uaputl sys_cfg_wpa_passphrase
WPA passphrase: None
guruplug-debian:~# uaputl sys_cfg_wpa_passphrase "12345678"   # Setting passphrase.
WPA passphrase setting successful

guruplug-debian:~# uaputl sys_cfg_cipher
PairwiseCipher =  None
GroupCipher = None
guruplug-debian:~# uaputl sys_cfg_cipher --help

Usage : sys_cfg_cipher [PAIRWISE_CIPHER GROUP_CIPHER]

Options: PAIRWISE_CIPHER:  0 - NONE
                           4 - TKIP
                           8 - AES CCMP
                           12 - AES CCMP + TKIP
         GROUP_CIPHER :    0 - NONE
                           4 - TKIP
                           8 - AES CCMP
         empty - Get current cipher settings
guruplug-debian:~# uaputl sys_cfg_cipher 8 8       # Set the Cipher
cipher setting successful

guruplug-debian:~# uaputl bss_start    # Now start the BSS
BSS started!

Setting the Channel

guruplug-debian:~# uaputl bss_stop
BSS stopped!
guruplug-debian:~# uaputl sys_cfg_channel    # Display the current channel
Mode    = Manual
Channel = 4
guruplug-debian:~# uaputl sys_cfg_channel 5  # Set the channel to 5
Channel setting successful
guruplug-debian:~# uaputl bss_start
BSS started!

Setting to Automatic Channel

guruplug-debian:~# uaputl bss_stop
BSS stopped!
guruplug-debian:~# uaputl sys_cfg_channel 0 1
Channel setting successful
guruplug-debian:~# uaputl sys_cfg_channel
Mode    = ACS
Channel = 0
guruplug-debian:~# uaputl bss_start
BSS started!

Verifying the Router Functionality

  • Once you are done with configuring the Wireless AP parameters as per your requirements, next step is to verify if the router functionality works or not.
  • Associate your laptop with the GuruPlug AP.
  • Once associated, open up browser and confirm if internet is accessible.
  • Alternatively, you can ssh into the GuruPlug with default credentials 'root' and 'nosoup4u' and check if DNS resolution works, maybe by executing a simple wget command like -
# wget google.com

uaputl source code

Originally released there:

http://plugcomputer.org/plugforum/index.php?topic=2196.msg13114#msg13114

Media:Uapevent.tar.gz

Media:Uaputl.tar.gz

Personal tools