3

I have a network with the following structure.

enter image description here

The server in PC2 is simple socket server TCP in 8080 port.

I need to access to PC2 from other external network by socket client. This socket client knows the public IP (85.xxx.xxx.x), the private IP (192.168.0.21) and the port.

How I can access PC2 without port forwarding on the router?

If possible, I would like to have a reference in any programming language of this case.

Additional info

1 Answers1

2

How I can access PC2 without port forwarding on the router?

Assuming a NAT router (which is almost certain given a 192.168.0.0/24 internal network), you can't do this without port-forwarding at the router. Or something very similar.

For example if you can SSH to the router and then to the server you could use SSH tunelling (which is a form of port-forwarding).

You could also have PC2 SSH to a public server and make available a tunelled endpoint there. (you might need something like netcat or socat to assist with this)

In general, port-forwarding at the router is the way to go.


Protocols for NAT traversal

There are ways to enable this sort of communication without manual configuration of port-forwarding but they usually rely on router support and/or an external connection broker.

General

Specific


I would like to have a reference in any programming language of this case

If you are writing the software at both ends there are probably many examples you can follow.

For example, see