Ali
Ali

Reputation: 37

Hosting a server on a private IP address

A server application, written in Java, will be hosted on an IP address provided by the router. How can a client connect from anywhere to the server even though the server doesn't have a public IP, just an IP address provided by the router using NAT translation?

Upvotes: 2

Views: 624

Answers (1)

Alexander
Alexander

Reputation: 1421

You will need to configure a Port Forwarding on your router.

  1. The clients from "anywhere" will connect to the router by its public IP address and the port used for your application (or a different port, but a port you need to define).
  2. The router will use its port forwarding configuration to find the IP address and the port an incoming connection on a certain port shall be forwarded to.
  3. Your router then establishes the connection to your server.

A disadvantage of having your server behind a router using NAT is it gets complicated if you want to have https connections.

Upvotes: 3

Related Questions