0

I have a Python script on my server which opens a socket that can be connected to from anywhere. It works on my digitalocean test server that has a public IP as shown by ifconfig. It does not work on my work server which is behind a router and perhaps a firewall (ifconfig shows a private IP)

Do I need to mess with the router settings and allow port forwarding?

I have installed apache as my understanding is that it's needed to do anything with web (like sockets), although I am not hosting any webpages or browser based stuff, just the socket.

Thanks

1 Answer 1

2

You have a couple of options for allowing external access to your server with private IP:

  1. Forwarding a port from the router/firewall, which protects this server. How to do it depends on the type of the router/firewall.
  2. Using ngrok to circumvent the firewall.
  3. Build yourself VPN connection into the server's LAN - again on the router/firewall. Again, depends on the type of the router/firewall.
  4. Run some king of proxy on the router/firewall, which proxies the incoming connections to the internal IP of your server. Which proxy depends on the protocol you are running, for HTTP i suggest haproxy or nginx.

Depends on what do you need to achieve.

If you want permanent, worldwide access to the service you are running, i suggest number 1 or 4.

If you want to just do some temporary tests, number 2 or 3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .