Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:network:wifi:wifiextenders:ap_sta [2024/08/09 12:57] – Link to instructions at bottom richb-hanoverdocs:guide-user:network:wifi:wifiextenders:ap_sta [2024/08/12 18:12] – Editorial tweaks to the backup/configuration page richb-hanover
Line 1: Line 1:
-======  Wi-Fi Extender/Repeater with STA (client) link to upstream AP (Hotspot)  ====== +======  Wi-Fi Repeater using AP+STA mode====== 
-AP+STA mode (sometimes referred to as "wi-fi tethering") allows an OpenWrt router to make wireless uplink to another hotspot ("access point" or AP). It then repeats data from the uplink to other devices connected to the OpenWrt device wirelessly or on its Ethernet interface.+//THIS DOCUMENT IS IN FLUX FOR THE NEXT FEW DAYS. Although I believe it is correct, none of this has been tested. If you need to configure repeater, check one of the earlier versions of this pagerichb-hanover; 9Aug2024//
  
-AP+STA mode is by far the simplest means of extending Wi-Fi coverage. //**It does not require any changes to the upstream access point.**//\\+Wi-Fi Repeater is a configuration of an OpenWrt router that "extends" 
 +the network.
  
-===== Manual configuration ===== +An OpenWrt router operating in AP+STA mode 
-This procedure assumes that your OpenWrt device has the default settings and that the AP and Ethernet port are bridged. +(sometimes referred to as "wi-fi tethering") does this 
-This makes changes to these configuration files: +by making a wireless uplink to a hotspot (an access point or "AP"
-  * [[docs:guide-user:base-system:basic-networking|/etc/config/network]] +and then repeating to other devices connected 
-  [[docs:guide-user:network:wifi:basic|/etc/config/wireless]] +wirelessly or to its Ethernet interface. 
-  [[docs:guide-user:firewall:firewall_configuration|/etc/config/firewall]] + 
-  [[docs:guide-user:base-system:dhcp|/etc/config/dhcp]]+AP+STA mode is by far the simplest means of extending Wi-Fi coverage because it does not require any changes to the upstream access point.  
 + 
 +**Terminology:** this page refers to 
 +the upstream access point (AP) as the **hotspot**; 
 +the OpenWrt Wi-Fi repeater/extender as the **router**; 
 +STA refers to the fact that the router connects to the hotspot as a "station" (a regular Wi-Fi device). 
 + 
 +===== Make Backups ===== 
 +The procedure below updates the updates the following files 
 +to configure your router to act as a Wi-Fi repeater/extender. 
 +It assumes that your router has the default settings and that its wireless and Ethernet are bridged. 
 +([[docs:guide-user:base-system:basic-networking|/etc/config/network]], 
 +[[docs:guide-user:network:wifi:basic|/etc/config/wireless]], 
 +[[docs:guide-user:firewall:firewall_configuration|/etc/config/firewall]], and 
 +[[docs:guide-user:base-system:dhcp|/etc/config/dhcp]]) 
 + 
 + 
 +Before you begin, it's always wise to make backups of all your configuration files. 
 +<code> 
 +# Back up the configuration files 
 +echo 'Backing up configuration files' 
 +cp /etc/config/network  /etc/config/network.bak 
 +cp /etc/config/wireless /etc/config/wireless.bak 
 +cp /etc/config/firewall /etc/config/firewall.bak 
 +cp /etc/config/dhcp     /etc/config/dhcp.bak 
 +</code> 
 + 
 +===== Configuring the Wi-Fi Repeater ===== 
 +Use the script below to change the configuration. It performs these tasks: 
 + 
 +  * Configure the router's LAN interface to 192.168.2.1 (default) Assume LAN subnet mask is 255.255.255.0 
 +  * Create a WWAN interface to get a DHCP from the hotspot 
 +  * Add the WWAN interface to the "wan" firewall zone 
 +  * Configure WWAN interface to use 'radio0' in STA mode 
 +  * Set the Wi-Fi credentials so the router can connect to the hotspot 
 + 
 +To use the script, edit the IP address and the Wi-Fi credentials at the top of the file, then [[:docs:guide-user:network:wifi:wifiextenders:ap_sta#how_to_run_these_scripts|run the script.]]
  
-The script below makes changes to all the configuration files. You should change parameters (the IP address and the Wi-Fi credentials) at the top of the file, then [[:docs:guide-user:network:wifi:wifiextenders:ap_sta#how-to-run-these-scripts|run the script.]] 
 <code bash> <code bash>
 # Fill in these values, then run the script # Fill in these values, then run the script
Line 20: Line 56:
 HOTSPOT_PASSWORD='super-secret-password' HOTSPOT_PASSWORD='super-secret-password'
  
-First, back up the configuration files +Set the router's LAN IP address to a different subnet from the hotspot (AP) IP address
-cp /etc/config/network  /etc/config/network.bak +echo 'Setting the LAN IP address to $ROUTER_LAN_IP' 
-cp /etc/config/wireless /etc/config/wireless.bak +uci set network.lan.ipaddr=$ROUTER_LAN_IP
-cp /etc/config/firewall /etc/config/firewall.bak +
-cp /etc/config/dhcp     /etc/config/dhcp.bak+
  
 # Add the WWAN network is in the WAN firewall zone # Add the WWAN network is in the WAN firewall zone
 +echo 'Setting firewall zone for "wwan"'
 uci add_list firewall.@zone[1].network="wwan" uci add_list firewall.@zone[1].network="wwan"
 uci commit firewall uci commit firewall
 /etc/init.d/firewall restart /etc/init.d/firewall restart
  
-# Set the router's LAN IP address to a different subnet from the hotspot (AP) IP address. +# The WWAN interface is the "uplink". It obtains a DHCP address from the upstream hotspot. 
-uci set network.lan.ipaddr=$ROUTER_LAN_IP +echo 'Configuring WWAN'
-# The WWAN interface is the "uplink". It obtains a DHCP address from the upstream AP.+
 uci set network.wwan="interface" uci set network.wwan="interface"
 uci set network.wwan.proto="dhcp" uci set network.wwan.proto="dhcp"
Line 41: Line 75:
 # Add the Wi-Fi interface for the uplink. # Add the Wi-Fi interface for the uplink.
 # STA mode, with the proper Wi-Fi credentials (SSID, encryption mode, key) # STA mode, with the proper Wi-Fi credentials (SSID, encryption mode, key)
 +echo 'Configuring the Wi-Fi uplink'
 uci set wireless.wwan="wifi-iface" uci set wireless.wwan="wifi-iface"
 uci set wireless.wwan.device="radio0" uci set wireless.wwan.device="radio0"
Line 53: Line 88:
 </code> </code>
  
-:!: An alternative **event-driven** recovery solution is to be found [[https://forum.openwrt.org/viewtopic.php?pid=309131#p309131|here]]. +==== Revert to AP-Only mode (Optional) ==== 
- +//This is an optional, but recommended step.//\\ 
-==== 3. Revert to AP-Only mode (Optional) ==== +When the upstream hotspot is not available or if the wireless configuration file (created above) is incorrect, the router disables its own AP. 
-When the upstream hotspot/AP is not available or if the wireless configuration file (created above) is incorrect, OpenWrt disables its own AP. +If that happens, you would lose wireless access to your router, and could only connect through its Ethernet port.
-If that happens, you would lose wireless access to your OpenWrt device, and could only connect through its Ethernet port.+
 The following step installs a script that tests for hotspot availability after boot. The following step installs a script that tests for hotspot availability after boot.
-If the router cannot connect to the hotspot after 30 seconds, it automatically reconfigures itself to AP Only mode+If the router cannot connect to the hotspot after 30 seconds, it automatically reconfigures itself to AP Only mode so you an again access the router wirelessly.
-You will then be able to access your OpenWrt device again wirelessly+
-Although this step is optional, it is recommended.+
  
 <code bash> <code bash>
Line 108: Line 140:
 </code> </code>
  
-==== 4. wwanHotspot: maintain always up a dual wifi config, Access Point and HotSpot client ====+:!: An alternative **event-driven** recovery solution is to be found [[https://forum.openwrt.org/viewtopic.php?pid=309131#p309131|here]]. 
 + 
 +==== wwanHotspot: maintain always up a dual wifi config, Access Point and HotSpot client (Optional) ====
 In one location there may be several Hotspots that may be available or not according to the comings and goings of their owners; we will enter the parameters of each one of them in the configuration file therefore wwanHotspot will connect and disconnect the OpenWrt HotSpot client to one of them as they become available. In one location there may be several Hotspots that may be available or not according to the comings and goings of their owners; we will enter the parameters of each one of them in the configuration file therefore wwanHotspot will connect and disconnect the OpenWrt HotSpot client to one of them as they become available.
  
Line 114: Line 148:
 Download the latest version of [[https://github.com/jordi-pujol/wwanHotspot/|wwanHotspot]] and follow the instructions. Download the latest version of [[https://github.com/jordi-pujol/wwanHotspot/|wwanHotspot]] and follow the instructions.
  
-==== 5. Disable DNS rebind protection ====+==== Disable DNS rebind protection (Optional) ====
 Disable DNS rebind protection if you need to trust upstream resolvers. Disable DNS rebind protection if you need to trust upstream resolvers.
  
Line 123: Line 157:
 </code> </code>
  
-==== 6. How to run these scripts ====+==== How to run these scripts ====
  
 To run one of the scripts above, To run one of the scripts above,
-ssh into the router, then perform each of these steps:+[[:docs:guide-quick-start:sshadministration|ssh into the router]], then perform each of these steps:
 <code bash> <code bash>
 +# Copy the script into your favorite editor and make any changes
 +# When you're ready, copy that text then paste it in when indicated
 +# Run each of the steps below sequentially
 +
 ssh root@192.168.2.1 # use the actual address for your router ssh root@192.168.2.1 # use the actual address for your router
 cd /tmp cd /tmp
Line 133: Line 171:
 # paste in the contents of the script, then hit ^D (Control-D) # paste in the contents of the script, then hit ^D (Control-D)
 sh config.sh sh config.sh
-# Presto! (You should reboot the router when this completes.)+# Presto! 
 </code> </code>
  
  • Last modified: 2024/09/06 13:37
  • by richb-hanover