I've been messing with this issue for some days now trying to find out how I should configure it, if at all possible in the first place.
I've included a rough schematic of how my home network is connected at the moment.
What I basically want to achieve is to have a second wifi network with only access to the LAN, preferably in the same subnet. So no internet access at all. I was thinking to have a separate interface for the "no-internet" wifi and use firewall rules to reject traffic outside of the 192.168.0.x range. I'm however not so sure if this is at all possible. The WAN port is not used, hence the interface has been removed from OpenWRT.
What you want to achieve is possible. Based on your schematic with unmanaged switches, the new network must be created on the Flint 2 where there will be appropriate firewall rules to realize the restrictions. If you can either directly connect the Flint 2 to the NanoPi R4S, or replace your unmanaged switch with a managed one, you could do this on your main router.
Since the Flint 2 is the only Wifi "access point" I wanted to achieve my goal using only the Flint if possible. I'm however not able to configure it properly it seems. Any hints on how this can be done is much appreciated. Should I assign a different subnet and hence a DHCP server on the "non-internet" wifi? Or is it possible to remain in the subnet of the rest of the network? The latter definitely has my preference since this already worked. Blocking the internet access though was so far unsuccessful.
Ok... this means that you will need to also make a change on the main router.
What address does the AP hold on the network now?
Let's see your current config files for the AP and main router:
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:
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/dhcp
cat /etc/config/firewall
I just noticed that the Flint2 doesn't have any connection to the internet. When I try "opkg update" I get "opkg_download: Check your network settings and connectivity."
Also ping requests from Luci seem to fail. All devices connected(wired and wireless) seem to have internet connection just fine. I did notice in Luci status that the default gateway is missing, it is however setup in the "br-lan" interface. Maybe this is part of the problem why I can't get this to work?
I don't see any reason for this issue based on the config... how is your flint2 connected? Is it using one of the lan ports? Maybe you disabled dnsmasq and the firewall (they need to be enabled)?
meanwhile, we can get started on the changes for the non-internet lan...
Your network and dhcp files look good on the Flint2. Let's make a few additions to the firewall:
First, we'll add a forward that allows the lan to reach the lan_noinet:
config forwarding
option src 'lan'
option dest 'lan_noinet'
Next, we'll add these two rules to define what is accepted vs rejected for the noinet network to initiate:
config rule
option name 'Allow-main-lan'
option src 'lan_noinet'
list src_ip '192.168.1.0/24'
option dest 'lan'
list dest_ip '192.168.0.0/24'
option target 'ACCEPT'
config rule
option name 'BlockInternet'
list proto 'all'
option src 'lan_noinet'
list src_ip '192.168.1.0/24'
option dest 'lan'
option target 'REJECT'
The firewall and dnsmasq must be active for this to work (sometimes people disable them on bridged APs). Issue these commands to enable them:
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 'lan_noinet'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan_noinet'
config rule
option name 'Allow-main-lan'
option src 'lan_noinet'
list src_ip '192.168.1.0/24'
option dest 'lan'
option target 'ACCEPT'
list dest_ip '192.168.0.0/24'
config rule
option name 'BlockInternet'
list proto 'all'
option src 'lan_noinet'
list src_ip '192.168.1.0/24'
option dest 'lan'
option target 'REJECT'
option enabled '0'
config forwarding
option src 'lan'
option dest 'lan_noinet'
I've disabled the "BlockInternet" rule for now as the passthrough seems to be only going in 1 direction. I'm able to ping a computer in the "lan_noinet" from the "lan" but not the other way around. Also trying to access the internet doesn't work from inside the "lan_noinet".
When I add the following everything works:
config forwarding
option src 'lan_noinet'
option dest 'lan'
Of course this just means that the first firewall rule is not doing it's job properly as this should have the same result in the end. I tried changing the "option dest" to "*" but that didn't work either. I also tried removing the destination network address but that didn't do anything.
If you have any more ideas I'm all ears
I deleted the second rule. This is now my firewall file on the Flint2:
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 'lan_noinet'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan_noinet'
config rule
option name 'Allow-main-lan'
option src 'lan_noinet'
option dest 'lan'
option target 'ACCEPT'
config forwarding
option src 'lan'
option dest 'lan_noinet'
I tried first removing only the src address but that didn't work so I removed both. Still not working... When I modify the "config defaults" "option forward" to "accept" then I have access both ways but of course not restricted to LAN only. I have absolutely no idea why it behaves like this...
config rule
option name 'inter-network-allow'
list proto 'all'
option src 'lan_noinet'
option dest 'lan'
list dest_ip '192.168.0.0/24'
option target 'ACCEPT'
Reboot.
In theory, this should allow traffic to traverse between the two networks, but nowhere else.
I had to insert the "config forwarding" again for it to work though, this is what I added in the firewall file:
config rule
option name 'inter-network-allow'
option src 'lan_noinet'
option dest 'lan'
list dest_ip '192.168.0.0/24'
option target 'ACCEPT'
list proto 'all'
list src_ip '192.168.1.0/24'
config forwarding
option src 'lan'
option dest 'lan_noinet'
Comparing the "original" version with this one I see that "list proto 'all' " is the only difference. When I look in the Luci UI and compare the two versions I see that with "all" it shows "any" in the protocols list while it only shows "TCP" and "UDP" when it's not mentioned in the config file. The ICMP protocol is then unchecked.
Thank you very much for helping me out with this issue! You saved me a ton of frustration and I learned a lot again