Failing proper setup of guest WiFi subnet

Hi anyone, I am sorry to bother with my noob issue. Gratefull if someone can help me to address it.
Got a Cudy WR2100 WiFi router with openwrt-23.05.
1 wan port currently disconnected
4 lan ports bridged (br-lan), working fine:
one to the FTTH modem acting as gateway and DHCP on IP 192.168.1.254
one to the ethernet switch where all lan devices are connected
one to a Linux web server
one currently disconnected
2 WiFi SSIDs 5Ghz and 2.4 GHz are linked to the br-lan with DHCP serving 192.168.1.0 network IPs, working fine.
1 guest WiFi SSID 2.4 GHz linked to a bridge guest network with DHCP serving 192.168.2.0 IPs not working (hosts do connect but do not get any IP).

Here are the config files:

/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 '____:____:____::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        option ipv6 '0'

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'
        option gateway '192.168.1.254'

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'
        option type 'bridge'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

config interface 'guest'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'
        option device 'br-guest'
        option delegate '0'
        option gateway '192.168.1.254'
        option broadcast '192.168.2.255'

config device
        option type 'bridge'
        option name 'br-guest'
        option bridge_empty '1'
        option ipv6 '0'

config device
        option name 'phy0-ap0'
        option ipv6 '0'

config device
        option name 'phy1-ap0'
        option ipv6 '0'

/etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option path '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0'
        option channel 'auto'
        option band '2g'
        option htmode 'HT40'
        option cell_density '0'
        option txpower '20'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'SSID2.4GHz'
        option encryption 'psk2'
        option key 'mykey1'

config wifi-device 'radio1'
        option type 'mac80211'
        option path '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0'
        option channel 'auto'
        option band '5g'
        option htmode 'VHT80'
        option cell_density '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'SSID5GHz'
        option encryption 'psk2'
        option key 'mykey2'

config wifi-iface 'wifinet2'
        option device 'radio0'
        option network 'guest wan'
        option mode 'ap'
        option ssid 'SSIDGuest'
        option encryption 'psk2'
        option key 'mykey3'
        option ieee80211w '0'

/etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option logqueries '1'
        list address 'wr2100.lan/192.168.1.1'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        list dhcp_option '3,192.168.1.254,192.168.1.1'
        list dhcp_option '6,192,168.1.254,8.8.8.8'

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'

config dhcp 'guest'
        option interface 'guest'
        option start '20'
        option limit '20'
        option leasetime '3h'
        option force '1'
        option netmask '255.255.255.0'
        list dhcp_option '3,192.168.2.1,192.168.1.254'
        list dhcp_option '6,192.168.2.1,192.168.1.254'
        option master '1'

config host [I have many of these static leases]
        option name '___________'
        option dns '1'
        option mac '___________'
        option ip '192.168.2.28'

/etc/config/firewall

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

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'

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'

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

config forwarding
        option src 'guest'
        option dest 'lan'

config forwarding
        option src 'guest'
        option dest 'wan'

config forwarding
        option src 'lan'
        option dest 'guest'

config forwarding
        option src 'wan'
        option dest 'guest'

THANKS A LOT any help or directions would be very much appreciated ! :pray:

You'll probably want to add DNS to the lan interface (192.168.1.254), although this is not absolutely required if this device won't be providing DHCP services to the guest network.

Remove the bridge line from the wan interface:

Delete the last 3 lines of guest network interface stanza:

And delete these:

Remove the wan from this wifi config... leave guest -- there must only be one netwrok there.

Is the DHCP server on your main router disabled? If not, you must disable this one by setting it to ignore:

If you do intend to use this device for the main lan DHCP server, you need to remove 192.168.1.1 from option 3.
Enable masquerading on the lan firewall zone by adding option masq '1' to the lan zone stanza:

Delete all of these:

That should get it working. You may wish to tighten the firewall, but we can talk about that after all of the basics are working.

2 Likes

@psherman THANK YOU very much for your time and precious help!!
I've implemented all config amendments mentioned in your post.
Now the 2 wifi on 192.168.1.0 network rely on main DHCP server responding at 192.168.1.254 (the FTTH Fastgate modem) and the guest wifi network 192.168.2.0 is served by OpenWRT (dnsmasq) DHCP server at 192.168.2.1 -- which wasn't working before your suggested config amendments.
This is the ipconfig of a windows host on the guest wifi network:
guest-wifi-host-dhcp-configuration

However, even though the host connected to the wifi guest network is configured in DHCP by 192.168.2.1, it cannot connect to Internet.
When I ping google, the 192.168.2.1 gateway responds that destination port is unreachable:
ping google unreachable

The same host can connect to the FTTH Fastgate modem at 192.168.1.254 (the other lan subnet) through the OpenWRT gateway at 192.168.2.1:
tracert fastgate

Maybe I should set 192.168.1.254 as the default gateway to the guest-lan (192.168.2.1) interface ? Or shall I add 192.168.1.254 as its DNS (how) ?

Let’s see the latest files (network, firewall, dhcp).

1 Like

As this is a Dumb AP you need to either allow masquerading on the LAN interface or set a return route on the main router to route 192.168.2.0/24 back to 192.168.1.1

Luckily @psherman already did the hard work :wink:

1 Like

There we are, current config files:

/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 'My:ula:prefix:/48'
	option packet_steering '1'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	option ipv6 '0'

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'
	option gateway '192.168.1.254'

config interface 'wan'
	option device 'wan'
	option proto 'dhcp'

config interface 'wan6'
	option device 'wan'
	option proto 'dhcpv6'

config interface 'guest'
	option proto 'static'
	option ipaddr '192.168.2.1'
	option netmask '255.255.255.0'
	option device 'br-guest'

config device
	option type 'bridge'
	option name 'br-guest'
	option bridge_empty '1'
	option ipv6 '0'

/etc/config/firewall


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

config zone
	option name 'lan'
	option masq '1'
	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'

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'

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

config forwarding
	option src 'guest'
	option dest 'lan'

/etc/config/dhcp


config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option cachesize '1000'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'
	option logqueries '1'
	list address '/wr2100.lan/192.168.1.1'

config dhcp 'lan'
	option interface 'lan'
	option ignore '1'

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'

config dhcp 'guest'
	option interface 'guest'
	option start '20'
	option limit '20'
	option leasetime '3h'
	option force '1'
	option netmask '255.255.255.0'
	option master '1'
	list dhcp_option '3,192.168.2.1'
	list dhcp_option '6,192.168.2.1'

config host
	option name 'MyHost1'
	option dns '1'
	option mac 'MyMAC1'
	option ip '192.168.2.29'

config host
	option name 'MyHost2'
	option dns '1'
	option mac 'MyMAC2'
	option ip '192.168.2.20'


@egc thank you for your feedback. I can (though have no solid knowledge to) fully operate the OpenWRT behind the FTTH modem, but as far as the latter one (a Technicolor MediaAccess FGA2130FWB operated by the ISP Fastweb, pictured here below) I have limited access and configuration ability (though I can forward all traffic to an internal DMZ, or map specific external-internal port forwarding).

Remove all lines after the lease time:

One more thing: add dns to your lan interface (192.168.1.254)

Then restart and try again.

1 Like

Thanks for your ongoing support on this issue and patience! :raised_hands:
I've added dns option to lan interface as follows:

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'
        option gateway '192.168.1.254'
        option dns '192.168.1.254'

DHCP guest config is now:


config dhcp 'guest'
        option interface 'guest'
        option start '20'
        option limit '20'
        option leasetime '3h'

Client host on guest wifi gets 192.168.2.1 as DHCP server, DNS server and gateway, but does not connect to Internet.
Tracert on external IP as follows (DNS seems ok, but OpenWRT reports: destination protocol unreachable):
tracert google

how about pinging:

Done:

ping -c 4 -I wlp1s0 openwrt.org
PING openwrt.org (64.226.122.113) from 192.168.2.39 wlp1s0: 56(84) bytes of data.

--- openwrt.org ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3059ms
pipe 3

did you ping via IP address? Did that succeed or fail?

Do you?

If you bridge the wi-fi and ports and remove Wan and firewall it just becomes a switch with WiFi. Put on a vlan port from the working router and it becomes isolated.

I'm sure I did that once as proof of concept.
Well, pretty sure.

If the main router isn't handling the guest network from a routing perspective, then one of the two options that @egc stated is required.

  • nat masquerading on the lan interface of a dumb AP makes all traffic to/from the guest network just appear to be to/from the AP itself.... the guest network is masqueraded as the dumb AP's lan IP.
  • If masq is turned off, the main router will not know how to return traffic to the guest network... that's where the static route comes in -- it tells the main router what gateway address is used for the guest network, and thus the traffic gets sent to the right place.
1 Like

So, it can be done both ways If the main router is handling the guest network from a routing perspective?

This is an academic question, not a discussion on my part. Because I either did it or I have a false memory. (something I think is absurd)

Although we were talking about two ways, for completeness, there are 3 ways of handling a guest network (where guest could really be any additional subnet for any purpose).

  1. Main router handles all routing. This is preferred when the main router has the capabilities (such as OpenWrt or other more advanced routing OS's). From there, the APs and downstream devices are configured as VLAN aware dumb (no routing) devices.
  2. A dumb AP handles the guest network routing, NAT masquerading disabled and a static route on the main router. This is good when the main router cannot handle VLANs, but does have static route support. It avoids the double-NAT situation on the guest network (not that it really matters, but still preferable).
  3. Dumb AP handles guest network with NAT masquerading enabled. This is probably the most common situation when a consumer/ISP router with stock firmware is the main network router since many of those don't support (or expose user controls for) static routes and VLANs. The guest network will be double-NAT'd, but generally not an issue for most use cases.
3 Likes

Sorry for late reply. I want to thank you all for the support and solution(s) provided which solved the issue. Everything is working as expected now on the isolated guest subnet.
Let me also apologize, for missing the available guide to setup a Guest Wi-Fi on a dumb wireless AP using LuCI.
BTW, I've realized how much I have to go deeper into studying the protocols and software just to start figuring out what is happening and where to intervene.
Also, I would like to have a setup (Wireshark?) in order to be able to study how single packets travel back and forth through the single parts of the system between my office and my home.
I attach the updated config files, and I'll be more than glad to take any further suggestions you may have to improve the settings, also in order to strengthen the security.

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 '*******'
	option packet_steering '1'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	option ipv6 '0'

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'
	option gateway '192.168.1.254'
	option dns '192.168.1.254'

#config interface 'wan'
#	option device 'wan'
#	option proto 'dhcp'

#config interface 'wan6'
#	option device 'wan'
#	option proto 'dhcpv6'

config interface 'guest'
	option proto 'static'
	option ipaddr '192.168.2.1'
	option netmask '255.255.255.0'
	option device 'br-guest'

config device
	option type 'bridge'
	option name 'br-guest'
	option bridge_empty '1'
	option ipv6 '0'

DHCP

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option cachesize '1000'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'
	option logqueries '1'
	list address '/rudy.lan/192.168.1.1'

config dhcp 'lan'
	option interface 'lan'
	option ignore '1'

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'

config dhcp 'guest'
	option interface 'guest'
	option start '20'
	option limit '20'
	option leasetime '3h'

FIREWALL

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

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

config zone
	option name 'guest'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	list network 'guest'

config forwarding
	option src 'guest'
	option dest 'lan'

config rule
	option name 'Guest-DHCP'
	list proto 'udp'
	option dest_port '67-68'
	option target 'ACCEPT'
	option src 'guest'

config rule
	option name 'Guest-DNS'
	option src 'guest'
	option dest_port '53'
	option target 'ACCEPT'

config rule
	option name 'Guest-2-lan'
	list proto 'all'
	option src 'guest'
	option dest 'lan'
	list dest_ip '192.168.1.0/24'
	option target 'REJECT'

The config looks good! Glad I was able to help.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.