Client mode(station mode) for VoCore

Test the two bug boards is so boring… No good news. After that I decide to test some new feature: client mode.

It is easy to setup OpenWrt to client mode. It connected to my home router VongerWifi.

We need to change two files.

One is /etc/config/wireless:

config wifi-device 'radio0'
        option type 'mac80211'
        option channel 'auto'
        option hwmode '11ng'
        option path '10180000.wmac'
        list ht_capab 'GF'
        list ht_capab 'SHORT-GI-20'
        list ht_capab 'SHORT-GI-40'
        list ht_capab 'RX-STBC1'
        option htmode 'HT20'

config wifi-iface
        option device 'radio0'
        option network 'wwan'
        option mode 'sta'
        option ssid 'VongerWifi'
        option encryption 'psk2'
        option key 'passwordforwifi'

add two line after /etc/config/network to enable get ip address from your home router.

config interface wwan
        option proto 'dhcp'

restart network by this script.

/etc/init.d/network restart
wifi up

Now the board shows this:

[  555.840000] wlan0: deauthenticating from 0c:82:68:24:84:86 by local choice (reason=3)
[  556.740000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  558.510000] wlan0: authenticate with 0c:82:68:24:84:86
[  558.550000] wlan0: send auth to 0c:82:68:24:84:86 (try 1/3)
[  558.560000] wlan0: authenticated
[  558.580000] wlan0: associate with 0c:82:68:24:84:86 (try 1/3)
[  558.590000] wlan0: RX AssocResp from 0c:82:68:24:84:86 (capab=0x431 status=0 aid=4)
[  558.610000] wlan0: associated
[  558.610000] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

The client mode is working now.

root@OpenWrt:/etc/config# ping -c5 vonger.cn
PING vonger.cn (209.148.85.252): 56 data bytes
64 bytes from 209.148.85.252: seq=0 ttl=46 time=347.934 ms
64 bytes from 209.148.85.252: seq=1 ttl=46 time=347.951 ms
64 bytes from 209.148.85.252: seq=2 ttl=46 time=352.602 ms
64 bytes from 209.148.85.252: seq=3 ttl=46 time=259.923 ms
64 bytes from 209.148.85.252: seq=4 ttl=46 time=269.081 ms
--- vonger.cn ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 259.923/315.498/352.602 ms

Addition:

I find I can not ping from my board to my computer, and my computer can not ping board. That is not firewall problem. I find that is route problem.

root@OpenWrt:/etc/config# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         OpenWrt.lan     0.0.0.0         UG    0      0        0 wlan0
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0

There should be a default gateway to 192.168.1.1 which is my router.

route add 192.168.1.0 gw 192.168.1.1

After this, it still does not work.
use ifconfig, I find the problem, br-lan already take 192.168.1.1. Just turn off it.

ifconfig br-lan down

Now, my computer is able to ping the VoCore board and VoCore board is able to ping the computer. Everything works great.