LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-07-2011, 10:24 AM   #1
mrblack21
LQ Newbie
 
Registered: Oct 2011
Posts: 2

Rep: Reputation: Disabled
IPTables/routing oddity


I have a rather complex iptables script that has been working wonderfully for, well, years.

I recently rebooted the server, everything came back up as expected, but something strange is happening now.

I have my port forwarding set up for various services (smtp, pop, etc.) and the rules work fine - however, it's acting as if the gateway is proxying inbound connections to these services. Meaning, it appears as though the firewall is actually connecting to the services, rather than relaying a connection from the outside world.

So, in all of my logs, I have the IP address of the firewall and not the actual connecting client and I'm not sure where this is getting messed up.

Here's an example rule:

iptables -t nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 25 -j DNAT --to 10.x.x.x:25 -m comment --comment "SMTP"

Thoughts?

Thanks!
 
Old 10-11-2011, 09:29 AM   #2
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

IMHO this is exactly the way a proxy is supposed to work. Isn't it?
It isolates the internal IPs from the outside and vice-versa.
I am really interested to what you had before rebooting the server.

Regards,

Tshimanga.
 
Old 10-11-2011, 09:34 AM   #3
mrblack21
LQ Newbie
 
Registered: Oct 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Yes, it's acting exactly like a proxy, but that's not how port forwarding with iptables is supposed to work.

When you port forward, the machine/device doing the routing doesn't manipulate the source address.. so the original source address isn't modified when it reaches the destination.
 
Old 10-11-2011, 09:56 AM   #4
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
From what I know
-j MASQUERADE
and
-j DNAT
do IP proxying/NATing.
 
  


Reply



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 and routing jessjames Linux - Networking 1 08-07-2009 05:30 PM
iptables and routing hquinn Linux - Networking 1 03-15-2008 06:23 AM
iptables routing CJ_Grobler Linux - Security 1 06-14-2005 02:13 AM
Routing with iptables logo Linux - Networking 4 11-01-2004 06:21 AM
routing with iptables Han_Solo Linux - Security 0 10-28-2001 06:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:21 AM.

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