Block an IP range of a whole country

March 6th, 2022
# for IPv4
while read p; do if [[ $p != \#* ]]; then echo "-A ufw-before-input -s $p -j DROP" >> output-ipv4.rules; fi; done < input-cidr-ipv4.txt

# for IPv6
while read p; do if [[ $p != \#* ]]; then echo "-A ufw6-before-input -s $p -j DROP" >> output-ipv6.rules; fi; done < input-cidr-ipv6.txt

Please note, in most common setups it does not affect publicly available docker containers and forwarded packets (like in a VPN case). For that use case other tables are to be modified.

Next: ESP8266 Power Considerations

Previous: Eavesdropped using Pegasus

Main Menu