Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:network:wifi:wifiextenders:ap_sta [2024/06/24 05:29] – created bluewavenet | docs: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: | ||
| - | ====== | + | ====== |
| - | AP+STA mode allows OpenWrt to connect | + | //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 |
| - | This assumes that your OpenWrt device has the default settings where the AP and Ethernet port are bridged. | + | |
| - | ===== Manual | + | A Wi-Fi Repeater is a configuration |
| - | The changes below assume | + | the network. |
| - | * [[docs: | + | |
| - | * [[docs: | + | |
| - | * [[docs: | + | |
| - | * [[docs: | + | |
| - | ==== 1. Backup the relevant configuration files ==== | + | An OpenWrt router operating in AP+STA mode |
| - | <code bash> | + | (sometimes referred to as "wi-fi tethering" |
| - | cp / | + | by making a wireless uplink to a hotspot (an access point or " |
| - | cp / | + | and then repeating to other devices connected |
| + | wirelessly or to its Ethernet interface. | ||
| + | |||
| + | 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: | ||
| + | the upstream access point (AP) as the **hotspot**; | ||
| + | the OpenWrt Wi-Fi repeater/ | ||
| + | STA refers to the fact that the router connects to the hotspot as a " | ||
| + | |||
| + | ===== Make Backups ===== | ||
| + | The procedure below updates the updates the following files | ||
| + | to configure your router to act as a Wi-Fi repeater/ | ||
| + | It assumes that your router has the default settings and that its wireless and Ethernet are bridged. | ||
| + | ([[docs: | ||
| + | [[docs: | ||
| + | [[docs: | ||
| + | [[docs: | ||
| + | |||
| + | |||
| + | Before you begin, it's always wise to make backups of all your configuration files. | ||
| + | < | ||
| + | # Back up the configuration files | ||
| + | echo ' | ||
| + | cp / | ||
| cp / | cp / | ||
| - | cp / | + | cp / |
| + | cp / | ||
| </ | </ | ||
| - | ==== 2. Modify | + | ===== Configuring |
| + | Use the script below to change the configuration. It performs these tasks: | ||
| + | |||
| + | * Configure the router' | ||
| + | * Create a WWAN interface to get a DHCP from the hotspot | ||
| + | * Add the WWAN interface to the " | ||
| + | * Configure WWAN interface to use ' | ||
| + | * 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 [[: | ||
| <code bash> | <code bash> | ||
| - | # Add WWAN network | + | # Fill in these values, then run the script |
| + | ROUTER_LAN_IP=' | ||
| + | HOTSPOT_ENCRYPTION_MODE=' | ||
| + | HOTSPOT_SSID=' | ||
| + | HOTSPOT_PASSWORD=' | ||
| + | |||
| + | # Set the router' | ||
| + | echo ' | ||
| + | uci set network.lan.ipaddr=$ROUTER_LAN_IP | ||
| + | |||
| + | # Add the WWAN network | ||
| + | echo ' | ||
| uci add_list firewall.@zone[1].network=" | uci add_list firewall.@zone[1].network=" | ||
| uci commit firewall | uci commit firewall | ||
| / | / | ||
| - | # Change | + | # The WWAN interface is the " |
| - | # Note that OpenWrt AP IP address must be in a different subnet than the hotspot | + | echo ' |
| - | uci set network.lan.ipaddr=" | + | |
| - | # Add the WWAN interface | + | |
| uci set network.wwan=" | uci set network.wwan=" | ||
| uci set network.wwan.proto=" | uci set network.wwan.proto=" | ||
| Line 34: | Line 73: | ||
| / | / | ||
| - | # Add a Wi-Fi interface | + | # Add the Wi-Fi interface |
| + | # STA mode, with the proper Wi-Fi credentials (SSID, encryption mode, key) | ||
| + | echo ' | ||
| uci set wireless.wwan=" | uci set wireless.wwan=" | ||
| uci set wireless.wwan.device=" | uci set wireless.wwan.device=" | ||
| uci set wireless.wwan.network=" | uci set wireless.wwan.network=" | ||
| uci set wireless.wwan.mode=" | uci set wireless.wwan.mode=" | ||
| - | # The encryption and ssid values | + | # Change the encryption and ssid values to match those of the hotspot (AP) |
| - | uci set wireless.wwan.encryption=" | + | uci set wireless.wwan.encryption=$HOTSPOT_ENCRYPTION_MODE |
| - | uci set wireless.wwan.key=" | + | uci set wireless.wwan.ssid=$HOTSPOT_SSID |
| - | uci set wireless.wwan.ssid=" | + | uci set wireless.wwan.key=$HOTSPOT_PASSWORD |
| uci commit wireless | uci commit wireless | ||
| wifi reload | wifi reload | ||
| </ | </ | ||
| - | :!: An alternative **event-driven** recovery solution is to be found [[https:// | + | ==== Revert to AP-Only mode (Optional) |
| - | + | //This is an optional, but recommended step.//\\ | |
| - | ==== 3. Revert to AP Only mode on boot when Hotspot is not available | + | When the upstream |
| - | When the hotspot is not available or it is incorrectly defined in the wireless configuration file, OpenWrt will disable | + | If that happens, |
| - | This means that you can only access your OpenWrt device | + | The following |
| - | The following | + | If the router cannot |
| - | If OpenWrt can not connect to the hotspot after 30 seconds, | + | |
| - | This will allow wireless | + | |
| <code bash> | <code bash> | ||
| # Create AP Only and AP+STA wireless configuration files | # Create AP Only and AP+STA wireless configuration files | ||
| - | cp / | + | cp / |
| cp / | cp / | ||
| Line 101: | Line 140: | ||
| </ | </ | ||
| - | ==== 4. wwanHotspot: | + | :!: An alternative **event-driven** recovery solution is to be found [[https:// |
| - | In one place 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. | + | |
| + | ==== wwanHotspot: | ||
| + | In one location | ||
| This daemon may be used instead of the method described in step 3. | This daemon may be used instead of the method described in step 3. | ||
| Download the latest version of [[https:// | Download the latest version of [[https:// | ||
| - | ==== 5. Disable DNS rebind protection ==== | + | ==== Disable DNS rebind protection |
| Disable DNS rebind protection if you need to trust upstream resolvers. | Disable DNS rebind protection if you need to trust upstream resolvers. | ||
| Line 114: | Line 155: | ||
| uci commit dhcp | uci commit dhcp | ||
| / | / | ||
| + | </ | ||
| + | |||
| + | ==== How to run these scripts ==== | ||
| + | |||
| + | To run one of the scripts above, | ||
| + | [[: | ||
| + | <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 | ||
| + | cd /tmp | ||
| + | cat > config.sh | ||
| + | # paste in the contents of the script, then hit ^D (Control-D) | ||
| + | sh config.sh | ||
| + | # Presto! | ||
| </ | </ | ||