iptables allow outgoing SSH and HTTPS traffic for established connections,

I have allowed outgoing TCP traffic from port 150 like this:

iptables -A INPUT -p udp dport 161 -j ACCEPT

Now I want to allow outgoing SSH and HTTPS for established connection. How do I do that? I am new to iptables please help..


The ports for SSH and HTTPS are by default 22 and 443. Assuming your interface name is eth0, you would need 2 rules such as:

  iptables -A OUTPUT -o eth0 -p tcp --dport 22 -j ACCEPT
  iptables -A OUTPUT -o eth0 -p tcp --dport 443 -j ACCEPT