pwny.cc
Search…
Iptables

Delete current rules and chains

1
iptables --flush
2
iptables --delete-chain
Copied!

Allow loopback

1
iptables -A INPUT -i lo -j ACCEPT
2
iptables -A OUTPUT -o lo -j ACCEPT
Copied!

Drop ICMP

1
iptables -A INPUT -p icmp -m icmp --icmp-type any -j DROP
2
iptables -A OUTPUT -p icmp -j DROP
Copied!

Allow SSH, HTTP, DNS

1
#SSH
2
iptables -A INPUT -s 10.10.10.10/24 -p tcp -m tcp --dport 22 -j ACCEPT
3
4
#HTTP/HTTPs
5
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
6
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
7
8
#DNS
9
iptables -A INPUT -p udp -m udp --sport 53 -j ACCEPT
10
iptables -A INPUT -p tcp -m tcp --sport 53 -j ACCEPT
11
iptables -A OUTPUT -p udp -m udp --dport 53 -j ACCEPT
12
iptables -A OUTPUT -p tcp -m tcp --dport 53 -j ACCEPT
Copied!