Community discussions

MikroTik App
 
aW50ZXJuZXQ
just joined
Topic Author
Posts: 11
Joined: Mon Mar 21, 2022 5:17 pm

Block Pihole webgui

Sun May 08, 2022 1:37 pm

Hello!

I have an IoT-VLAN that I want to isolate from all my another VLANs but not internet. It works well except for Pihhole gui (10.10.30.2) which is also the dns. How should I write the rule to block even the http. Tried tcp port 80 both forward and input.

/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="Isolate IoT-vlan" dst-address-list=lan-without-iot-vlan src-address-list=\
    iot-vlan
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=drop chain=forward comment="Isolate IoT-vlan" dst-address-list=lan-without-iot-vlan src-address-list=\
    iot-vlan
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related \
    disabled=yes
add action=accept chain=forward comment="defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN

 
erlinden
Forum Guru
Forum Guru
Posts: 1956
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: Block Pihole webgui

Sun May 08, 2022 2:12 pm

Input is for access to the router, forward is for access all other devices.

I prefer to block everything (as last rule in both input and forward chains) and from there add accept rules for everything you want to allow access to. This way you are complete aware of what your are allowing on your network. But be aware that by this approach you could loose access to the router.

I assume that IoT only should have access to port 53 (TCP& UDP) on the PiHole?
 
aW50ZXJuZXQ
just joined
Topic Author
Posts: 11
Joined: Mon Mar 21, 2022 5:17 pm

Re: Block Pihole webgui

Sun May 08, 2022 6:07 pm

Input is for access to the router, forward is for access all other devices.

I prefer to block everything (as last rule in both input and forward chains) and from there add accept rules for everything you want to allow access to. This way you are complete aware of what your are allowing on your network. But be aware that by this approach you could loose access to the router.

I assume that IoT only should have access to port 53 (TCP& UDP) on the PiHole?

Thanks!

It does not seem to work with just dns. mikrotik gui 10.10.30.1 gets blocked but not 10.10.30.2


/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=accept chain=input comment="Accept mikrotik-gui from admin-vlan" dst-address=10.10.60.1 src-address=\
    10.10.60.0/24
add action=accept chain=input dst-address=10.10.30.2 dst-port=53 protocol=udp src-address=10.10.30.0/24
add action=accept chain=input dst-address=10.10.30.2 dst-port=53 protocol=tcp src-address=10.10.30.0/24
add action=drop chain=input
add action=drop chain=input comment="defconf: drop all not coming from LAN" disabled=yes in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related \
    disabled=yes
add action=accept chain=forward comment="defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN


Who is online

Users browsing this forum: Amazon [Bot], GoogleOther [Bot], UkRainUa and 31 guests