LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (http://www.linuxquestions.org/questions/linux-security-4/)
-   -   iptables rule help (http://www.linuxquestions.org/questions/linux-security-4/iptables-rule-help-553984/)

the_gripmaster 05-15-2007 03:16 AM

iptables rule help
 
We have several networks such as:
192.168.100.0/24
192.168.212.0/24
192.168.222.0/24
192.168.201.0/255.255.255.252

Our mail server has IP address 192.168.201.2

Now we only want to allow 192.168.100.0/24 to access port 25 of 192.168.201.2, and no other network.


What would be the rule (in iptables syntax)?

The mail server currently has no firewall rules.

Samotnik 05-15-2007 05:48 AM

RTFM!
man iptables!

billymayday 05-15-2007 06:13 AM

That's a bit tough - as far as manuals go, iptables is hard to get.


Have a look at

http://iptables-tutorial.frozentux.net/

win32sux 05-15-2007 07:19 AM

if the rule is to be run on the mail server itself, it would be like:
Code:

iptables -A INPUT -p TCP -s 192.168.100.0/24 --dport 25 -j ACCEPT
this assumes a policy of DROP, of course...

if your policy is ACCEPT for some reason, then just tweak it like:
Code:

iptables -A INPUT -p TCP -s ! 192.168.100.0/24 --dport 25 -j DROP


All times are GMT -5. The time now is 10:49 PM.