Block China IPs Using Linux
Page 1 of 1
Block China IPs Using Linux
- Code:
sudo apt install -y ipset xed gedit
- Code:
xed /etc/block-china.sh
- Code:
# Create the ipset list
ipset -N china hash:net
# remove any old list that might exist from previous runs of this script
rm cn.zone
# Pull the latest IP set for China
wget -P . http://www.ipdeny.com/ipblocks/data/countries/cn.zone
# Add each IP address from the downloaded list into the ipset 'china'
for i in $(cat /etc/cn.zone ); do ipset -A china $i; done
# Restore iptables
/sbin/iptables-restore < /etc/iptables.firewall.rules
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|