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 05-19-2010, 07:44 AM   #1
jancha
LQ Newbie
 
Registered: May 2010
Posts: 2

Rep: Reputation: 0
DNAT to external host


Hello,

We have slight issue with traffic redirection.

So, we have mail server M, we have web server W. M and W are in different networks. Moreover, W is openVZ VE.

What we want to achieve is to have following scenario:

W:25 -> M:25
W:143 -> M:143
W:993 -> M:993

We tried acomplishing this with adding following rules on W:
A PREROUTING -d W/32 -i venet0 -p tcp -m tcp --dport 25 -j DNAT --to-destination M:25
-A PREROUTING -d W/32 -i venet0 -p tcp -m tcp --dport 143 -j DNAT --to-destination M:143
-A PREROUTING -d W/32 -i venet0 -p tcp -m tcp --dport 993 -j DNAT --to-destination M:993

Now, when trying to connect to W:25, it feels as if connection request is sent to W but answer from W is not sent back to requester.

Any clues?

Exact setup works perfectly if M is in same subnet (another VE).
Thanks.
 
Old 05-19-2010, 07:50 AM   #2
jancha
LQ Newbie
 
Registered: May 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Like always. Answer is found as soon as issue posted

There was missing SNAT rule:
iptables -t nat -A POSTROUTING -d M -p tcp --dport 25 -j SNAT --to-source W
iptables -t nat -A POSTROUTING -d M -p tcp --dport 143 -j SNAT --to-source W
iptables -t nat -A POSTROUTING -d M -p tcp --dport 993 -j SNAT --to-source W

maybe someone might find this useful. regards.
 
  


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
Can't retrieve any external URLs from Fedora 12 host judgedeath2 Linux - Networking 4 01-19-2010 02:28 PM
Teamspeak server contacting external host every 5 minutes hazza96 Linux - Server 1 01-02-2010 03:10 PM
www cname record for external host in DNS zone file hebblethwaite Linux - Networking 2 10-22-2008 09:36 PM
External port forwarding to an internal host antken Linux - Networking 3 12-17-2006 09:43 AM
Resolving IP for an external LAN host MadCactus Linux - Networking 1 07-05-2003 04:58 PM

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

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