#!/bin/bash # allow the US ips for ip in `more us.zone` do echo $ip iptables -A INPUT -s $ip -j ACCEPT iptables -A OUTPUT -s $ip -j ACCEPT done # block the ips from other countries iptables -A INPUT -j DROP iptables -A OUTPUT -j DROP