IP tables basics Print

  • iptables, commands, firewall, flush, allow
  • 234

Allow incoming connections from IP 123.0.113.51

iptables -A INPUT -s 123.0.113.51 -j ACCEPT

Allow outgoing connections to IP 123.0.113.51

iptables -A OUTPUT -d 123.0.113.51 -j ACCEPT

Block all connections from IP 123.0.113.51

iptables -A INPUT -s 123.0.113.51 -j DROP

Accept all traffic first to avoid ssh lockdown via iptables
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Flush all blocks:

iptables -F


Was this answer helpful?

« Back