#Me rules iptables -A INPUT -m state --state RELATED,ESTABLISHED -p udp --dport 51413 -j ACCEPT iptables -A OUTPUT -p udp --sport 51413 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 51413 -j ACCEPT iptables -t filter -A INPUT -p udp --dport 51413 -j ACCEPT # default rules iptables -t filter -P INPUT DROP iptables -t filter -P FORWARD DROP iptables -t filter -P OUTPUT ACCEPT # reset specific rules iptables -t filter -F INPUT iptables -t filter -F FORWARD iptables -t filter -F OUTPUT # allow continuation of already-started connections iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # allow local connections iptables -t filter -A INPUT -i lo -s 0/0 -d 0/0 -j ACCEPT # allowed ports (running servers): # 1/ TCP # echo iptables -t filter -A INPUT -p tcp --dport 7 --syn -j ACCEPT # ssh iptables -t filter -A INPUT -p tcp --dport 22 --syn -j ACCEPT # smtp iptables -t filter -A INPUT -p tcp --dport 25 --syn -j ACCEPT # http iptables -t filter -A INPUT -p tcp --dport 80 --syn -j ACCEPT # imap iptables -t filter -A INPUT -p tcp --dport 143 --syn -s 192.168.1.0/24 -j ACCEPT # https iptables -t filter -A INPUT -p tcp --dport 443 --syn -j ACCEPT # samba iptables -t filter -A INPUT -p tcp --dport 445 --syn -s 192.168.1.0/24 -j ACCEPT # smtps iptables -t filter -A INPUT -p tcp --dport 465 --syn -j ACCEPT # ipp iptables -t filter -A INPUT -p tcp --dport 631 --syn -s 192.168.1.0/24 -j ACCEPT # rsync iptables -t filter -A INPUT -p tcp --dport 873 --syn -s 192.168.1.0/24 -j ACCEPT # imaps iptables -t filter -A INPUT -p tcp --dport 993 --syn -j ACCEPT # nfs iptables -t filter -A INPUT -p tcp --dport 2049 --syn -s 192.168.1.0/24 -j ACCEPT # Transmission iptables -t filter -A INPUT -p tcp --dport 51413 --syn -j ACCEPT # 2/ UDP # ipp iptables -t filter -A INPUT -p udp --dport 631 --syn -s 192.168.1.0/24 -j ACCEPT # zeroconf iptables -t filter -A INPUT -p udp --dport 5353 --syn -s 192.168.1.0/24 -j ACCEPT # Transmission iptables -t filter -A INPUT -p udp --dport 51413 --syn -j ACCEPT