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?
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:
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!
Many routers will update a Dynamic DNS service. This is the best way to access your server remotely. You will need to register with the Dynamic DNS service before you can use it. Check which ones your router supports, if any, before you register.
As other have commented you will need to enable either port forwarding (recommended) or DMZ access to your server.
Your router has one address on the Internet. It uses DHCP to provide IP addresses in a private address range (192.168...) to your computers and device. The router will translate addresses to and from the Internet. This is known as Network Address Translation (NAT) and provides some protection.
EDIT: Given you are running Ubuntu. Look at things you can do to secure your system against Internet attacks:
/etc/hosts.allow
and/or/etc/hosts.deny
to limit access to services.scp
rather than FTP to transfer files.logcheck
to scan your logs and notify you of things which might indicate an attack.You don't need to do all of these (except use strong passwords). But each thing you do increases your security.
You will need to configure port forwarding, and will need access to the Administration Panel on the router.
Log in as the Administrative user on your router, Usually by typing either:
http://192.168.1.1
orhttp://192.168.1.255
considering what you have listed as your local ip-address.Look through your settings and try to find Port Forwarding. This is where you can specify to permit access to unique machines within your LAN.
Here is a screen shot of my tab with one of my ssh settings:
There is a really good website (at least it's one I've liked using in the past) that has screen shots and other helpful info located here. If you'd like more specific help leave some comments and I will try and help further. You might be able to find your specific router in their list.
Once you find that, you just add the internal address that you want to permit access to, and specify the ports want them forwarding to (or range of ports).
So like in your example, where you already have identified your external address... after setting up the portforwarding for SSH with port 22 (which I wouldn't recommend). You would then be able to access your machine by ssh by typing:
If you decided to permit port 22 / or
If you chose to use a non-standard one.
Basically you have two ip address. One that's your internet (that your router uses), and one that is local per each computer on your local network. You local ips are generally not accessible outside your network In order to access your local machine from the outside world, you need to set it in your router that anything that hits your router (internet ip) on a specific port, is redirected to a local machine's local port. Do this in your router settings.
OR ...
You can use team viewer and cut out any config at all :)
It is free for personal use
http://teamviewer.com
Am not being rude, but the very nature of your question indicates you should not attempt ANY changes to your routers firewall until you get a grounding in the basics of network function and security. The other answers here are a great start for further reading. Modifying firewalls csn have very nasty side effects if your unsure what you are doing.