Router B gets internet by Wireless from router A and I want it to use A's DHCP server

Hello, I am connecting this tplink openwrt router to an netgear router (internet provider) by wifi. Tplink's also acts as a WiFi AP with the same interface, so that my wireless devices can connect to it / internet. I want this tplink router to not act as a DHCP server, so that it gets client's ips from netgear's.

Netgears works in the 192.168.100.X range, but if I try to set tplink ip address as 192.168.100.200 it stops working altogether and I cannot access it in 192.168.100.200 either by ethernet or wifi.

What is in

ubus call system board

of your OpenWrt device(s)?

You have to use WDS or mesh mode to have both networks use same IP range (L2 bridged across the wireless link, instead of L3 routed). Then just shut down the DHCP server on lan in the second router. Clients that connect to the second wifi will automatically get DHCP from the first router.

1 Like

Not near device right now, but will tomorrow!

Why is that so?

Any clues on why i am unable to use 192.168.100.200 as tplink's fixed IP address?

If your OpenWrt router is wirelessly connected to the upstream network that has a non-OpenWrt router, you have two options:

  1. setup a routed network behind the OpenWrt device. This means that devices connected to the OpenWrt router will be on a different network than the upstream (ISP) router's network.
  2. Use relayd to extend the network

https://openwrt.org/docs/guide-user/network/wifi/relay_configuration

If at all possible, wired connectivity between the two devices is a better option, but obviously that is not an option in certain situations.

Relayd was exactly my starting point. But i am missing something in how it solves those 2 problems I've mentioned

I see... your post as it stands now does not have enough detail to be able to explain why the address 192.168.100.200 breaks your config.

I'm not personally an expert on relayd -- never used it myself. But what is the upstream router's IP address/subnet?

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

I'm not personally an expert on relayd -- never used it myself. But what is the upstream router's IP address/subnet?

192.168.100.1
255.255.255.0

root@OpenWrt:~# ubus call system board
{
        "kernel": "5.15.167",
        "hostname": "OpenWrt",
        "system": "MediaTek MT7628AN ver:1 eco:2",
        "model": "TP-Link Archer C20 v4",
        "board_name": "tplink,archer-c20-v4",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.5",
                "revision": "r24106-10cc5fcd00",
                "target": "ramips/mt76x8",
                "description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
        }
}
root@OpenWrt:~# cat /etc/config/network

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

config globals 'globals'
        option ula_prefix 'fd85:54ae:e8d4::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device
        option name 'eth0.2'


config interface 'wan'
        option device 'eth0.2'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth0.2'
        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 '1 2 3 4 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 6t'

config interface 'wwan'
        option proto 'dhcp'

root@OpenWrt:~# cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'platform/10300000.wmac'
        option channel 'auto'
        option band '2g'
        option htmode 'HT20'
        option cell_density '0'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'Edimax_N'
        option encryption 'psk2'


config wifi-device 'radio1'
        option type 'mac80211'
        option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
        option channel '36'
        option band '5g'
        option htmode 'VHT80'
        option disabled '1'

config wifi-iface 'wifinet2'
        option device 'radio0'
        option mode 'sta'
        option network 'wwan'
        option ssid 'Edimax_N'
        option encryption 'psk2'


root@OpenWrt:~# cat /etc/config/dhcp

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 cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'
        option filter_aaaa '0'
        option filter_a '0'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

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'
        option loglevel '4'

root@OpenWrt:~# cat /etc/config/firewall

config defaults
        option syn_flood '1'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'

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

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

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'
root@OpenWrt:~# ubus call system board
{
        "kernel": "5.15.167",
        "hostname": "OpenWrt",
        "system": "MediaTek MT7628AN ver:1 eco:2",
        "model": "TP-Link Archer C20 v4",
        "board_name": "tplink,archer-c20-v4",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.5",
                "revision": "r24106-10cc5fcd00",
                "target": "ramips/mt76x8",
                "description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
        }
}

Currently your configuration looks like a standard routed client. It should be working as it is now, but the downstream devices will be on a different network/subnet than the upstream.

With that in mind, since you are routed...

If you're talking about the lan interface, this won't work because of the overlap of the upstream and downstream subnets. They must be unique and non-overlapping subnets.

If you were trying to do this with the wwan interface, you need to make sure you also specify the upstream gateway and dns (192.168.100.1)

What is your goal -- do you want this to be an 'extender' that simply increases the range of a single contiguous network. or do you want to have a seperate/unique downstream network behind the TP-Link router?

OK, your wifi config looks too creative to fix.
Reset the device configuration and disconnect all but WAN cable for startup. Some 100mbps switches of the time leak during startuo enough to get IP across them.
Now do minimal changes to enable wifi - set country in both radios save/apply
Set auto channel in both save apply
Rename both from default openwrt and set security to wpa2 or wpa3 save and apply
Enable and wait 5min for both to appear.

Exactly as a wireless extender!

If you were trying to do this with the wwan interface, you need to make sure you also specify the upstream gateway and dns (192.168.100.1) ----> I would like this tplink´s router IP to be for ex 192.168.100.200 so that when I connect to my wifi network I am able to access this router´s config interface

So the relayd process is what you need to do. Because of the way relayd works, you'll have two addresses (different subnets), but one of them can be your desired 192.168.100.200 address. And the clients will all connect as desired to the 192.168.100.0/24 network.

I am new to opewrt, how to use it (relayed)? First thing I've done is following a step by step openwrt webpage about wireless repeater but it didn't work

What are the advantages of using WDS over relayd?

WDS doesn't apply in your situation because the upstream router/AP is not running OpenWrt.

Your only option is relayd.

Follow the guide again from a fresh state (reset to defaults). Where there is an assumption that the main router is 192.168.1.1, use your own 192.168.100.1 instead.

I've followed an youtube video on how to setup relayd and everything work out smoothly. Unfortunately its a very complex process, openwrt needs to make it more straightforward.

I agree that it is unfortunate how complicated this process is. However, some things to note:

  1. WDS or 802.11s are preferred solutions and can be used when the upstream device is also running OpenWrt. relayd is a method of last resort.
  2. The limitations around setting up wifi repeaters like this (and likewise wireless > wired bridges) is actually a function of the way that the wifi standards were written... they don't actually accommodate this use case.
  3. relayd is actually something of a hack as a result of the above.
  4. The methods to make this easier typically come in the form of proprietary/closed-source code from the chipset manufacturers that is then included in products that are designed as purpose built wifi extenders. Many times, those extenders only work for the same brand/family of devices because of the 'hacks' that are used in the process.

So yes, it would be great if it were easier, but it's necessarily complicated by all of the factors above.

It would, however, be possible for someone to try to write some command line scripts to achieve a repeater function. It would have a bunch of caveats in it and it wouldn't be fully automated, but if could help. If you're handy with linux CLI scripts, you could make a stab at it.

1 Like