trying to redirect all network traffic to the pihole (even if a client specifies different dns). I noticed that the routerboard doesn't apply any dstnat rules. Where am I doing wrong?
Code: Select all
/ip firewall nat
add action=masquerade chain=srcnat out-interface=dimensione-pppoe src-address=\
192.168.0.0/20
add action=masquerade chain=srcnat out-interface=dimensione-pppoe src-address=\
192.168.240.0/20
add action=masquerade chain=srcnat out-interface=dimensione-pppoe src-address=\
10.255.255.0/24
add action=masquerade chain=srcnat out-interface=dimensione-pppoe src-address=\
172.16.0.0/20
add action=masquerade chain=srcnat comment="PiHole NEW" src-address=\
192.168.55.0/29
add action=dst-nat chain=dst-nat comment="PiHole Access" dst-address=\
192.168.0.8 dst-port=80 protocol=tcp to-addresses=192.168.55.5 to-ports=\
80
add action=dst-nat chain=dstnat comment="PiHole NEW" dst-port=53 \
in-interface-list=LAN protocol=udp src-address-list=!excluded to-addresses=\
192.168.55.5
add action=dst-nat chain=dstnat comment="PiHole NEW" dst-port=53 \
in-interface-list=LAN protocol=tcp src-address-list=!excluded to-addresses=\
192.168.55.5
And not even the various clients are redirected with the DNS on the pihole
Firewall full config:
Code: Select all
/ip firewall address-list
add address=192.168.0.0/20 comment="Casa NET" list=net_casa
add address=0.0.0.0/8 comment="Self-Identification [RFC 3330]" list=bogons
add address=127.0.0.0/8 comment="Loopback [RFC 3330]" list=bogons
add address=169.254.0.0/16 comment="Link Local [RFC 3330]" list=bogons
add address=192.0.2.0/24 comment="Reserved - IANA - TestNet1" list=bogons
add address=192.88.99.0/24 comment="6to4 Relay Anycast [RFC 3068]" list=bogons
add address=198.18.0.0/15 comment="NIDB Testing" list=bogons
add address=198.51.100.0/24 comment="Reserved - IANA - TestNet2" list=bogons
add address=203.0.113.0/24 comment="Reserved - IANA - TestNet3" list=bogons
add address=224.0.0.0/4 comment=\
"MC, Class D, IANA # Check if you need this subnet before enable it" list=\
bogons
add address=xx.xx.xx.xx list=WAN
add address=10.255.255.0/24 comment="Mamma NET" list=net_mamma
add address=172.16.0.0/20 comment="Guest NET" list=net_guest
add address=10.255.255.0/24 comment="Excluded from PiHole" list=excluded
add address=172.16.0.0/20 comment="Excluded from PiHole" list=excluded
add address=192.168.55.5 comment="Excluded from PiHole" list=excluded
add address=10.10.0.0/24 comment="Excluded from PiHole" list=excluded
add address=192.168.240.0/20 comment="Domus NET" list=net_domus
add address=10.10.0.0/24 comment="Base NET" list=net_base
/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="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=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 hw-offload=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
add action=accept chain=input comment="PiHole NEW" dst-port=53 \
in-interface-list=LAN protocol=udp
add action=accept chain=input comment="PiHole NEW" dst-port=53 \
in-interface-list=LAN protocol=tcp
add action=accept chain=forward comment="PiHole NEW" dst-address=192.168.55.5 \
in-interface-list=LAN
add action=accept chain=forward comment="Fast-Forward\r\
\n" connection-state=established,related disabled=yes
add action=add-src-to-address-list address-list=Syn_Flooder \
address-list-timeout=30m chain=input comment="Add Syn Flood IP to the list" \
connection-limit=30,32 protocol=tcp tcp-flags=syn
add action=drop chain=input comment="Drop to syn flood list" src-address-list=\
Syn_Flooder
add action=drop chain=forward comment="DROP traffico da Mamma a Base" \
dst-address-list=net_base src-address-list=net_mamma
add action=drop chain=forward comment="DROP traffico da Mamma a Casa" \
dst-address-list=net_casa src-address-list=net_mamma
add action=drop chain=forward comment="DROP traffico da Mamma a Domus" \
dst-address-list=net_domus src-address-list=net_mamma
add action=drop chain=forward comment="DROP traffico da Mamma a Guest" \
dst-address-list=net_guest src-address-list=net_mamma
add action=drop chain=forward comment="DROP traffico da Guest a Base" \
dst-address-list=net_base src-address-list=net_guest
add action=drop chain=forward comment="DROP traffico da Guest a Casa" \
dst-address-list=net_casa src-address-list=net_guest
add action=drop chain=forward comment="DROP traffico da Guest a Domus" \
dst-address-list=net_domus src-address-list=net_guest
add action=drop chain=forward comment="DROP traffico da Guest a Mamma" \
dst-address-list=net_mamma src-address-list=net_guest
add action=add-src-to-address-list address-list=Port_Scanner \
address-list-timeout=1w chain=input comment="Port Scanner Detect" protocol=\
tcp psd=21,3s,3,1
add action=drop chain=input comment="Drop to port scan list" src-address-list=\
Port_Scanner
add action=jump chain=input comment="Jump for icmp input flow" jump-target=ICMP \
protocol=icmp
add action=drop chain=input comment="Block all access to the winbox - except to \
support list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT\
\_ADDRESS LIST" dst-port=8291 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the www - except to sup\
port list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT AD\
DRESS LIST" dst-port=80 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the www-ssl - except to\
\_support list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPO\
RT ADDRESS LIST" dst-port=443 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the telnet - except to \
support list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT\
\_ADDRESS LIST" dst-port=23 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the ssh - except to sup\
port list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT AD\
DRESS LIST" dst-port=22 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the ftp- except to supp\
ort list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT ADD\
RESS LIST" dst-port=21 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the api-ssl - except to\
\_support list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPO\
RT ADDRESS LIST" dst-port=8729 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the api - except to sup\
port list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT AD\
DRESS LIST" dst-port=8728 protocol=tcp src-address-list=!net_casa
add action=jump chain=forward comment="Jump for icmp forward flow" jump-target=\
ICMP protocol=icmp
add action=drop chain=forward comment="Drop to bogon list" dst-address-list=\
bogons
add action=add-src-to-address-list address-list=spammers address-list-timeout=\
3h chain=forward comment="Add Spammers to the list for 3 hours" \
connection-limit=30,32 dst-port=25,587 limit=30/1m,0:packet protocol=tcp
add action=drop chain=forward comment="Avoid spammers action" dst-port=25,587 \
protocol=tcp src-address-list=spammers
add action=accept chain=input comment="Accept DNS - UDP" port=53 protocol=udp
add action=accept chain=input comment="Accept DNS - TCP" port=53 protocol=tcp
add action=accept chain=input comment="Accept to established connections" \
connection-state=established
add action=accept chain=input comment="Accept to related connections" \
connection-state=related
add action=accept chain=input comment="Full access to net_casa address list" \
src-address-list=net_casa
add action=accept chain=input comment="Full access to net_mamma address list" \
log=yes src-address-list=net_mamma
add action=accept chain=input comment="Full access to net_guest address list" \
log=yes src-address-list=net_guest
add action=drop chain=input comment="Drop anything else! # DO NOT ENABLE THIS RU\
LE BEFORE YOU MAKE SURE ABOUT ALL ACCEPT RULES YOU NEED" log-prefix=DROP!!
add action=accept chain=ICMP comment=\
"Echo request - Avoiding Ping Flood, adjust the limit as needed" \
icmp-options=8:0 limit=2,5:packet protocol=icmp
add action=accept chain=ICMP comment="Echo reply" icmp-options=0:0 protocol=\
icmp
add action=accept chain=ICMP comment="Time Exceeded" icmp-options=11:0 \
protocol=icmp
add action=accept chain=ICMP comment="Destination unreachable" icmp-options=\
3:0-1 protocol=icmp
add action=accept chain=ICMP comment=PMTUD icmp-options=3:4 protocol=icmp
add action=drop chain=ICMP comment="Drop to the other ICMPs" protocol=icmp
add action=jump chain=output comment="Jump for icmp output" jump-target=ICMP \
protocol=icmp
add action=drop chain=forward comment="Avoid spammers action" dst-port=25,587 \
protocol=tcp src-address-list=spammers
add action=drop chain=input comment="Block all access to the ssh - except to sup\
port list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT AD\
DRESS LIST" dst-port=22 protocol=tcp src-address-list=!net_casa
add action=drop chain=input comment="Block all access to the ftp - except to sup\
port list # DO NOT ENABLE THIS RULE BEFORE ADD YOUR SUBNET IN THE SUPPORT AD\
DRESS LIST" dst-port=21 protocol=tcp src-address-list=!net_casa