Tuesday, May 7, 2024
22
rated 0 times [  22] [ 0]  / answers: 1 / hits: 38318  / 1 Year ago, sun, january 29, 2023, 5:55:26

My computer is connected to the Internet through a wifi-router. I want to have access to my computer remotely, for example using ssh.
When I ask my computer what my IP address is, for example by going in the network indicator, I get 192.168.1.101. But when I go on a website as whatismyip.com, I get a totally different address, probably the one of my router.



So what address should I use to access my own computer remotely and not any other machine in my home wifi-network?


More From » remote-access

 Answers
6

Okay, others have already answered but I've typed too much to hit cancel :P



To access computers inside your home network from an outside network, you need to use the IP address displayed by whatismyip.org. 192.168.1.101 in this case is your internal LAN IP address assigned to your system by your router via DHCP. The outside world does not see this. As your router handles incoming and outgoing network traffic, it translates between your "real" IP address and the various internal IP addresses inside your network. This is called Network Address Translation or NAT for short. Wikipedia has a nice analogy:




A NAT device is similar to a phone system at an office that has one
public telephone number and multiple extensions. Outbound phone calls
made from the office all appear to come from the same telephone
number. However, an incoming call that does not specify an extension
cannot be transferred to an individual inside the office. In this
scenario, the office is a private LAN, the main phone number is the
public IP address, and the individual extensions are unique port
numbers




You'll also need to setup some port forwarding rules on your router. The instructions for this depend on what kind of router you have but the basic idea is that you are telling your router: "Hey, if you see any incoming traffic on port 22, send it to the computer that has 192.168.1.101 as its IP address". Of course, change the port number and ip addresses as suits whatever it is you are trying to use.



You can usually access your router's configuration settings by opening a browser and typing in 192.168.1.1 or 192.168.1.0 for the address. You can execute netstat -rn and look at the last line to find the correct address if you are not sure.



Now comes the tricky part. Unless you tell your router "Always give this computer the IP address 192.168.1.101", there is no guarantee it will always be that...but it probably will. Moreover, your public IP address is probably also assigned via DHCP from your Internet service provider. So, if you reset your modem or if enough time goes by, your public IP address can also change and you'll have to look it up again at whatismyip.org. There are ways around these issues but I've typed enough for now and I think it's a separate question. Hope that clears some stuff up!


[#41623] Tuesday, January 31, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oneeme

Total Points: 340
Total Questions: 110
Total Answers: 133

Location: Ghana
Member since Fri, Oct 21, 2022
2 Years ago
;