Allow incoming port

Append a rule to accept inbound HTTPS traffic

iptables -A INPUT -p tcp --dport 443 -j ACCEPT

tool
iptables10 commands
tags
iptableslinuxnetworksecurity

More iptables commands

  • iptables -I INPUT 1 -s 203.0.113.5 -j DROP

    Insert DROP rule at position 1 for a specific source IP

  • iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

    Enable IP masquerading for outbound traffic (router/NAT)

  • iptables-save > /etc/iptables/rules.v4 iptables-restore < /etc/iptables/rules.v4

    Persist rules across reboots

  • iptables -D INPUT 3

    Remove rule number 3 from the INPUT chain

  • iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m limit --limit 3/min --limit-burst 5 -j ACCEPT

    Allow max 3 new SSH connections per minute

all 10 iptables commands