Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connecting to a private ip

I want to connect to a system which is behind a router. I know the public address of the router as well as the private ip (fixed always) of the system. How do i establish socket connection with the private ip?

like image 802
chappar Avatar asked Jan 23 '23 08:01

chappar


2 Answers

This is why some people say that they are behind a "firewall", when they are behind a router. The Evil Viruses Of The Internet are not able to exploit any software on a computer behind a router (provided that the router admin didn't configure it in the funny way, for example by enabling DMZ).

You still have some options:

  • Talk to the router admin and make him forward a port for You
  • Take the router out and put Your "target" computer where Your router was, or enable DMZ (this only makes sense if there was only one computer behind the router). Warrning: install a firewall on the target computer first!
  • Turn the socket 180 degrees. Make the computer behind a router establish the connection to the server that has a public IP address
  • Use something like UPnP, if Your router supports it
  • Get a dedicated IP address for Your computer and configure router to switch all traffic to this IP address to Your computer (this is similar to DMZ, but would work if You have more than one computer behind the router). Warrning: install a firewall on the target computer first!
  • Use NAT traversal. There is a very good article on the subject here. Simplified version is that client establishes connection to some remote server. The server can see the opened port number on the client's router and this port is assigned to the client's machine, so it (or some another computer sharing this information) may establish connection to that port and reach the client's application. Warrning: this doesn't work with all routers. Some routers just won't let this happen.
like image 159
Paweł Polewicz Avatar answered Jan 28 '23 17:01

Paweł Polewicz


The simplest thing is probably to forward the port from the system you want to connect to through the router.

like image 41
JosefAssad Avatar answered Jan 28 '23 18:01

JosefAssad