Listening to a port via a DSL router/modem

J

John J. Hughes II

My code starts a TCP/IP socket listener and waits for incoming connections.
This works fine on my system and my test system but I have a customer who
say it does not work on their system. As far as I can tell the problem is
they are using a DSL modem with a router internal to it. So basically my
software is listening to IP address 10.0.0.3 but the external connection is
trying to connect to xx.xx.xx.xx on the internet which in concept should get
routed from there to 10.0.0.1 and then to the computer at 10.0.0.3.

Internet -> xx.xx.xx.xx -> router(10.0.0.1) -> computer (10,0.0.3) -> my
code.

snippet of my code:
IPAddress ipAddress = IPAddress.Any;
IPEndPoint localEndPoint = new IPEndPoint(ipAddress,
Convert.ToInt32(SocketPort));
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
listener.Bind(localEndPoint);
listener.Listen(10);

Their modem is a SpeedStream 5200 from Efficient Networks.

Anybody have a suggestion on what to change to make this work?

Regards,
John
 
K

Kevin Yu [MSFT]

Hi John,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you application works on most cases.
However, it doesn't work when the customer is using a DSL modem with
router. If there is any misunderstanding, please feel free to let me know.

As far as I know, this has to work no matter what Internet connection the
customer is using. Generally, I think this issue might have something to do
with the DSL router configuration. Please try to check if some ports has
been blocked. Can this be reproduced on other DSL routers?

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
J

John J. Hughes II

Hello Kevin,

Yes I think you understand correctly.

So basically what you are saying is if I open listener on port 1000 at IP
address 10.0.0.3 and another computer on the internet attempts to connect
via port 1000 on IP address 200.20.30.140 (example) the router will know to
pass the data along?

I understand what you mean by opening the port since I have to enable ports
on my local firewall. But not be an expert on DSL modem/routers I am having
trouble explaining this to the customer and I don't know the procedure that
model.

Regards,
John
 
B

BMermuys

Hi,
inline
John J. Hughes II said:
My code starts a TCP/IP socket listener and waits for incoming connections.
This works fine on my system and my test system but I have a customer who
say it does not work on their system. As far as I can tell the problem is
they are using a DSL modem with a router internal to it. So basically my
software is listening to IP address 10.0.0.3 but the external connection is
trying to connect to xx.xx.xx.xx on the internet which in concept should get
routed from there to 10.0.0.1 and then to the computer at 10.0.0.3.

Internet -> xx.xx.xx.xx -> router(10.0.0.1) -> computer (10,0.0.3) -> my
code.

A router has at least two ip addresses so I guess you mean sometime like
this:

Internet -> [xx.xx.xx.xx <router> 10.0.0.1] -> computer (10.0.0.3)

You are most likely talking about a NAT-router. Which is more then just a
router but behaves different.

- When 10.0.0.3 tries to access the internet the (nat)router will change the
source-ip so that it looks like it comes from xx.xx.xx.xx and on reply it
will do the oposite and change the destination-ip of xx.xx.xx.xx to
10.0.0.3; this happens before routing so that the router will route the
reply to 10.0.0.3 .

- If someone tries to access xx.xx.xx.xx it will stop at that IP unless
something at that point changes the destination-ip so it can be further
routed ( called DNAT ). This will not happen by itself. You should look
into the configurations of the (nat)router and see if it can do something
called "Port-Forwarding " or "DNAT" where you usually can map an external
port (xx.xx.xx.xx:yy) to an internal (eg. 10.0.0.3:zz) .


HTH
greetings
 
J

John J. Hughes II

Thanks for the response.

I tried it at a friends house this morning but could not get my software to
run on his system correctly but basically in regards to the NAT I had to do
something like:

telnet 10.0.0.1

set nat entry add 10.0.0.10 1111 tcp

But his was a Cisco 677 and the customer has a Speedstream 5200 so I am
still at a loss.

Regards,
John
 
B

BMermuys

Hi,

John J. Hughes II said:
Thanks for the response.

I tried it at a friends house this morning but could not get my software to
run on his system correctly but basically in regards to the NAT I had to do
something like:

telnet 10.0.0.1

set nat entry add 10.0.0.10 1111 tcp
or if you don't have a static public ip : set nat entry add 10.0.0.10 1111
0.0.0.0 1111 tcp
write
reboot

This should work, make sure there are no firewalls (sw or hw) blocking.
You can also use "show nat" to see current portforwarding information.
But his was a Cisco 677 and the customer has a Speedstream 5200 so I am
still at a loss.

Anyway it has nothing to do with your c# code and everything with
(nat)routing.

Check out http://www.portforward.com/efficient/5200.htm and more importend
check with the ISP, they can pre-configure it and maybe you shouldn't/can't
change the configuration.



HTH
greetings
 
K

Kevin Yu [MSFT]

Hi John,

It is impossible for a computer on the internet to connection to the
computer behind the router without configuring the Port-Forwarding option
as BMermuys mentioned, because when router get the data package it will not
know which address to forward to. However, the computer behind the router
can connection to that computer which connects to the Internet directly.

So please try to have the customer setting this option, and it should work.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top