tags:

views:

102

answers:

2

hi, how do I drop all traffic to smtp, except originating from my IP? This example I found drops traffic for particular IP, I need to deny by default, but allow 1 IP in. Thanks

# iptables -A INPUT -s 65.55.44.100 -p tcp --destination-port 25 -j DROP
A: 
# iptables -A INPUT -s 65.55.44.100 -p tcp --destination-port 25 -j ACCEPT
# iptables -A INPUT -p tcp --destination-port 25 -j DROP
siposa
A: 

If you actually want to deny all traffic by default, and only open up holes for specific protocols/addresses/etc., what you want to do is continue to use the rule you have now, and also modify the default policy like so:

# iptables -P INPUT DROP

Otherwise, siposa's answer will drop all SMTP traffic except for the specified IP address, while not affecting other protocols.

qid