Repeater / Multiple SSID / Virtual access point / Client bridge

Basic information about repeater configuration on a forum thread.

With BARRIER BREAKER (Bleeding Edge, r40867)

Tested with the wr841n v9 with Linux OpenWrt-tplink 3.10.36 #1 Thu May 29 06:34:50 UTC 2014 mips GNU/Linux/ or better openwrt BARRIER BREAKER (Bleeding Edge, r40867). The system supports multiple virtual access points.


Modify the files that follows according to your needs (and, in the case, search for the file definition here in the wiki to understand how it works):

etc/config/wireless

config wifi-device  radio0
        option type     mac80211
        option channel  9 #same channel of the existing wifi network
        option path     'platform/qca953x_wmac'
        option txpower  12 #this depends on your needs, default is 20 dBm. Lower it is healthier (citation needed)
        # REMOVE THIS LINE TO ENABLE WIFI:
        #option disabled 1

config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     'This_is_a_new_wifi_network'
        option encryption       psk2 #wpa2 psk
        option key      'this_is_the_wifi_password'

config wifi-iface
        option device   radio0
        option network  wan
        option mode     'sta'
        option ssid     'This_is_the_name_of_the_existing_wifi_network'
        option encryption       psk2
        option key      'this_is_the_wifi_password_to_get_the_connection'

/etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'here is written something, no need to modify it'

config interface 'lan'
        option ifname 'eth0'
        option force_link '1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.11.1' ä modify this according to you needsfor the lan network
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        #option ifname 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option ifname '@wan'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4'

/etc/config/dhcp

Pratically unchanged

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'hybrid'
        option ra 'hybrid'
        option ndp 'hybrid'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'

config dhcp 'wan6'
        option dhcpv6 'hybrid'
        option ra 'hybrid'
        option ndp 'hybrid'
        option master '1'

/etc/config/firewall

Pratically unchanged because the “client” wifi is connected to the “wan” interface, while the “repeater” wifi is connected to the lan interface, thus the firewall is basically already configured.

config defaults
       option syn_flood        1
       option input            ACCEPT
       option output           ACCEPT
       option forward          REJECT
# Uncomment this line to disable ipv6 rules
#       option disable_ipv6     1

config zone
       option name             lan
       list   network          'lan'
       option input            ACCEPT
       option output           ACCEPT
       option forward          ACCEPT

config zone
       option name             wan
       list   network          'wan'
       list   network          'wan6'
       option input            REJECT
       option output           ACCEPT
       option forward          REJECT
       option masq             1
       option mtu_fix          1

config forwarding
       option src              lan
       option dest             wan

Final actions

Just be sure that the files are saved. To edit the files on windows, either use vi on the openwrt, check for a tutorial online, the basic commands are not difficult; or use winscp with a SCP connection and edit the files with an editor on windows. Then reboot the system and check for the wifi connection.

Remember that if the “client” wifi doesn’t work, won’t work also the repeater wifi network.

attitude_adjustment 12.09 (final)

The default wireless configuration is different, for example there is no: option path 'platform/qca953x_wmac' . Further investigation shown that the wireless is able to provide an AP if connected to whatever interface defined in /etc/config/network, while for ‘sta’ mode (a wifi client) it is possible to obtain it only if the interface connected to the wireless configuration is not using the bridge option nor having a relation to a switch with more than one port (for example if with eth0 we define a switch over multiple ports) Note: would be better to check this statement more thoroughly.

For example, with the configuration reported above for barrier breaker, the wlan is linked with the wan side, that is using no switch interfaces nor bridge protocol. This works too for 12.09.


Talking to ChatGPT:

Q: I want to build a Wi-Fi bridged repeater out of my router. Both wireless networks will be the same network, DHCP addresses will be given by the main router, all computers will see each other. I prefer to use web-interface, if possible. If not, I’m fine with ssh too.

A:

To set up your TP-Link TL-WR841N router as a Wi-Fi bridged repeater using OpenWrt, you can follow these steps. This setup will extend your main wireless network (SSID) and allow devices to obtain IP addresses from the main router’s DHCP server. We’ll cover both the web interface and SSH methods.

Using the Web Interface

  1. Log in to the OpenWrt Web Interface:

    • Open a web browser and go to the IP address of your router (usually 192.168.1.1).
    • Log in using your username and password.
  2. Disable the DHCP Server on the Repeater Router:

    • Go to Network > Interfaces.
    • Click the Edit button next to the LAN interface.
    • Go to the DHCP Server tab and uncheck the Enable DHCP checkbox.
    • Save and apply the changes.
  3. Set Up the Wi-Fi as a Client:

    • Go to Network > Wireless.
    • Click Scan to find your main router’s SSID.
    • Click Join Network next to your main router’s SSID.
    • Enter the Wi-Fi password and click Submit.
  4. Bridge the Wi-Fi Client with the LAN:

    • After joining the network, a new interface should be created.
    • Go to Network > Interfaces and click Edit next to the newly created interface (usually named wlan0 or similar).
    • Set the protocol to Static Address and set the IP address to match the main network range but outside the DHCP range (e.g., 192.168.1.2 if the main router is 192.168.1.1).
    • Go to Physical Settings and check Bridge interfaces. Select both the Wi-Fi client interface (e.g., wlan0) and the LAN interface.
    • Save and apply the changes.
  5. Configure the Wi-Fi as an Access Point:

    • Go to Network > Wireless.
    • Click Add to create a new Wi-Fi network.
    • Set the mode to Access Point and use the same SSID and security settings as your main router.
    • Save and apply the changes.

Using SSH

  1. Connect to the Router via SSH:

    • Open a terminal and connect to the router:
      ssh root@192.168.1.1
      
  2. Disable the DHCP Server:

    • Edit the DHCP configuration file:
      vi /etc/config/dhcp
      
    • Find the section config dhcp 'lan' and set option ignore '1' to disable DHCP:
      config dhcp 'lan'
          option interface 'lan'
          option ignore '1'
      
    • Save and exit the editor (:wq in vi).
  3. Set Up the Wi-Fi as a Client:

    • Edit the wireless configuration file:
      vi /etc/config/wireless
      
    • Add a new section to join the main router’s SSID:
      config wifi-iface
          option device 'radio0'
          option network 'wwan'
          option mode 'sta'
          option ssid 'YourMainSSID'
          option encryption 'psk2'
          option key 'YourPassword'
      
    • Save and exit the editor.
  4. Bridge the Wi-Fi Client with the LAN:

    • Edit the network configuration file:
      vi /etc/config/network
      
    • Add a new interface for the Wi-Fi client:
      config interface 'wwan'
          option proto 'dhcp'
      
    • Modify the LAN interface to bridge it with the Wi-Fi client:
      config interface 'lan'
          option type 'bridge'
          option ifname 'eth0 wlan0'
          option proto 'static'
          option ipaddr '192.168.1.2'
          option netmask '255.255.255.0'
          option gateway '192.168.1.1'
          option dns '192.168.1.1'
      
    • Save and exit the editor.
  5. Configure the Wi-Fi as an Access Point:

    • Edit the wireless configuration file again:
      vi /etc/config/wireless
      
    • Add a new section to set up the access point:
      config wifi-iface
          option device 'radio0'
          option network 'lan'
          option mode 'ap'
          option ssid 'YourMainSSID'
          option encryption 'psk2'
          option key 'YourPassword'
      
    • Save and exit the editor.
  6. Restart the Network:

    • Restart the network services to apply the changes:
      /etc/init.d/network restart
      

By following these steps, you should have a Wi-Fi bridged repeater setup on your TP-Link TL-WR841N router. The repeater will extend the range of your main wireless network, and devices will obtain IP addresses from the main router’s DHCP server, allowing all devices to see each other.