Quantcast
Channel: What is the difference between these 2 iptables rules? - Server Fault
Viewing all articles
Browse latest Browse all 4

What is the difference between these 2 iptables rules?

$
0
0

Trying to allow incoming ssh traffic on port 22. Default behavior is to DROP all incoming traffic.

I came across 2 articles on how to allow traffic. However, they are different.

## open port ssh tcp port 22 ##iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPTiptables -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 22 -j ACCEPT

Vs

# Allow all incoming SSHiptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPTiptables -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT

It appears that the 1st one allows all traffic and then specifes a specific network. Seems like those are mutually exclusive?

What are the differences between these 2 and which one should I use?


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>