Created
November 13, 2017 16:07
-
-
Save SanCoder-Q/3ad3a1a153ec836ae308ddca1d8227ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#清空所有链 | |
iptables --flush | |
iptables --delete-chain | |
iptables --table mangle --flush | |
iptables --table mangle --delete-chain | |
#设定默认规则 | |
iptables --policy INPUT DROP | |
iptables --policy OUTPUT ACCEPT | |
iptables --policy FORWARD DROP | |
#允许SSH | |
iptables --append INPUT --protocol tcp --dport 22-j ACCEPT | |
#允许Shadowsocks端口 | |
iptables --append INPUT --protocol tcp --dport 8888 -j ACCEPT | |
#允许合法接入链接 | |
iptables --append INPUT --match conntrack --ctstate ESTABLISHED,RELATED --jump ACCEPT | |
#永久化 | |
iptables-save > /etc/iptables_rules | |
echo "/sbin/iptables-restore < /etc/iptables_rules" >> /etc/rc.local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment