Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
local port redirecting
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
cast0r
Tux's lil' helper
Tux's lil' helper


Joined: 15 Dec 2004
Posts: 89

PostPosted: Sun Jun 03, 2007 4:08 pm    Post subject: local port redirecting Reply with quote

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 :arrow: 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
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Sun Jun 03, 2007 4:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
cast0r
Tux's lil' helper
Tux's lil' helper


Joined: 15 Dec 2004
Posts: 89

PostPosted: Sun Jun 03, 2007 4:49 pm    Post subject: Reply with quote

no.
Back to top
View user's profile Send private message
xanas3712
Guru
Guru


Joined: 15 Oct 2004
Posts: 455

PostPosted: Sun Jun 03, 2007 5:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum