Openwrt настройка wifi клиента

Connect to client Wi-Fi network

This page will explain how to connect your OpenWrt device to another Wi-Fi network by using its own radio. Due to technical limitations, your OpenWrt device will create its own subnet (in the example below it’s 192.168.2.x while the Wi-Fi router’s subnet is 192.168.1.x ) just as it would when connected to a modem, your OpenWrt device and devices connected to it will be able to reach the Internet, but won’t see devices connected to the other Wi-Fi/router).

If you want to actually set up a Wi-Fi repeater or keep devices connected to this device in the same subnet as the devices connected to the other router, you will need to follow this tutorial instead.

Web interface instructions

Refreshed with 21.02 LuCI images.

As said above, the LAN interface must be set in a different subnet than the Wi-Fi network you are connecting to. In our example the Wi-Fi network we are connecting to is using 192.168.1.x addresses, so we will need to change the IP address of the LAN interface first to 192.168.2.1

The LAN interface must be set in a different subnet than the Wi-Fi network you are connecting to.

We will now set up the client Wi-Fi network, the configuration needed to connect to another Wi-Fi network.

Once you are logged into the router,

Recommend to tick the ‘Replace wireless configuration’ to delete the wireless access point (Master) for the chosen radio.

If there is no *wan* firewall zone you need to create it, don’t save the Wi-Fi configuration. Go to bottom of this section describing how to create *wan* firewall zone.

Enter the Wi-Fi password, leave the “name of new network” as “wwan” and select wan firewall zone.

You will land in the client Wi-Fi settings page. Edit as required.
The most important settings are on the Operating Frequency line.

Set the Mode to Legacy if you are connecting to a Wi-Fi g network, or N if you are connecting to a Wi-Fi n (and so on).

Set the Width to the same value that you set on the Wi-Fi you are connecting to (to avoid bottlenecking the connection for no reason).

Press Save
Press Save & Apply.
Configuration is now complete.

This is the final result. Note how the client network has a ? instead of a IP address.
The wwan IP address is only visible in the Network Interfaces page.

Читайте также:  Usb wifi телефон компьютер

This step should not be necessary if you had reset the router to OpenWrt defaults. If you have no “wan” firewall zone you must create it.

Click on Network and then on Firewall, then click on the Add button, and set up the new zone as you see in the following screenshot (which is a default wan firewall interface),

After you have done this, go back and repeat the other steps to add and save the Wi-Fi connection.

Command-line instructions

Before doing any actual configuration, the Wi-Fi interface must be enabled in order to be able to scan for networks in the vicinity:

uci set wireless.@wifi-device[0].disabled="0" uci commit wireless wifi

if you have more than one Wi-Fi radio in your device, then you can use the others in this tutorial instead by substituting their number. For example to enable the second Wi-Fi radio (usually a 5Ghz radio) you would need to uci set wireless.@wifi-device[1].disabled=0 and then use wlan1 instead of wlan0 in the command below.

Now we can list networks in range substituting your actual wireless interface for wlan0 :

# iw dev wlan0 scan BSS c8:d5:fe:c8:61:b0(on wlan0) -- associated TSF: 24324848870 usec (0d, 06:45:24) freq: 2412 beacon interval: 100 TUs capability: ESS (0x0411) signal: -72.00 dBm last seen: 140 ms ago Information elements from Probe Response frame: SSID: Violetta RSN: * Version: 1 * Group cipher: CCMP * Pairwise ciphers: CCMP * Authentication suites: PSK * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000) BSS f8:35:dd:eb:20:f8(on wlan0) TSF: 24225790925 usec (0d, 06:43:45) freq: 2457 beacon interval: 100 TUs capability: ESS (0x0431) signal: -90.00 dBm last seen: 1450 ms ago Information elements from Probe Response frame: SSID: GOinternet_EB20FB HT capabilities: Capabilities: 0x11ee HT20/HT40 SM Power Save disabled RX HT20 SGI RX HT40 SGI TX STBC RX STBC 1-stream Max AMSDU length: 3839 bytes DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 4 usec (0x05) HT RX MCS rate indexes supported: 0-15, 32 HT TX MCS rate indexes are undefined HT operation: * primary channel: 10 * secondary channel offset: below * STA channel width: any RSN: * Version: 1 * Group cipher: TKIP * Pairwise ciphers: TKIP CCMP * Authentication suites: PSK * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)

In the example, there are two networks, a Wi-Fi g one called Violetta and a Wi-Fi n one called GOinternet_EB20FB. The device was configured to connect to the one called Violetta.

These are the uci values that were added or changed by the configuration procedure.
For SSID, BSSID, and encryption you must use the info you got from the Wi-Fi scan above.
For an explanation of why these values were changed, please read the luci tutorial above.

network.lan.ipaddr='192.168.2.1' network.wwan=interface network.wwan.proto='dhcp' firewall.@zone[1]=zone firewall.@zone[1].name='wwan' firewall.@zone[1].input='REJECT' firewall.@zone[1].output='ACCEPT' firewall.@zone[1].forward='REJECT' firewall.@zone[1].masq='1' firewall.@zone[1].mtu_fix='1' firewall.@zone[1].network='wwan' wireless.@wifi-iface[1]=wifi-iface wireless.@wifi-iface[1].network='wwan' wireless.@wifi-iface[1].ssid='Violetta' wireless.@wifi-iface[1].encryption='psk2' wireless.@wifi-iface[1].device='radio0' wireless.@wifi-iface[1].mode='sta' wireless.@wifi-iface[1].bssid='C8:D5:FE:C8:61:B0' wireless.@wifi-iface[1].key='myWifiPasswordHere'

Known Issues

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 настройка wifi клиента

Для работы с wifi в openWrt существует скрипт /sbin/wifi. Файл /etc/config/wireless отвечает за конфигурацию wifi.

Создать конфигурационный файл по умолчанию можно, выполнив:

wifi detect > /etc/config/wireless

Он примерно будет иметь следующий вид:

config wifi-device radio0 option type mac80211 option channel 11 option hwmode 11g option path 'pci0000:00/0000:00:1c.2/0000:05:00.0' # REMOVE THIS LINE TO ENABLE WIFI: option disabled 1 config wifi-iface option device radio0 option network lan option mode ap option ssid OpenWrt option encryption none

Изменяем его под свою конфигурацию.
Файл /etc/config/wireless для открытой сети:

config wifi-device radio0 option type mac80211 option channel 'auto' option hwmode 11g option path 'pci0000:00/0000:00:1c.2/0000:05:00.0' option disabled 0 config wifi-iface option device radio0 option network wwan option mode sta option ssid testwifi option encryption none

Файл /etc/config/wireless для шифрованой сети:

config wifi-device 'radio0' option type 'mac80211' option channel '6' option hwmode '11ng' option path 'pci0000:00/0000:00:1c.2/0000:05:00.0' option disabled '0' config wifi-iface option device 'radio0' option network 'wwan' option mode 'sta' option ssid 'testwifi' option encryption 'psk2' option key '1234567890'

sta — режим клиента; ap — режим точки доступа

Для автоматического получения адреса по dhcp в файле /etc/config/network необходимо создать интерфейс:

config interface wwan option proto 'dhcp'

Выполнить для применения новых настроек:

На этапе конфигурации openWrt нужно отметить wpa-supplicant, иначе wifi не будет подниматься скриптом openWrt /sbin/wifi:

Выполнение «wifi down» приводит к отключению wifi и пропаданию интерфейса wlan0.

Читайте также:  Всем вай фай зона покрытия

Выполнение «wifi up» поднимает интерфейс wlan0, и происходит подключение к сети.

При успешном выполнении операции на экране будет примерно следующий лог:

wifi up Successfully initialized wpa_supplicant [ 10.975345] iwl3945 0000:05:00.0: loaded firmware version 15.32.2.9 [ 14.670591] wlan0: authenticate with bc:ae:c5:c3:ab:d5 [ 14.673644] wlan0: send auth to bc:ae:c5:c3:ab:d5 (try 1/3) [ 14.675760] wlan0: authenticated [ 14.676031] iwl3945 0000:05:00.0: wlan0: disabling HT as WMM/QoS is not supported by the AP [ 14.676335] iwl3945 0000:05:00.0: wlan0: disabling VHT as WMM/QoS is not supported by the AP [ 14.680246] wlan0: associate with bc:ae:c5:c3:ab:d5 (try 1/3) [ 14.682727] wlan0: RX AssocResp from bc:ae:c5:c3:ab:d5 (capab=0x401 status=0 aid=1) [ 14.684368] wlan0: associated

Возможно появление ошибки (при отсутствии wpa-supplicant) :

wifi up command failed: Device or resource busy (-16)

Подключиться в ручном режиме к сети можно с помощью команды:

iw dev wlan0 connect -w testwifi

Источник

Точка доступа + клиент на OpenWRT

Захотелось мне отвязать модули на ESP8266 от основного WiFi маршрутизатора. Гуру говорят, что так по феншую, сеть стабильнее, аптайм длиннее и русские хакеры не доберутся до домашней сети.

Из чулана достал старый роутер, долго стирал пыль и долго вспоминал пароль от OpenWRT. Прелесть этой прошивки в том, что она умеет на одном радиомодуле прикидываться одновременно и клиентом и точкой доступа! Клиент по WiFi подключается к основному маршрутизатору и раздает с него интернет на все ESP8266 через новую точку доступа. Вроде все легко и понятно, но есть нюансы.

Первым делом надо проверить не пересекаются ли адреса DHCP серверов основного маршрутизатора и новой точки доступа. Идем в Network -> Interfaces выбираем LAN и жмем Edit.

На основном у меня стоит 192.168.1.1 поэтому тут поменял на 192.168.2.1

Лучше сначала создать клиента. Тогда номер канала, тип шифрования будут автоматический скопированы при создании точки доступа. Идем в Network -> WiFi нажимаем копку Scan и подключаемся к основному маршрутизатору. Вводим пароль на доступ к интернету. Главное перед Save & Apply выбрать wwan.

Теперь создаем точку доступа. В том же окне Network -> WiFi нажимаем копку Add. Придумываем название и пароль новой точки доступа. Выбираем lan и жмем Save & Apply.

Если все сделать правильно, то должен появится Master (точка доступа) и Client (клиент) подключенный к основному маршрутизатору. Если связи нет — проверьте и повторите все шаги.

Все, настройка завершена. Новая точка доступа может раздавать интернет по воздуху или по кабелю через клиента подключенного к WiFi-ю маршрутизатора. Недостаток такой конфигурации — два близко расположенных мастера работающих на одном канале и мешающих друг другу. Улучшить ситуацию можно уменьшив мощность передатчика новой точки доступа до минимума. Я поставил 5mW.

Источник

Оцените статью
Adblock
detector