Sign in to follow this  
Stelimar

Port Forwarding

Recommended Posts

I've been working on client/server framework as a learning project, and I've gotten a simple chat server/client working with it pretty well. I've been testing it by running both the server and client and server on my local machine, with the client connecting to "localhost", and it's worked perfectly. Then I tried running the client on a different computer which is on the same network, with the client connecting to "192.168.1.100" (my computers IP address on the network), and it's worked fine as well. However, I now want it to be accessible from the internet, so that I can test it with a couple friends. I've set the client to connect to "97.114.###.###" (IP address of my modem). My modem is supposed to forward all connections on port 7835 (the port I'm using) to the router (192.168.1.1), and the router is supposed to forward all connections on the same port to my computer (192.168.1.100). But I've evidently done something incorrectly because my server never receives the connection from the client when I try to connect. Does anyone know what could possibly be causing this? Is there any way to check if the modem/router is receiving/forwarding the connection? More info, in case it's needed: Modem: ActionTec Model GT701 Router: LinkSys WRT54G Also, the server is written in Java, and the client is written in Flash.

Share this post


Link to post
Share on other sites
You can hook up a computer running WireShark (or another packet sniffer, such as tcpdump) along each segment of the network. That would require an additional network hub that you can move aroud (and an additional computer).

Share this post


Link to post
Share on other sites
Is it possible to monitor packets received on the modem/router using a packet sniffer? Or will I only be able to see what is happening on the computer it is running on?

Share this post


Link to post
Share on other sites
After some experimenting and comparing packets with WireShark, it looks like the client is able to reach the modem, but the modem keeps resetting the connection for some reason. Here are the packet summaries copied directly from WireShark:

Number	Source		Destination	Protocol	Info
1 192.168.1.100 97.114.79.213 TCP iclpv-wsm > 7835 [SYN] Seq=0 Win=16384 Len=0 MSS=1460
2 97.114.79.213 192.168.1.100 TCP 7835 > iclpv-wsm [RST, ACK] Seq=1 Ack=1 Win=0 Len=0



And that just repeats a few times before the client gives up. The reset flag (RST) is present on these packets, but it wasn't there in any of the packets I looked for connecting to the server when it was on the same network (which does work). Any ideas what could be causing this?

Share this post


Link to post
Share on other sites
Sounds like your modem is acting like a firewall, or not doing port forwarding.

Now, it does look as if you're trying to connect to your external address from your internal address. This is known as a "hairpin" connection, because the packets make a "hairpin" turn when going out from your network. Some gear doesn't properly implement this, so you may be better off trying to connect from some actual, external address. Personally, I find that a WAN card for a laptop is a great way of getting an external connection that's not my regular connection, but if that's not for you, then try calling up a friend and have them try to connect.

Share this post


Link to post
Share on other sites
The problem with that is that in your configuration you have set up double port forwarding.

A double NAT is not likely to be possible technically in most configurations.

The configuration that should work in your case should be like that - modem must forward ports not to router but your server at once. The router however must know the route path to your server.

Share this post


Link to post
Share on other sites
If the modem does NAT, and the router does NAT, you need to port forward twice -- once from the modem to the router, and then from the router to the server. However, there is no reason why that wouldn't work when configured correctly.

Share this post


Link to post
Share on other sites
I am having a similar problem but I don't even know what IP numbers to use.

Right now for my winsock server app I use 192.168.1.101 and for the Flash (AS3) client I use the same IP and it works fine when I run the .SWF directly from Flash CS3 (via CTRL-Enter.)

If I put the .SWF on a web page (even if it's hosted on the local machine) it doesn't work, the same goes for when it's on a web page on the Internet.

In the client I tried using the IP I get from WhatIsMyIP.com but it didn't work.

I have a LinkSys WRT54G wireless router, the computer I'm working on is connected directly to it with a cable, the router is so my girlfriend can get Internet access too.

What should I do ?

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this