There are solutions for “dynamically” accessing software on a computer behind NAT, but usually mainly for UDP communications.
The UDP hole punching method is one of them. However, this is not guaranteed to work in all possible situations. If both sides of the connection are behind the "Symmetric NAT Cone", it will not.
You can truly reduce the likelihood that a client will not be able to communicate using UPnP as a backup (or even primary) alternative.
I don’t know web services and don’t even know if using UDP for your web service is an option (or even possible).
Using the same method for direct TCP will most likely fail (TCP connections are not stateless - there are many problems here).
An alternative using the same technique would be to create some kind of UDP based VPN (just like OpenVPN ), but as you stated, you will have to manage keys, certificates, etc. It can be automated (I did it), but still, it is not entirely trivial.
=== EDIT ===
If you really want to use TCP, you can create a simple proxy program on client boxes that will serve as a relay.
You will have the following diagram:
- Web service on client boxes, behind NAT
- Software "proxies" in the same cells, establishing an outgoing (thus not blocked) TCP connection to the servers of your company.
- Your company’s servers also use WebService, which requires, for example, “Client ID” to redirect the request to the appropriate established TCP connection.
- The proxy program requests a local WebService and sends a response to the company's servers, which also relay the response to the original requestor.
Alternative: you can ask the proxy software to directly connect to the requestor to improve performance, but then you may encounter the same NAT problems that you are trying to avoid.
ereOn
source share