Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 02-28-2006, 04:33 PM   #1
LQ Newbie
Registered: Feb 2006
Posts: 2

Rep: Reputation: 0
port 25 forwarding iptables FC4, can't get it to pass traffic

Hi All,

I am trying to to set up port forwarding using iptables to forward all port 25 traffic from my mail server to a spam appliance. The trick is that I want to direct all but traffic from one IP address over to the appliance.

here is the rule I am trying to use...

iptables -t nat -A PREROUTING -i eth0 -p tcp -s !10.x.x.x --dport 25 -j DNAT --to-destination 10.x.x.15:25

Any ideas what I am doing wrong?

Old 02-28-2006, 05:08 PM   #2
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
That rule looks fine to me. What happens when you try to use it?
Old 03-01-2006, 05:33 AM   #3
Registered: Feb 2005
Location: ~h3av3n~
Distribution: RHEL 4, Fedora Core 3,6,7 Centos 5, Ubuntu 7.04
Posts: 227

Rep: Reputation: 30
hey just do this on the mailserver and it should work

route add default gw <IP Address of eth0>
Old 03-01-2006, 08:40 AM   #4
LQ Newbie
Registered: Feb 2006
Posts: 2

Original Poster
Rep: Reputation: 0
thanks for the responses. When I try to use the rule I can't send through the mailserver and traffic does not get redirected. Adding the route command as suggested above did not do the trick either.
Old 03-01-2006, 11:00 AM   #5
Senior Member
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Does that rule show up when you do iptables -t nat -L

Do you have rules in the FORWARD chain to allow the packets to be forwarded. Is ip_forwarding turned on in the kernel? You might also want to have ethereal or tcpdump running on the internal interface and see if you can observe the outgoing forwarded packets.


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
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 08:35 PM
How can I block all traffic to port 110 to and IP using IPtables? abefroman Linux - Networking 8 11-16-2005 08:26 PM
port forwarding with iptables kkennedy Linux - Networking 1 09-01-2005 07:48 PM
Port Forwarding and IpTables nathanieljb Linux - Networking 1 03-17-2005 02:28 AM
How to filter traffic using port+process in IPTables muath Linux - Security 10 03-01-2004 12:20 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:37 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