LinuxQuestions.org
Visit Jeremy's Blog.
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-03-2007, 08:05 AM   #1
GSMD
Member
 
Registered: Dec 2005
Distribution: Gentoo
Posts: 87

Rep: Reputation: 16
-A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to-destination 10.1.1.200:80


This won't work.
I am only able to do DNAT specifying external IP but not interface.

Is there a way to make subj. work?

Thanks.
 
Old 05-03-2007, 08:29 AM   #2
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
I would review this.

It might give some insight to your issue.

HTH,

Centinul
 
Old 05-04-2007, 06:13 AM   #3
GSMD
Member
 
Registered: Dec 2005
Distribution: Gentoo
Posts: 87

Original Poster
Rep: Reputation: 16
Thanks for your reply.
I've already read that before and it contains no clue.
 
Old 05-04-2007, 07:49 AM   #4
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
[EDIT] If you think about what DNAT is, it re-writes the destination address of the packet to whatever you want. So I believe in order for the match to work the target needs to match based on a destination address because a packet coming into an interface could have multiple destination addresses.

This is confirmed if you read the fine print of the link I posted above.

HTH,

Centinul
[/EDIT]

Last edited by Centinul; 05-04-2007 at 07:52 AM.
 
Old 05-04-2007, 08:49 AM   #5
GSMD
Member
 
Registered: Dec 2005
Distribution: Gentoo
Posts: 87

Original Poster
Rep: Reputation: 16
Then how is
Code:
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to 5.6.7.8-5.6.7.10
mentioned in the official netfilter howto supposed to work?
 
Old 05-04-2007, 09:26 AM   #6
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
Well if you read further on their site they have an "example" where they use the following:

Code:
iptables -t nat -A PREROUTING -d 1.2.3.4 \
        -p tcp --dport 80 -j DNAT --to 192.168.1.1
Which is exactly what the original link I posted has. This is a link directly from the site you gave me, which is here.

You said how do you explain how that works... well apparently you have tested it and it doesn't work. Maybe it's a mistake. Try it in the form of the example above and in the tutorial I posted to see if it works.

What do you have against using the destination ip address?

::EDIT:: Please post the output of iptables -L as well so we can see what it really looks like.

::EDIT #2:: Do you have a rule to accept the new type of traffic in the filter table? i.e. an ACCEPT target for 10.1.1.200:80?

Last edited by Centinul; 05-04-2007 at 09:29 AM.
 
  


Reply


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
destination unavailable W/ vpn. All other net destination o.k. MikeOfAustin Linux - Networking 1 04-07-2007 04:42 PM
Strange DNAT behaviour... packet don't pass to PREROUTING and go directly in INPUT !! cbettero Linux - Networking 7 03-09-2007 02:37 PM
Using --dport --sport... When to use one or another Palula Linux - Security 7 09-02-2005 11:32 AM
dport 113 yoursmile Linux - Networking 2 06-23-2005 09:58 PM
DNAT and prerouting is my only problem closer8888 Linux - Networking 0 02-17-2003 10:46 PM


All times are GMT -5. The time now is 06:20 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration