LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 05-15-2007, 04:16 AM   #1
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 363

Rep: Reputation: 38
iptables rule help

We have several networks such as:

Our mail server has IP address

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

What would be the rule (in iptables syntax)?

The mail server currently has no firewall rules.
Old 05-15-2007, 06:48 AM   #2
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
man iptables!
Old 05-15-2007, 07:13 AM   #3
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

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

Have a look at
Old 05-15-2007, 08:19 AM   #4
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
if the rule is to be run on the mail server itself, it would be like:
iptables -A INPUT -p TCP -s --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:
iptables -A INPUT -p TCP -s ! --dport 25 -j DROP


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 04:33 PM
iptables rule clarification branden_burger Linux - Security 4 06-02-2006 05:55 PM
What is it doing this iptables rule?? lanczer Linux - Security 1 02-24-2006 12:26 PM
help with iptables rule!! vishamr2000 Linux - Security 6 11-09-2005 06:34 AM
IPTables Rule... Grim Reaper Linux - Software 8 04-28-2003 01:20 PM

All times are GMT -5. The time now is 05:21 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration