Thread: Open Mail Ports
View Single Post

  #4 (permalink)  
Old 12-12-2006, 08:46 PM
rockdalinux's Avatar
rockdalinux rockdalinux is offline
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

POP3 from Lan
Code:
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.1.2 --dport 110 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.1.2 --sport 110 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
and pop3 from Internet
Code:
iptables -A INPUT -p tcp -s 192.168.0.1/24 --sport 1024:65535 -d 192.168.1.2 --dport 110 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.1.2 --sport 110 -d 192.168.0.1/24 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -s 192.168.0.1/24 --sport 1024:65535 -d 192.168.0.1 --dport 110 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.0.1 --sport 110 -d 192.168.0.1/24 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
Make sure IP and subnet adjusted according to your setup.

To block Yahoo, MSN use port number with iptables
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote