View previous topic :: View next topic |
Author |
Message |
cast0r Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/1550887557441d752c85640.gif)
Joined: 15 Dec 2004 Posts: 89
|
Posted: Sun Jun 03, 2007 4:08 pm Post subject: local port redirecting |
|
|
hi.
I need to redirect all incoming trafic from port 3333 onto port 5555 on a local machine. i.e every packets arriving on my PC on eth0 with destination port 3333 must be redirected onto the same machine(localhost) but to port 5555
Using this iptables rule:
Code: | #iptables -t nat -I PREROUTING -p tcp --dport 3333 -i eth0 -j DNAT --to :5555 |
everything works well in LAN, but over Internet it doesn't.
To visualize the scenarion see this graph click
Don't know what the problem is? The machine is placed behind two routers, the first router is redirecting all incoming traffic on port 3333 to the other router which is also redirecting the incoming traffic on port 3333 to the machine.
Now the machine suppose rewrite the destination port from 3333 to 5555, and accept it (i.e. sent back to itself onto port 5555).
Any idea why this is working in LAN(no routers), but over Internet it doesn't? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
erik258 Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/18778702754589d89edad52.gif)
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Sun Jun 03, 2007 4:21 pm Post subject: |
|
|
Do you have experience with routing? _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
cast0r Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/1550887557441d752c85640.gif)
Joined: 15 Dec 2004 Posts: 89
|
Posted: Sun Jun 03, 2007 4:49 pm Post subject: |
|
|
no. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
xanas3712 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/115438571544eca557d30e3.gif)
Joined: 15 Oct 2004 Posts: 455
|
Posted: Sun Jun 03, 2007 5:08 pm Post subject: |
|
|
Have you tried
iptables -t nat -I PREROUTING -p tcp -d 192.168.2.100 --dport 3333 -i eth0 -j DNAT --to 192.168.2.100:5555
I wouldn't think specifying destination here would matter though, but the rule deals with the specific situation.
But if this already works on lan it's possible that this problem is with the rule on the routers side which is supposed to be redirecting all 3333 traffic to that machine. Do you know if that rule is working correctly? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|