Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 06-12-2006, 07:23 AM   #1
Registered: May 2004
Distribution: redhat, trustix, debian
Posts: 103

Rep: Reputation: 15
Unhappy strange NAT problem


I have a strange nat problem
I became the administrator of a linux gateway using firehol.

This machine is a gateway for a small subnet /28. I have some DNAT enabled for some users to connect from home to their PC-s at work. Theese users connect to one of the IP's from my subnet. If I issue an iptables -t nat -L -n I can see the rules witch DNAT the traffic from theese users with destination to the local ip-s, but at the SNAT part I see the traffic going outside only SNAT-ed to my gateways IP.

So for example: Let's say I have for my gateway, and a pc behind that gateway. Users from home connect to but theese are beeing DNAT-ed at the gateway to 192.168.X.X (a pc on the network). The problem is that according to iptables everything is SNAT-ed to (the gateways ip).
But this is not true. If I start capturing packets with tcpdump I see that traffic sourced from And the users can connect to their pc's (they connect to and they get replies also from
On the inside interface of the gateway I capture packets sourced from 192.168.x.x and on the outside interface they are sourced from So the nat is done by the gateway.
I checked iptables -t nat and iptables -t mangle but this address doesn't appear there.

Any help would be appreciated. Where else should I check? Firehol is doing something without iptables?
Old 06-14-2006, 03:21 AM   #2
Registered: May 2004
Distribution: redhat, trustix, debian
Posts: 103

Original Poster
Rep: Reputation: 15
I found a problem but I don't know how to fix it.

The Snat is done in a chain called nat.5, and if I try to view that chain with iptables -t nat -n -L nat.5 it says:

Chain nat.5 (12 references)
target prot opt source destination
RETURN all -- anywhere
RETURN all -- anywhere
RETURN all -- anywhere
RETURN all -- anywhere
RETURN all -- anywhere
RETURN all -- anywhere
SNAT all -- anywhere anywhere to:x.x.x.x

So there should be 12 references wright?
But I can see only 7. Does anybody know why?


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
Really strange problem with NAT router gepas Slackware 7 05-06-2006 08:14 AM
Really strange problem with NAT router gepas Linux - Networking 3 05-05-2006 11:05 AM
please help: strange problem with NAT??? cutejai Linux - Networking 3 12-16-2005 05:37 AM
strange nat problem KennyNotDead Linux - Networking 3 05-11-2005 12:21 PM
iptables - strange behaviour of nat?? shacky Linux - Networking 2 10-17-2004 10:44 AM > Forums > Linux Forums > Linux - Networking

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