Bogon networks are IP address ranges that should never appear on the public internet, as they are either reserved or unassigned. Blocking these ranges is a fundamental and highly effective security measure. While this can be done with simple firewall rules, integrating the blocklist directly into the Suricata IP Reputation system is far more performant.
I rely on the lists provided by Team Cymru for both IPv4 and IPv6 bogons.
1. IPv6 Whitelisting: The Link-Local Caveat
When running an IPS/Firewall, one must be careful not to block essential local network traffic. The global IPv6 bogon list often includes the Link-Local and Multicast ranges (fe80::/10
and ff02::/16
) because they fall under the wider 8000::/1
block.
Since blocking these addresses is incorrect and breaks internal IPv6 communication, a specific pass rule for ICMPv6 is required.
Suricata Pass Rule and RFC Reference
The rule uses ip_proto:58
(ICMPv6) and is carefully scoped. I use the Suricata reference system to document the source of the decision (RFC 4890).
Reference Configuration (/etc/suricata/reference.config
):
config reference: rfc https://datatracker.ietf.org/doc/html/
The Final ICMPv6 Whitelist Rule:
pass ip [fe80::/10,ff02::/16] any -> any any (msg:"Pass essential ICMPv6 Link-Local traffic"; ip_proto:58; reference:rfc,rfc4890; sid:10; rev:1;)
2. Implementing the IP Reputation System
Suricata’s IP Reputation system is a performant alternative to sequential firewall checks. It loads external IP lists into an internal hashmap, allowing for a single, fast lookup per packet.
Configuration Setup
- Enable IP Reputation: Uncomment the relevant sections in
suricata.yaml
and define the list files:
# IP Reputation
reputation-categories-file: /etc/suricata/iprep/categories.txt
default-reputation-path: /etc/suricata/iprep
reputation-files:
- bogons-v4.list
- bogons-v6.list
- Define the Category: Define a specific category for bogons in the
categories.txt
file. The number1
is the category ID used in the final rule.
# /etc/suricata/iprep/categories.txt
1,Bogons,fullbogons list
The Bash Automation Script (IPv4 Example)
A robust Bash script is needed to fetch the lists and format the output into the Suricata-specific IP Reputation format (IP,categoryID,score
).
#!/bin/bash
# ... (Source URL and File paths defined) ...
# 1. Fetch the list and check for changes
wget -q -O "$TMPIPREPFILE" "$SRCURL"
# ... (Diff check to prevent unnecessary updates) ...
# 2. Format and load the list
if [ -s "$TMPIPREPFILE" ]; then
# Remove current list for atomic update
if [ -f $IPREPFILE ]; then
rm $IPREPFILE
fi
# Add each CIDR block with the category ID (1) and a score (10)
while read -r NETWORK; do
# Note: Score > 1 is needed to trigger the alert/drop rule
echo "$NETWORK,1,10" >> $IPREPFILE
done< <(grep -v "^#" $TMPIPREPFILE)
fi
Note: I use a score of 10, meaning a source must have a reputation score greater than 1 to trigger the rule.
3. The Final Detection and Prevention Rules
The final rule leverages the iprep
keyword to check the source IP against the newly loaded Bogon list.
Detection Rule (Testing Phase)
The detection rule is used first to verify the configuration and observe traffic without blocking. The rule is triggered if the source IP’s reputation is in the Bogons category (category ID 1
) and the score is greater than 1.
# Use this first to see what it would drop.
alert ip $EXTERNAL_NET any -> $HOME_NET any (msg:"DROP FullBogons listed."; iprep:src,Bogons,>,1; sid:11; rev:1;)
Prevention Rule (Active Defense)
Once testing is complete, the rule is switched to drop
for active prevention.
# Use this for active IPS defense.
drop ip $EXTERNAL_NET any -> $HOME_NET any (msg:"DROP FullBogons listed."; iprep:src,Bogons,>,1; sid:11; rev:1;)
4. Verification
Verification confirms the lists are loaded and the counts are correct. The vast number of IPv6 bogons (142054
) highlights the importance of this protection layer.
root@fw2:/etc/suricata/iprep# wc -l *
674 bogons-v4.list
142054 bogons-v6.list
1 categories.txt
142729 total
# Suricata log confirming load:
[Info] - reputation: Loading reputation file: /etc/suricata/iprep/bogons-v4.list
[Info] - reputation: Loading reputation file: /etc/suricata/iprep/bogons-v6.list
Sources / See Also
- Team Cymru. Bogon Networks Reference.
https://www.team-cymru.com/bogon-networks
- Team Cymru. List of Unallocated IPv4 Address Space.
http://www.team-cymru.org/Services/Bogons/fullbogons-ipv4.txt
- Team Cymru. List of Unallocated IPv6 Address Space.
http://www.team-cymru.org/Services/Bogons/fullbogons-ipv6.txt
- RFC 4890. Recommendations for ICMPv6 Traffic.
https://datatracker.ietf.org/doc/html/rfc4890
- Suricata Documentation. IP Reputation Configuration.
https://docs.suricata.io/en/latest/configuration/ip-reputation.html
- Suricata Documentation. Working with Suricata-Update (Rule Management).
https://suricata-update.readthedocs.io/en/latest/update.html