Question about virtual AP bridge and NAT

Hi there

I added a couple of new virtual APs and they all work well. They are all on their own subnets with firewall rules dropping traffic between them and all that, so I am pretty proud of myself. But, there is something I am not sure of:

The virtual APs use wlan1 as the master interface. And all the new virtual APs have internet without having to add NAT rules. Why is this? Is it because wlan1 is added under bridge–>ports and all the virtual APs use wlan1 as the master interface therefore they all have internet automatically? The only NAT rule I have is the one for my ISP PPPOE connection.

I am not sure what config to extract for you guys to have a look at (maybe you guys will know without having to look at config :slight_smile: ), so let me know what you need then I will extract it.

Thank you

Output of /interface bridge print, /interface bridge export and /ip firewall export would help us to understand your current setup.

Hi mkx

Thanks for the quick reply. Here is the output requested:

Bridge Print:
name="bridge-local" mtu=1500 actual-mtu=1500 l2mtu=1598 arp=enabled
arp-timeout=auto mac-address=D4:CA:6D:71:83:6B protocol-mode=rstp
fast-forward=no igmp-snooping=no auto-mac=no admin-mac=D4:CA:6D:71:83:6B
ageing-time=5m priority=0x8000 max-message-age=20s forward-delay=15s
transmit-hold-count=6 vlan-filtering=no


Bridge Export:

oct/06/2018 15:39:33 by RouterOS 6.42.6

software id = QMGV-7Q4R

model = 2011UAS-2HnD

serial number = 3F0602CDA998

/interface bridge
add admin-mac=D4:CA:6D:71:83:6B auto-mac=no fast-forward=no mtu=1500 name=
bridge-local
/interface bridge port
add bridge=bridge-local hw=no interface=ether2
add bridge=bridge-local hw=no interface=ether3
add bridge=bridge-local hw=no interface=ether4
add bridge=bridge-local hw=no interface=ether5
add bridge=bridge-local interface=ether6-master-local
add bridge=bridge-local interface=wlan1
add bridge=bridge-local interface=ether7-slave-local
add bridge=bridge-local interface=ether8-slave-local
add bridge=bridge-local interface=ether9-slave-local
add bridge=bridge-local interface=ether10-slave-local
/interface bridge settings
set use-ip-firewall=yes

Firewall Export:

oct/06/2018 15:40:19 by RouterOS 6.42.6

software id = QMGV-7Q4R

model = 2011UAS-2HnD

serial number = 3F0602CDA998

/ip firewall filter
add action=accept chain=forward comment="default configuration"
connection-state=established
add action=accept chain=forward comment="default configuration"
connection-state=related
add action=accept chain=input protocol=icmp
add action=accept chain=input connection-state=established
add action=accept chain=input connection-state=related
add action=drop chain=input in-interface=pppoe-out1
add action=drop chain=input dst-address=192.168.88.0/24 src-address=
192.168.6.0/24
add action=drop chain=input dst-address=192.168.6.0/24 src-address=
192.168.88.0/24
add action=drop chain=input dst-address=192.168.88.0/24 src-address=
192.168.7.0/24
add action=drop chain=input dst-address=192.168.7.0/24 src-address=
192.168.88.0/24
add action=drop chain=input dst-address=192.168.7.0/24 src-address=
192.168.6.0/24
add action=drop chain=input dst-address=192.168.6.0/24 src-address=
192.168.7.0/24
add action=drop chain=input dst-address=192.168.7.1 dst-port=80,8080,443,563
protocol=tcp src-address=192.168.7.0/24
add action=drop chain=input dst-address=192.168.6.1 dst-port=80,8080,443,563
protocol=tcp src-address=192.168.6.0/24
/ip firewall mangle
add action=mark-routing chain=prerouting new-routing-mark=PIA_PPTP_MARK
passthrough=yes src-address=192.168.7.0/24
/ip firewall nat
add action=masquerade chain=srcnat out-interface=pppoe-out1
add action=masquerade chain=srcnat out-interface=pptp-PIA

All LAN that you will create will have internet because of masquerade rule, there you have setup just exit interface, not source subnets, so it get all subnets

Your firewall config features some rules which I guess you intended to prevent clients in different subnets from connecting each other (the ones with src-address=subnet1/24 dst-address=subnet2/24). They are not doing that, they are preventing those clients from connecting to router (note chain=input) if the destination address is not in the same subnet as client. To block connections between clients from different subnets these FW rules should be in chain=forward.

There are a few filters that would make firewall better … it has been discussed a few times in this forum, I’m sure you can find them.

Hi guys

@ingdaka Thanks for the reply. I Google a bit and it makes a lot of sense now so thanks for pointing it out.

@mkx: Thanks for the input and helping out. I actually did have the rules as forward rules, but then I checked the following:
I had a forward rule preventing everyone on IP range 192.168.6.1/24 from connecting to 192.168.6.1 ports 80,8080,443,563, essentially so that they cannot get to the router interface. But then I was still able to get to the router web interface! Then I changed it to input, and then it worked correctly. Now the users on 192.168.6.1/24 cannot connect to 192.168.6.1 over those ports specified. I then figured that all these rules should be input rules…Was I wrong?

The way the rules are set currently (input rules) allows the clients in the subnets to have internet and see each other in the same subnet, but they cannot get to the web interface of the router. I havent tested if they can get to the other subnets using input rules and not forward rules, but a network scan did not show the other IP addresses from the other subnets. Then again, I have not set up routing rules or NAT yet, so the rules are not really necessary are they?

There are a few chains in the firewall, the most important two are input and forward:

  • chain=input rules govern connections to router itself. So use of chain=input to prevent LAN devices from connecting router’s http service is correct
  • chain=forward rules govern connections to other destinations where traffic flows through router. So use of chain=forward is correct one to block connections between devices in different subnets. It is the same chain that could forbid LAN devices from accessing internet (despites having NAT masquerade).

So you are using correct firewall rules for blocking access to router’s services, but you’re using wrong firewall rules to block connectivity between different subnets (e.g. between 192.168.6.13 and 192.168.7.42).

Thanks mkx for pointing it out. I will correct it on my side.

Thanks for all the help, I really appreciate it and learned a lot!