firewallrouterossecurity
Default Firewall for RouterOS v6 and v7
NAT Rule
Source NAT masquerade rule:
- Applies to outbound traffic on WAN interfaces
- Excludes IPsec-encrypted traffic
- Enables address masquerading for internal networks
/ip firewall nat add chain=srcnat out-interface-list=WAN ipsec-policy=out,none action=masquerade comment="defconf: masquerade"
Filter Rules
Input Chain
/ip firewall filter add chain=input action=accept connection-state=established,related,untracked comment="defconf: accept established,related,untracked" add chain=input action=drop connection-state=invalid comment="defconf: drop invalid" add chain=input action=accept protocol=icmp comment="defconf: accept ICMP" add chain=input action=accept dst-address=127.0.0.1 comment="defconf: accept to local loopback (for CAPsMAN)" add chain=input action=drop in-interface-list=!LAN comment="defconf: drop all not coming from LAN"
Forward Chain
/ip firewall filter add chain=forward action=accept ipsec-policy=in,ipsec comment="defconf: accept in ipsec policy" add chain=forward action=accept ipsec-policy=out,ipsec comment="defconf: accept out ipsec policy" add chain=forward action=fasttrack-connection connection-state=established,related comment="defconf: fasttrack" add chain=forward action=accept connection-state=established,related,untracked comment="defconf: accept established,related,untracked" add chain=forward action=drop connection-state=invalid comment="defconf: drop invalid" add chain=forward action=drop connection-state=new connection-nat-state=!dstnat in-interface-list=WAN comment="defconf: drop all from WAN not DSTNATed"
Security Features
- Stateful inspection via connection tracking
- Performance optimization through fasttrack rules
- Implicit deny policies for untrusted sources
- IPsec support for encrypted tunneling