LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-10-2007, 06:04 AM   #1
nosbod
LQ Newbie
 
Registered: Jul 2005
Posts: 18

Rep: Reputation: 0
SNAT and Narc


Hi I have a question regarding SNAT and narc

Basically, our webserver resides at 192.168.1.x on the LAN. To the outside world it is at xxx.xxx.xxx.xxx(this is actually our firewall that forwards traffic through to the webserver on the LAN at 192.168.1.x)
So, users outside the LAN just point their browsers at xxx.xxx.xxx.xxx.

In order to allow this we have a rule like:

iptables -t nat -p tcp -d xxx.xxx.xxx.xxx --dport 80 -j DNAT --to-destination 192.168.1.x

Pointing the browser to xxx.xxx.xxx won't work for users on the LAN. For these people, i believe that I need something like:

iptables -t nat -A POSTROUTING -p tcp -s 192.168.1.0/24 -d xxx.xxx.xxx.xxx --dport 80 -j SNAT --to-source 192.168.1.Y
(192.168.1.Y is the internal LAN address of the firewall)

I have put this last rule in the narc-custom file but it doesn't seem to work.
Any ideas?

Thanks in advance
 
Old 04-10-2007, 08:53 AM   #2
rajat83
LQ Newbie
 
Registered: Apr 2007
Posts: 20

Rep: Reputation: 0
Hi solution 2 your problem

Hi ,
Try these commands.
If you are using your Firewall box as your gateway:

iptables -t nat -A PREROUTING -p tcp --dport 80 -d (real ip) -j DNAT --to-destination (web server ip)

iptables -t nat -A POSTROUTING -p tcp -d (web server ip) -j SNAT --to-source (local LAN ip)(internal ip of your firewall box )

And if you are using your firewall box as a proxy then you hv to add one more command.

iptables -t nat -A OUTPUT -p tcp -d (real ip) -j DNAT --to-destination (webserver ip).
 
Old 04-11-2007, 06:00 AM   #3
nosbod
LQ Newbie
 
Registered: Jul 2005
Posts: 18

Original Poster
Rep: Reputation: 0
mmm, unfortunately it doesn't seem to work.
i've tried

iptables -t nat -A POSTROUTING -p tcp -d (lan webserver ip) --dport 80 -j SNAT --to-source (lan firewall ip)

any help greatly appreciated!
cheers
 
  


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
SNAT problem caps_phisto Linux - Networking 3 11-01-2006 11:50 AM
IPTables snat help DukeLeto Linux - Networking 1 10-01-2006 11:49 AM
Snat ashlesha Linux - Networking 4 08-24-2006 05:02 AM
SNAT help cranium2004 Linux - Networking 0 05-09-2005 03:38 AM
what is snat ? spank Linux - Newbie 5 12-15-2003 01:32 PM

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

All times are GMT -5. The time now is 04:38 PM.

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