Skip to content

Firewall RAW

For the impatient: drop DDoS traffic before connection tracking.

# Drop blacklisted IPs in RAW (most efficient)
/ip firewall raw add chain=prerouting src-address-list=blacklist action=drop
# Bypass connection tracking for specific traffic
/ip firewall raw add chain=prerouting src-address=192.168.88.0/24 dst-address=192.168.88.0/24 action=notrack

Verify:

/ip firewall raw print stats
Overview diagram

What this does: RAW table processes packets BEFORE connection tracking, making it the most efficient place to drop unwanted traffic. It bypasses the connection tracking overhead entirely.

When to use this:

  • DDoS mitigation (high-volume attacks)
  • Large blacklists (10k+ entries)
  • Bypassing connection tracking for trusted traffic
  • Reducing CPU load during attacks

RAW vs Filter:

AspectRAWFilter
Processing orderBefore conntrackAfter conntrack
CPU efficiencyHigherLower
Stateful matchingNoYes
Connection trackingBypassedUsed
TCP RST on rejectNoYes

Chains:

  • prerouting - Incoming packets before routing
  • output - Router-generated packets

Prerequisites:

  • Understanding of packet flow
  • Address lists for blacklist management
/ip firewall raw add chain=prerouting src-address-list=blacklist action=drop \
comment="Drop blacklisted IPs before conntrack"

For trusted LAN-to-LAN traffic:

/ip firewall raw add chain=prerouting src-address=192.168.88.0/24 \
dst-address=192.168.88.0/24 action=notrack comment="Notrack LAN traffic"
/ip firewall raw add chain=output src-address=192.168.88.0/24 \
dst-address=192.168.88.0/24 action=notrack comment="Notrack LAN output"
/ip firewall raw add chain=prerouting protocol=tcp tcp-flags=fin,syn action=drop
/ip firewall raw add chain=prerouting protocol=tcp tcp-flags=syn,rst action=drop
/ip firewall raw add chain=prerouting protocol=tcp tcp-flags=fin,rst action=drop
/ip firewall raw add chain=prerouting in-interface-list=WAN \
src-address-list=bogons action=drop comment="Drop bogon sources from WAN"
RAW Actions diagram
ActionDescription
acceptAccept packet (continues to conntrack)
dropSilently drop packet
notrackBypass connection tracking
jumpJump to custom chain
returnReturn from custom chain
When to Use RAW vs Filter diagram
ScenarioUse RAWUse Filter
DDoS mitigationYesNo
Large blacklist (10k+)YesPossible
Small blacklistOptionalYes
Need stateful matchingNoYes
Need TCP RSTNoYes
High packet rateYesNo
# View rules with stats
/ip firewall raw print stats
# Check connection tracking status
/ip firewall connection tracking print
# Monitor dropped packets
/ip firewall raw print stats where action=drop
SymptomCauseSolution
Notrack traffic not filteredFilter uses conntrackUse RAW or accept in filter
Stateful rules don’t workNotrack bypasses conntrackRemove notrack or use RAW drop
NAT not working for trafficNotrack disables NATDon’t notrack NAT-required traffic

Common Mistakes

  • Don’t notrack traffic that needs NAT - NAT requires connection tracking
  • Don’t use RAW for stateful filtering - use filter chain instead
  • Don’t forget that notrack traffic shows as untracked in filter