Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attemtping to SSH my home PC from another PC. Before I even get to the command line, I need to know my IP address. But I'm getting confused. If I use ifconfig, I get a a load of "inet" numbers for eth0. If I go onto any of the dozens of "test your IP" websites they all point to an address that is actually the address of my ISP. So what should I use when I want to use SSH?

I'm using Linux.

share|improve this question
You have me confused. Which PC do you run ifconfig on? Your home PC or the PC outside? Same for the "Test your IP" sites? Of course you will want to connect to the "external" IP if and only if the PC you want to connect from is not inside your network. Note that if you're behind a router, you will somehow need to port-forward SSH connections from the outside to your local computer. – slhck Sep 11 '11 at 16:59
I ran ifconfig on my home PC. Same for the web-based checks. I want to open a link from my laptop to my home PC. I'm not on a network, in that my home PC is connected to an ISP provided modem, which is connected into the wall. SOrry for any confusion. I'm new to all this stuff... – Gareth01 Sep 11 '11 at 17:04
What network is your laptop on? can it get to the internet? – Scott Sep 11 '11 at 17:24
My laptop is on my work network. It has internet access – Gareth01 Sep 11 '11 at 17:31

The address you get from the "test your ip" websites is your public IP address. This is the address that makes you unique on the internet. Most likely, this address is assigned to your router. The IP addresses of your computers, laptops, etc are internal IP addresses, unique to your network, not the internet.

If you want to SSH to your home computer from another location, you need your public IP address and to enable port forwarding on your router (port 22 for SSH) to your PCs internal address. Check your router's manual on how to do this.

Be aware that your public IP, assigned by your ISP, is most likely assigned by DHCP. This means that the IP address could change without notice, although not likely.

share|improve this answer
I dont really understand. I don't have a router. – Gareth01 Sep 11 '11 at 17:13
what is your computer at home connected to? Where does the ethernet cable go? – Keltari Sep 11 '11 at 17:16
into a motorola cable modem – Gareth01 Sep 11 '11 at 17:18
you really should put a router/firewall between the cable modem and your PC. Its a really bad idea to have a computer hooked directly to the internet like that. However, it makes the explanation simpler. You need to SSH to your public ip addess and the cable modem just forwards it to your PC. – Keltari Sep 11 '11 at 17:26
So... my public ip address is the address I find on various "test your ip" sites? – Gareth01 Sep 11 '11 at 17:30

So, ifconfig from a linux command line, will give you some of the info you need:

eth0      Link encap:Ethernet  HWaddr 00:e0:52:90:a0:6e  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::2e0:52ff:fe90:a06e/64 Scope:Link
          RX packets:2739429 errors:0 dropped:0 overruns:0 frame:0
          TX packets:95275 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1104760995 (1.1 GB)  TX bytes:7946649 (7.9 MB)
          Interrupt:17 Base address:0x8c00 

The eth0 is your first ethernet adapter [likely your only adapter]. The second line under that shows inet addr [my example shows]. Yours will likely be 192.168.1.x if you are using one of the more popular home routers to share your internet connection. If you want to connect to this computer from another computer at home, this is the ip address you should use. If you want to connect to this machine from the internet, you need to configure your router to map port 22 to this ip address [192.168.1.x in my example]. Either way, if you are going to routinely ssh into the machine, you should set up a static ip address for it, either by a DHCP Lease reservation, or configuring a static ip address in the machine itself. If you configure static ip in the machine, make sure it is outside of the range that your router uses for dhcp leases.

share|improve this answer
what model motorola cable modem? Can you post the results of ifconfig – Scott Sep 11 '11 at 17:23

You must log in to answer this question.

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