简体   繁体   中英

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 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#

端口转发和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.

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.

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.

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 (ie 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. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM