OpenWrt Forum Archive

Topic: USB Wifi Adapter as WAN

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello Folks!

I am a newbie to openwrt but have small linux knowledge.
On my TP-Link1043ND(1.0) i got Backfire (r24038) running.
My Plan ist to connect my Neighbours Wlan using the USB adapter. (is 500m away and knows about that)
Then the internal wifi Controler of the 1043nd has to share internet localy in my living room.

I have an RTL8187L Adabter conected to the usb port.
Whith "ifconfig wlan1 up" the device comes up as ecxpected. (used the kmod-rtl8187 2.6.32.25+2010-10-19-1 Package)
I edited the /etc/config/wireless file like that:

config 'wifi-device' 'radio0'
        option 'type' 'mac80211'
        option 'channel' '11'
        option 'macaddr' '54:e6:fc:**:**:**'
        option 'hwmode' '11ng'
        option 'htmode' 'HT20'
        list 'ht_capab' 'SHORT-GI-40'
        list 'ht_capab' 'DSSS_CCK-40'
        option 'disabled' '0'

config 'wifi-iface'
        option 'device' 'radio0'
        option 'network' 'lan'
        option 'mode' 'ap'
        option 'ssid' 'OpenWrt'
        option 'encryption' 'psk2'
        option 'key' 'd3rd1gg3'

config 'wifi-device' 'radio1'
        option 'type' 'rtl8187'
        option 'channel' '6'
        option 'macaddr' '00:C0:CA:**:**:**'

config 'wifi-iface'
        option 'device' 'radio1'
        option 'encryption' 'none'
        option 'mode' 'sta'
        option 'ssid' 'Juliane'
        option 'network' 'wan'
        option 'bssid' '00:23:08:**:**:**'

But after booting the 1043nd ist dosent connect to the acces point! (juliane)
What i am doing wrong? My Knowledgebase of these networkings are small, especially
openwrt. Since Wireless came out i allways used a "managment tool" in KDE for example.

Anyone can help me out?

Regards
derdigge

Have you tried to configure /etc/config/network then? Set wan device to wlan1 (or none). Also, set wan to dhcp. You can also do this all from the web interface. (administration > network > interface > wan).

Thanks for your reply!

I Think that the problem is the assosiacion to the accesspoint. (the one that provides the internet)
Can someone give me please an excample config for wpa and wep encryption?

Thanks!
derdigge

Run "uci export network ; iwlist wlan1 scan".

I have just setuped, and it's works, but a lot of was done via CLI.

But, I have Ralink-based usb and dir-300
 
1)Compile OpenWRT with wpa_supplicant and hostapd
2)root@OpenWrt:/etc/config# cat wireless

config 'wifi-device' 'radio0'
        option 'type' 'mac80211'
        option 'channel' '11'
        option 'macaddr' '00:90:4c:c1:00:00'
        option 'hwmode' '11g'
        option 'disabled' '0'

config 'wifi-iface'
        option 'device' 'radio0'
        option 'network' 'lan'
        option 'mode' 'ap'
        option 'ssid' 'OpenWrt'
        option 'encryption' 'none'
        option 'hidden' '0'
        option 'isolate' '0'
        option 'bgscan' '0'
        option 'wds' '0'
        option 'macfilter' 'none'

config 'wifi-device' 'radio1'
        option 'type' 'mac80211'
        option 'macaddr' '1c:af:f7:6d:03:4f'
        option 'htmode' 'HT20'
        list 'ht_capab' 'GF'
        list 'ht_capab' 'SHORT-GI-20'
        list 'ht_capab' 'SHORT-GI-40'
        list 'ht_capab' 'RX-STBC1'
        option 'disabled' '0'
        option 'hwmode' '11ng'
        option 'channel' '06'

config 'wifi-iface'
        option 'device' 'radio1'
        option 'hidden' '0'
        option 'network' 'wan'
        option 'wds' '0'
        option 'macfilter' 'none'
        option "mode" "sta"

3) create wpa_supplicant start_up script :
a)cd /etc/init.d/
b) create file with folling content root@OpenWrt:/etc/init.d# cat peapclient
#!/bin/sh /etc/rc.common
#wpa_supplicant
START=99

start() {

echo start

# commands to launch application

wpa_supplicant -B -P /var/run/wifi-wlan1.pid -Dnl80211 -i wlan1 -c /etc/config/peap.conf

sleep 15

#udhcpc -i eth0.1

}

c) ./peapclient enable
3) create wpa_supplicant configuration file


reboot and enjoy smile

PS:
BTW: where did you find "option 'type' 'rtl8187'" ?  I am trying to setup rtl8712, but didn't succeed sad

UPD: I have just tested with rtl8187L -- it also works fine smile

(Last edited by NewUse on 27 Jun 2011, 10:59)

fyi wrote:

Run "uci export network ; iwlist wlan1 scan".

Networks arround are listed as ecxpected

Hi Again!

I have no Radio 1 by installing the driver by default.
When i install the driver Log File returns:

Jun 27 11:23:47 OpenWrt user.debug kernel: ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
Jun 27 11:23:47 OpenWrt user.info kernel: ieee80211 phy1: hwaddr 00:c0:ca:27:20:6c, RTL8187vB (default) V1 + rtl8225z2, rfkill mask 2
Jun 27 11:23:47 OpenWrt user.info kernel: rtl8187: Customer ID is 0xFF
Jun 27 11:23:47 OpenWrt user.info kernel: Registered led device: rtl8187-phy1::radio
Jun 27 11:23:47 OpenWrt user.info kernel: Registered led device: rtl8187-phy1::tx
Jun 27 11:23:47 OpenWrt user.info kernel: Registered led device: rtl8187-phy1::rx
Jun 27 11:23:48 OpenWrt user.info kernel: rtl8187: wireless switch is on
Jun 27 11:23:48 OpenWrt user.info kernel: usbcore: registered new interface driver rtl8187

Sounds all fine for me. but there is no radio1 by default. (luci)
I can do ifconfig wlan1 up and it wents up, still no device in luci.

When the rooter reboots, Logfile returns:

Nov 19 19:28:05 OpenWrt user.info kernel: usbcore: registered new interface driver rtl8187

But it isnt up at startup.

There must be some think in openwrt mechanics that has to bring up devices and write the /etc/config/wireless. I think there is my Problem arround.

If this will work i think it will be easy to config the conection point for rtl8187 device using luci.

@NewUse ist the "radio1" up by default as you tried ther Kmod_rtl8187 package?

Thanks!

So i thnink it is nearly done !

since Openwrt is not able to start the device on its own during startup of the router, i
edited /etc/rc.local like this:

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

ifconfig wlan1 up
iwconfig wlan1 mode managed key 000764494687520061987972AA
iwconfig wlan1 essid "Juliane"
udhcpc -i wlan1

exit 0


Everything went fine so far. i can ping google.com inside the ssh terminal.
so the router itself is online. What static route i have to add that the client conected to the router are "online" ?
' route add -p ' as i know from debian does not work at all!

Thank you!

Everything went fine so far. i can ping google.com inside the ssh terminal.
so the router itself is online. What static route i have to add that the client conected to the router are "online" ?

If I have understand correctly (my English is real awful), you should enable nat from wan to lan, routing should not help...

If you'll made changes in /etc/config/wireless manually, by adding something like this:
config 'wifi-device' 'radio1'
        option 'type' 'mac80211'
        option 'macaddr' '00:c0:ca:27:20:6c'
        option 'disabled' '0'
        option 'hwmode' '11g'
        option 'channel' '06'

config 'wifi-iface'
        option 'device' 'radio1'
        option 'hidden' '0'
        option 'network' 'wan'
        option 'wds' '0'
        option 'macfilter' 'none'
        option "mode" "sta"

it should help
Yours mac address I have copied from yours kernel log...

I have first add the minimal configuration, and all other parameters were add automaticly

BTW: any one know: should this rtl8187 driver works in ap mode?

Hi man!

You Simply did it!
Ganz, gro├čes Tennis!!!
Now is saw my mistake! I allways used "option 'type' 'rtl8187'" instead of "option 'type' 'mac80211'"
TX Power is now limited to 20 but that is enough for me. maybe others need it increased.


This config added to /etc/config/wireless using editor joe was the solution for me!!!

config 'wifi-device' 'radio1'
        option 'type' 'mac80211'
        option 'macaddr' '00:c0:ca:27:20:6c'
        option 'disabled' '0'
        option 'hwmode' '11g'
        option 'channel' '06'

config 'wifi-iface'
        option 'device' 'radio1'
        option 'hidden' '0'
        option 'network' 'wan'
        option 'wds' '0'
        option 'macfilter' 'none'
        option "mode" "sta"

EDIT:

Txpower:

If you add "     option 'country' 'ca' "
you can set txpower up to 27 (gaves me a quality boost. ping loss in one hour 1%)

AP Mode:

I tried Mastermode.
It works wit my ALFA Awus036h (500mw) flawlwssly with 54mbits amd wpa security. (tried 30mins - seems stable)

Also i tried my ALFA Awus036h (1000mw) its the same chipset but it dosent work. Apmode dosent work, client mode not verry stable.

(Last edited by derdigge on 28 Jun 2011, 13:38)

Hi to all!
Also trying to make above, but don't know where the beginning of such a long story smile
Maybe some step by step manual is available for setting up the router?

I managed to install and configure my ALFA Awus036h (1000mw) on a Fonera 2.0n (thanks to the latest trunk). Everything works but I can't select more thano 20db - 100mW.
Do you know if it is possible to change up to 30db?

The discussion might have continued from here.