Skip to content

Instantly share code, notes, and snippets.

@tzmfreedom
Last active March 8, 2016 05:00
Show Gist options
  • Save tzmfreedom/3ae3818b96dc5ce50a7c to your computer and use it in GitHub Desktop.
Save tzmfreedom/3ae3818b96dc5ce50a7c to your computer and use it in GitHub Desktop.
# 詳細はこちらを参照
# https://github.com/suin/iptables/blob/master/iptables.sh
# clear
iptables -F # テーブル初期化
iptables -X # チェーンを削除
iptables -Z # パケットカウンタ・バイトカウンタをクリア
# policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
# local
iptables -A INPUT -i lo -j ACCEPT
# input
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
# related, established
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# ping death
iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
iptables save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment