Is my firewall safe?
Posted: Thu Oct 31, 2024 10:07 pm
I followed this guide for VLANs: viewtopic.php?t=143620
The firewall example in it is different from the firewall filters in the default config. I guess my question is, do I need any or all the stuff I've left out from the default?
All seems to be working so far.
Thanks for any input and thanks for all the forum support up to this point, including all involved with the guide sticky post I followed.
What I have so far:
and the default config's filters:
The firewall example in it is different from the firewall filters in the default config. I guess my question is, do I need any or all the stuff I've left out from the default?
All seems to be working so far.
Thanks for any input and thanks for all the forum support up to this point, including all involved with the guide sticky post I followed.
What I have so far:
Code: Select all
# 2024-10-31 23:16:13 by RouterOS 7.16.1
# software id = 5Z7V-M9DI
#
# model = RB5009UG+S+
# serial number = x
/interface bridge
add name=BR1 protocol-mode=none vlan-filtering=yes
/interface wireguard
add listen-port=39898 mtu=1420 name=wg0
/interface vlan
add interface=BR1 name=BASE_VLAN vlan-id=99
add interface=BR1 name=home_VLAN vlan-id=11
add interface=BR1 name=printers_VLAN vlan-id=77
add interface=BR1 name=untrusted_VLAN vlan-id=22
add interface=BR1 name=work_VLAN vlan-id=88
/interface list
add name=WAN
add name=VLAN
add name=BASE
add name=WORK
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=home_POOL ranges=10.3.11.2-10.3.11.254
add name=untrusted_POOL ranges=10.3.22.2-10.3.22.254
add name=printers_POOL ranges=10.3.77.2-10.3.77.254
add name=work_POOL ranges=10.3.88.2-10.3.88.254
/ip dhcp-server
add address-pool=home_POOL interface=home_VLAN name=home_DHCP
add address-pool=untrusted_POOL interface=untrusted_VLAN name=untrusted_DHCP
add address-pool=printers_POOL interface=printers_VLAN name=printers_DHCP
add address-pool=work_POOL interface=work_VLAN name=work_DHCP
/interface bridge port
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=ether2
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=ether3
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=ether4
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=ether5
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=ether6
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=ether7
add bridge=BR1 frame-types=admit-only-vlan-tagged interface=sfp-sfpplus1
/ip neighbor discovery-settings
set discover-interface-list=BASE
/interface bridge vlan
add bridge=BR1 tagged=BR1,ether2,ether3,ether4,ether5,ether6,ether7,sfp-sfpplus1 vlan-ids=11
add bridge=BR1 tagged=BR1,ether2,ether3,ether4,ether5,ether6,ether7,sfp-sfpplus1 vlan-ids=22
add bridge=BR1 tagged=BR1,ether2,ether3,ether4,ether5,ether6,ether7,sfp-sfpplus1 vlan-ids=77
add bridge=BR1 tagged=BR1,ether2,ether3,ether4,ether5,ether6,ether7,sfp-sfpplus1 vlan-ids=88
add bridge=BR1 tagged=BR1,ether2,ether3,ether4,ether5,ether6,ether7,sfp-sfpplus1 vlan-ids=99
/interface list member
add interface=ether1 list=WAN
add interface=BASE_VLAN list=VLAN
add interface=home_VLAN list=VLAN
add interface=untrusted_VLAN list=VLAN
add interface=printers_VLAN list=VLAN
add interface=work_VLAN list=VLAN
add interface=wg0 list=VLAN
add interface=BASE_VLAN list=BASE
add interface=work_VLAN list=WORK
/interface wireguard peers
add allowed-address=10.88.0.2/32 interface=wg0 name=x public-key="x"
/ip address
add address=10.3.0.1/24 interface=BASE_VLAN network=10.3.0.0
add address=10.3.11.1/24 interface=home_VLAN network=10.3.11.0
add address=10.3.22.1/24 interface=untrusted_VLAN network=10.3.22.0
add address=10.3.77.1/24 interface=printers_VLAN network=10.3.77.0
add address=10.3.88.1/24 interface=work_VLAN network=10.3.88.0
add address=10.88.0.1/24 interface=wg0 network=10.88.0.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=10.3.11.0/24 dns-server=10.3.0.1 gateway=10.3.11.1
add address=10.3.22.0/24 dns-server=10.3.0.1 gateway=10.3.22.1
add address=10.3.77.0/24 dns-server=10.3.0.1 gateway=10.3.77.1
add address=10.3.88.0/24 dns-server=10.3.0.1 gateway=10.3.88.1
/ip dns
set allow-remote-requests=yes mdns-repeat-ifaces=home_VLAN,printers_VLAN,work_VLAN,untrusted_VLAN,BASE_VLAN servers=9.9.9.9
/ip firewall filter
add action=accept chain=input comment="Allow Estab & Related" connection-state=established,related
add action=accept chain=input comment="Allow VLAN" in-interface-list=VLAN
add action=accept chain=input comment="Allow Base_Vlan Full Access" in-interface=BASE_VLAN
add action=accept chain=input comment="allow WireGuard" dst-port=39898 protocol=udp
add action=accept chain=input comment="allow WireGuard traffic" src-address=10.88.0.0/24
add action=accept chain=input comment="Allow wireguard wg0 Full Access" in-interface=wg0
add action=drop chain=input comment=Drop
add action=accept chain=forward comment="Allow Estab & Related" connection-state=established,related
add action=accept chain=forward comment="VLAN Internet Access only" connection-state=new in-interface-list=VLAN out-interface-list=WAN
add action=accept chain=forward comment="Allow printers_VLAN to be the Public VLAN" connection-state=new in-interface-list=VLAN out-interface=printers_VLAN
add action=accept chain=forward comment="Allow Wireguard wg0 in to VLANs" connection-state=new in-interface=wg0 out-interface-list=VLAN
add action=drop chain=forward comment=Drop
/ip firewall nat
add action=masquerade chain=srcnat comment="Default masquerade" out-interface-list=WAN
/system clock
set time-zone-name=America/New_York
/system identity
set name=hs-router
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=BASE
/tool mac-server mac-winbox
set allowed-interface-list=BASE
Code: Select all
/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
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 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 ICMPv6" protocol=icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" dst-port=33434-33534 protocol=udp
add action=accept chain=input comment="defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=ipsec-esp
add action=accept chain=input comment="defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment="defconf: drop everything else not coming from LAN" in-interface-list=!LAN
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 packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=ipsec-esp
add action=accept chain=forward comment="defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment="defconf: drop everything else not coming from LAN" in-interface-list=!LAN