Can't access my ssh linux server when outside network

1

1

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@0.0.0.0.0 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.

Greg

Posted 2013-09-22T01:11:35.670

Reputation: 113

some answers to the original question posted at stackoverflow (http://stackoverflow.com/questions/18939285/how-to-access-my-ssh-linux-server-from-outside-my-home-network) may also be helpful

– david.barkhuizen – 2015-05-06T13:59:02.740

1I 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 – 2013-09-22T01:15:13.783

– Greg – 2013-09-22T01:20:12.443

Port forwarding looks good. Now, when you are away from home, what IP address are you trying to connect to? 192.168.0.18 won't work. You need the external IP address of your router. – William Jackson – 2013-09-22T01:23:13.310

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@0.0.0.0.0) – Greg – 2013-09-22T01:26:29.157

Post in the answer so I can up rate you – Greg – 2013-09-22T01:26:46.597

Answers

4

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.

William Jackson

Posted 2013-09-22T01:11:35.670

Reputation: 7 646

Or he can specify the hostname and IP address in ~/.ssh/config. – Big McLargeHuge – 2016-08-19T17:50:57.750

1Another 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 – 2013-09-22T05:14:11.430

0

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

VDR

Posted 2013-09-22T01:11:35.670

Reputation: 851