Openwrt подключить usb wifi
Полдня просидел (хотя это у меня такая форма отдыха) чтобы прикрутить wi-fi свисток в cyber wrt . Надо запустить как «клиент wi-fi» . Много нового узнал по возврату cyber wrt в первоначальную конфигурацию, однако свистки так и не заработали.
Один из них Dlink DWA-125 , другой неизвестный науки зверь (хотя это зверь без проблем определялся ранее в Rassberri PI)
Где хоть почитать по теме?
Вот тикет по вашему адаптеру https://dev.openwrt.org/ticket/10074, проблема там не решена, но написано какие нужно модули устанавливать.
А так, для общего развития, можно поинтересоваться:
1. Во что свисток втыкается?
2. вывод lsmod с воткнутым свистком
3. И две команды подряд (wi-fi может потерятся весь, поэтому лучше подключится кабелем)
mv /etc/config/wireless /etc/config/wireless.old wifi detect
Пробовал на Openwrt х86 завести DWA-140, DWA-131, TEW-664UB, TEW-684UB. Не помню точно на каких, но удалось только поднять интерсейс wlan0, не получилось ни с режимом клиентом ни с ТД. Протокола WPA нет, ток WEP и с подключением тоже ботва, вроде подключается, но ассоциации нет, бросил это дело.
Протокола WPA нет, ток WEP и с подключением тоже ботва, вроде подключается, но ассоциации нет, бросил это дело.
Ок, действительно не хватало wpad, по умолчание на Openwrt х86 не был включен. Теперь DWA-140 rev В2 режим AP и client — нормально (300Мб), TEW-664UB ( 2х диапозонный) режим AP — вечное подсоединение (пробовал разные настройки, подключался с разным устройств), client — нормально, надо вообще-то тестить сразу после перепрошивки, на чистую. TEW-684UB (RT3573) — 2х диапозонный, тоже непонятки.
Стоят сейчас Wireless Drivers
kmod-rt2800-usb kmod-net-rtl8192su kmod-rt73-usb
P.S. Все отлично на TEW-664UB на 2.4 и 5.0 Gz в режиме AP работает (только что-то одно), надо было просто перед испытанием нового свистка перепрошиваться, точнее на Openwrt х86 слить дамп на флешку
#opkg update #opkg install wpad
Use RNDIS USB Dongle for WAN connection
RNDIS (Remote Network Driver Interface Specification) is ethernet over USB protocol used by some fast speed USB modems/dongles.
It is also used by many USB3.0-GigabitEthernet-Adapter like the TP-Link UE300 and all chinese low-cost ones I bought on ebay. It is one of the ways these gigabit ethernet dongles use to be “plug and play” or “driverless”, by conforming to RNDIS standard so they don’t need a special driver just for themselves. These dongles lack any kind of interface or settings, they are just usb-to-ethernet adapters, nothing more.
For more more information about different protocols used:
Setting up RNDIS-based dongles
(This section is based on experience with Bleeding Edge r47548 from December of 2015 on a wt3020 and connecting to an Alcatel Onetouch L850.).
For rndis devices, only a limited subset of packages are necessary (besides the base USB packages, that are most likely already contained in the base image):
opkg update opkg install kmod-usb-net-rndis usb-modeswitch
kmod-usb-net-rndis will also install kmod-mii, kmod-usb-net, kmod-usb-net-cdc-ether and kmod-usb-net-rndis as dependencies.
After installing the packages and connecting the USB stick, the following should appear in dmesg:
[ 847.390000] usb 1-1: new high-speed USB device number 3 using ehci-platform [ 847.590000] usb 1-1: no of_node; not parsing pinctrl DT [ 847.610000] rndis_host 1-1:1.0: no of_node; not parsing pinctrl DT [ 847.620000] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-101c0000.ehci-1, RNDIS device, 72:4d:eb:bb:e2:60
You can verify the interface details on the new usb0 network interface by running ifconfig usb0 .
If the USB stick will be your only WAN connection, then the easiest way to set up the automatic connection is to change /etc/config/network to be something like:
config interface 'wan' option ifname 'usb0' option proto 'dhcp'
(you need to reboot or restart the network subsystem with /etc/init.d/network restart afterwards)
Since RNDIS-based sticks create their own NATted IP subnet, it is important that OpenWRT’s local IP range is different from the 4G stick’s IP range. In the case of the Alcatel L850, the default range is 192.168.1.1, which clashes with OpenWRT’s default. Therefore OpenWRT’s LAN IP should be changed to something else, such as:
config interface 'lan' option ipaddr '10.10.10.1'
If auto-connect is disabled, or PIN-request is enabled on the 4G stick, you may have to visit the dongle’s admin web interface (typically 192.168.1.1) to enter the PIN or initiate the 4G connection. You can do this from your PC connected to the OpenWRT wifi.
RNDIS Troubleshooting
If you only see the usb messages, but not the rndis_host messages, then modesetting may be at fault.
Checking /sys/kernel/debug/usb/devices , the device should look like this:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bbb ProdID=0195 Rev= 2.28 S: Manufacturer=Alcatel S: Product=MobileBroadBand S: SerialNumber=0123456789ABCDEF C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03 I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=125us E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bbb ProdID=f000 Rev= 2.28 S: Manufacturer=Alcatel S: Product=MobileBroadBand S: SerialNumber=0123456789ABCDEF C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
(note the number of interfaces “#Ifs=” and the “ProdID=”)
RNDIS Security Note
Leaving your RNDIS-based dongle admin web interface available to LAN users might not be something you would like to do, as there is usually no authentication mechanism there. To protect it, you can add the following rule to Network→Firewall→Custom Rules:
iptables -A forwarding_lan_rule -d 192.168.1.0/24 -m comment --comment "no access to USB dongle from LAN" -j DROP
Now, if you need to access your dongle web interface, log in to your OpenWRT box with:
ssh -L 8080:192.168.1.1:80 root@your-openwrt-ip
and point your browser to http://localhost:8080.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website. OK More information about cookies
Self-registration in the wiki has been disabled.
If you want to contribute to the OpenWrt wiki, please post HERE in the forum or ask on IRC for access.
Except where otherwise noted, content on this wiki is licensed under the following license:
CC Attribution-Share Alike 4.0 International
OpenWRT and WLAN-USB-Sticks (Updated with an example)
Recently one of my blog’s visitors (Michael) asked me, if it was possible to extend his router with an additional USB-Wifi device. The short answer is: yes.
I’ll give you an example of a tested configuration below. If you are planning to use different parts, please check the caveats here and be sure to get chipsets, that are known to work.
- TP-Link TL-WR1043NDv2
- CSL 300 Mbit Dual Band WLAN USB Stick from Amazon (they sell it as a raspberry pi extension). Yes, you can regulate power and even replace antennas. It seems to be fully capable of DFS and TPC out of the box.
- an USB stand
Plug the stick in the USB stand and connect the cable to your TL-WR1043NDv2’s USB port. lsusb should show:
Bus 001 Device 002: ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter
If you now look into your LuCI-Webinterface, you won’t see a difference in “Network”, “Wireless”, why? Short answer: your /etc/config/wireless configuration file does not know about your new wifi interface. Do …
cd /etc/config
mv ./wireless ./wireless.bak
wifi detect >> ./wireless
cat wireless.bak >> ./wireless
You’ll create a new wifi interface configuration that way and append the existing configuration to it.
You should now edit /etc/config/wireless and remove duplicate lines/duplicate (dummy) blocks for your existing radio0 (thats d-d for deletion of single lines. Save and exit (ESC:x).
Login to LuCI, go to “Administration”, “Network”, “Wireless” and configure your new radio accordingly.
If you like, you can add “option antenna_gain 5” to your radio1 config in /etc/config/wireless. That way transmit power can never exceed regdomain limits. (E.g. 28db shown by iw list minus antenna gain (dBi) 5 is 23. That’s 200 milliwatt EIRP.
Some Realtek adapters may not be that easy to configure, especially when they need device firmware to be uploaded, but it can probably be done, as long as your Router has enough flash for a bunch of drivers and firmware.
- Do research on whether the dongle is supported by linux in general.
- does it need additional (FullMac) firmware? Yes: could be a problem. No, continue.
- Support for ndiswrapper only … forget about it…
- If the stick’s original antenna is detachable, you therefore must not use it in combination with a replacement antenna of higher gain. (Usually OEM antennas have a relational gain of 2dB to 5 dB).
- Example: “High gain” usb stick has a fixed txpower of 15dB(dBm) and is packaged with a 5dBi omnidirectional antenna. The resulting transmission power will be 20dB (dBm), which is perfectly legal (EIRP must not exceed 20dB in Europe within 2.4 GHz; for 5GHz higher values apply, but these depend on additional factor, which are beyond the scope of this post).
If e.g. you have a router running OpenWRT, and that router is equipped with an USB port, you may connect your dongle to the router.
- Run the command lsusb. It will tell you, the manufacturer and device id in hexadecimal format.
- Use Google or any other websearch for this term. You may narrow the search by adding ‘openwrt’, ‘linux’, ‘linux driver’ and so on.
- The search hopefully will tell you, whether the dongle is supported by your version of OpenWRT and tell you more about the steps to take.