Forest Notes

Tips, tricks, cheatsheets


Project maintained by iamzaychik Hosted on GitHub Pages — Theme by mattgraham

IPtables Example

2019-04-15


$ cat /etc/iptables.rules
*filter
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -j ACCEPT

# SSH
-A INPUT -p tcp --dport 22 -s A.B.C.D/M -j ACCEPT

# FTP
-A INPUT -p tcp --dport 21 -s A.B.C.D/M -j ACCEPT

# TFTPD
-A INPUT -p udp --dport 69 -s A.B.C.D/M -j ACCEPT

# SNMPD
-A INPUT -p udp --dport 161 -s A.B.C.D/M -j ACCEPT

# HTTP, HTTPS
-A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT

# ICMP PING
-A INPUT -p icmp --icmp-type echo-request -j ACCEPT

# CLOSE ALL PORTS
-A INPUT -j DROP
-A FORWARD -j DROP

COMMIT
<EMPTY LINE HERE>