Skip to Content

OpenWrt router as bridged repeater using relayd

Posted on

Extend the range of a wireless network using a cheap and cheerful router running OpenWrt as a bridged repeater. All client devices use the same IP address range and are capable of communicating with each other.

Let’s go!

Wireless access points: PrimaryAP is a TP-Link TL-WDR3600 with IP address 192.168.1.1 + wireless channel 11 and the RepeaterAP is a TP-Link TL-WR841N (~$25CAN). Both devices are running OpenWrt.

This thread was a big help in cutting through the confusion and getting everything hopping! Basically there are 2 types of repeater scenarios to consider:

  • non-bridged repeater - works on all radios… devices connected to the RepeaterAP see the PrimaryAP devices, PrimaryAP devices do not see RepeaterAP devices
  • bridged repeater - works for most radios… everything sees everything

All configuration is done on the secondary router to setup device as a bridged repeater.

0. Install relayd

Access the internet by connecting an ethernet cable from the secondary router’s WAN port to the primary router. Login and install relayd

opkg update                                                                          
opkg install relayd                                                                  
/etc/init.d/relayd enable                                                            

1. Configure wireless

Sample /etc/config/wireless

config wifi-device 'radio0'                                                        
option type 'mac80211'                                                         
option channel '11'     # Important! Match with the channel set on PrimaryAP                                                            
option hwmode '11g'                                                            
option path 'platform/ar934x_wmac'                                             
option htmode 'HT20'                                                           
option txpower '30'                                                            
option country 'US'                                                            
                                                                                   
config wifi-iface                                                                  
option device 'radio0'                                                         
option network 'wwan'                                                          
option encryption 'psk2'                                                       
option key '*********************'                                             
option mode 'sta'                                                              
option ssid 'PrimaryAP'                                                        
                                                                                 
config wifi-iface                                                                  
option device 'radio0'                                                         
option network 'lan'                                                       
option encryption 'psk2'                                                   
option key '*****************'                                             
option mode 'ap'                                                           
option ssid 'RepeaterAP'

2. Configure network

Sample /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 interface 'lan'                                                             
option ifname 'eth0'                                                           
option force_link '1'                                                          
option type 'bridge'                                                           
option proto 'static'                                                          
option ip6assign '60'                                                          
option ipaddr '192.168.10.1'    # for relayd... requires 192.168.x.x address but not used by clients
option gateway '192.168.1.1'    # ip address of PrimaryAP                      
option netmask '255.255.255.0'                                                 
option dns '192.168.1.1'                                                       
                                                                                  
config interface 'wwan'                                                            
option proto 'static'                                                          
option ipaddr '192.168.1.254'                                                  
option netmask '255.255.255.0'                                                 
option gateway '192.168.1.1'                                                   
                                                                                   
config interface 'stabridge'                                                       
option proto 'relay'                                                           
option network 'lan wwan'                                                      
option ipaddr '192.168.1.254'   # static ip assigned from PrimaryAP address range         
                                                                                  
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'

3. Configure DHCP

PrimaryAP will handle DHCP for the combined network. Sample /etc/config/dhcp

config dhcp 'lan'                                                                  
option interface 'lan'                                                         
option start '100'                                                             
option limit '150'                                                             
option leasetime '12h'                                                         
option ignore '1'                                                              
                                                                                   
config dhcp 'wan'                                                                  
option interface 'wan'                                                         
option ignore '1'

4. Reboot

PrimaryAP will handle firewall and dnsmasq for the combined network. Disable the services on RepeaterAP to avoid conflicts …

/etc/init.d/firewall stop                                                            
/etc/init.d/firewall disable                                                         
/etc/init.d/dnsmasq stop                                                             
/etc/init.d/dnsmasq disable                                                          

Reboot router.

OK! Connect to the new RepeaterAP and the device will be assigned an IP address on the PrimaryAP’s now-extended network. All rules and services on PrimaryAP will flow through to devices connected via RepeaterAP.

5. Helpful resources

Happy hacking!