iptables
經由先前的簡易測試,我們針對ipv4設置iptables的過濾規則
清理規則
# Flush filter
IPTABLES=/sbin/iptables
$IPTABLES -F
$IPTABLES -X
echo "Flush mangle table ......"
echo
# Flush mangle
$IPTABLES -F -t mangle
$IPTABLES -t mangle -X
echo "Flush nat table ......"
echo
# Flush nat
$IPTABLES -F -t nat
$IPTABLES -t nat -X
###-----------------------------------------------------###
# 設定 filter table 的預設政策
###-----------------------------------------------------###
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT

以前寫的shell
Last updated