So I've been scouring the internet for days trying to figure this out and can't figure it out.

I know its going to be an easy one.

So I recently took an old desktop and loaded ubuntu server 12.04 on it. My goal with this project is to create an area to host a few git repositories and maybe a simple webpage.

I've installed both the SSH and Apache2 packages and tried to configure them. Right now I can log in from my laptop using ssh greg@ but only while I am on the same network. Once I leave the house I get a timeout error.

So 2 things I would like to get at right now.

How to configure the SSH to allow me to access the server from outside the network. Get my host name on the server so logins will be greg@hostname instead of greg@0.0.0

(I've done sudo hostname and changed the etc/hostname file and no results)

Thanks guys.

  • 1
    I assume you have a normal ISP and the server at home is behind a router. Did you forward port 22 through the router to your server? Are you using the external IP address of the router when you are away from home? – William Jackson Sep 22 '13 at 1:15
  • I think that I did. Here is a screen shot i1303.photobucket.com/albums/ag148/Greg_Ruth/… – Greg Sep 22 '13 at 1:20
  • Port forwarding looks good. Now, when you are away from home, what IP address are you trying to connect to? won't work. You need the external IP address of your router. – William Jackson Sep 22 '13 at 1:23
  • Can't believe I wasn't using the right address. Thanks a lot. How can I get a hostname to work instead of the the address. (greg@hostname.com instead of greg@ – Greg Sep 22 '13 at 1:26
  • Post in the answer so I can up rate you – Greg Sep 22 '13 at 1:26

When you are away from home, you need to use the external IP address of your router, with port forwarding configured, to connect to any computer inside your home network.

If you want to use a hostname to get back to your home network when you are away from home, you have two options:

  1. Purchase a domain name from a registrar (I use Hover) and point that name to the external IP address of your router.

  2. Get a domain name from a (possibly free) dynamic DNS service and point that name to the external IP address of your router.

  • 1
    Another option for a hostname would be just his own in the hosts file. Obviously isn't for sharing - but saves the need to type the IP for local use. Though there are many options for option #2, I've seen many mentioned around here (the names escape me this evening). +1 – nerdwaller Sep 22 '13 at 5:14
  • Or he can specify the hostname and IP address in ~/.ssh/config. – Big McLargeHuge Aug 19 '16 at 17:50

You need a static public IP address from your ISP (diff: Public and Private IPs).

Once you have public IP assigned to your server, register and host your DNS name - Howto

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.