开发者

how to access server within local network from internet

Assume I have a server application which is working in computer not connected to internet directly开发者_StackOverflow中文版 but with router, so the question is how to connect to that server from another computer not within internal network(from internet)?

As I know Administrator can configure router to redirect specified port requests to that computer, but can I do this automatically?

I am using WCF and C#


Port Forwarding and NAT have to be done at the router, you can't hijack that setting from a given local machine, that would lead to exploits of biblical proportions.


If the router supports uPnP, and the server application requests it, the router can open the port on behalf of the server app.

This really only works on consumer grade routers since any sane admin will have turned this off on a real network.

edit

There is some code for enabling uPnP in C# here and here.

The alternative is to have a server at a well known location on the internet. The application behind the firewall creates a persistent connection to the internet server. The user then connects to the internet server which relays packets to the firewalled application. Programs like teamviewer use this method to get around the NAT.


No. Your network should be configured to host the Server or Service on the Internet. Making use of Network Address Translation, Port Address Translation, or a DMZ would be the best approach.


Administrator can configure router to redirect specified port requests to that computer

I think that's your answer right there. It may be possible to perform such configuration from the outside (internet) if something on the inside which allows you to connect to it (i.e. something already connected to the internet) also lets you perform such configuration. But considering the whole point of leaving some computers without internet connectivity that would be a strange setup indeed.

This, to my suspicious mind, sounds more like wanting to break in than wanting to do something one's allowed to. For the latter, the answers already given are pretty good. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜