3

I am a newbie in networking and I am trying to setup a SSH server, so that I can access the files on my host. I used openssh-server to successfully setup and connect to the server (on LAN).

While connecting, I use my IP address: e.g. ssh [email protected] etc.

Now the problem is, my host gets the IP address dynamically, so every time I restart my host machine, the SSH server will have a different location (IP address).

I tried using avahi-daemon and could not connect using my hostname.

I have 2 questions:

If my host is on the same network, how can I access it using the hostname (I don't want to enter the IP address while connecting)?

If my host machine is on my home network, how can I access it from my Work network?

I remember, on Windows, if my host and client are on the same network, I can simply connect using the hostname.

.

The basic idea is I could have my host machine at

(a) Work (LAN) where I cannot access the router.

(b) at home (Using the internet) .

I want to access the host machine, without using the IP address. And I want to access all the files on my host machine. Is there any easy solution to this?

1
  • When you say "my host gets the IP address dynamically, so every time I restart my host machine" Are you just talking about your linux machine?
    – SeanClt
    Commented Mar 21, 2016 at 19:14

2 Answers 2

1

So what you need to do is take advantage of a service like Dyn DNS.

This will cause your server to periodically update the DNS records to point to your servers dynamic IP address.

2
  • When DynDns was being difficult about keeping accounts active, basically shutting down a hostname if the right hoops were not jumped through, my backup method was to have the home machine send an email periodically to a free email account hosted at gmail. If my home IP had changed, and DynDns had stopped working, I could always go to the gmail account and look at the email. I put the IP address in the email body, but I could have just looked at the original headers too. I have not checked, but I suspect DynDns is even more difficult these days than then.
    – infixed
    Commented Mar 21, 2016 at 21:38
  • well, now, DynDNS is paid, and my router (Netgear 3000 NAS100) does not support any other DDNS provider (like No-IP) I need to change the router or buy the DynDNS subscription. Is there any other (free) way? I really appreciate your help. Commented Mar 28, 2016 at 18:12
0

I assumed when you said my host, you mean your linux box

  1. Set a static IP on your Linux box so you have a static IP

  2. on your Router Enable DDNS, DynDNS is no longer free, i personally use http://www.noip.com. this would give you a public hostname like yourname.noip.com

If you router doesn't support no-ip then you can flash it with DD-WRT, DD-WRT supports no-ip.com

  1. Change SSH port from default 22 to something in the five digit like 55555. using default is very insecure

  2. Forward your port SSH port to your Unix Box. I take it that would be the new static local IP you have from Step 1

2
  • well, now, DynDNS is paid, and my router (Netgear 3000 NAS100) does not support any other DDNS provider (like No-IP) I need to change the router or buy the DynDNS subscription. Is there any other (free) way? I really appreciate your help. Commented Mar 28, 2016 at 18:14
  • Flash Netgear 3000 with DD-WRT, this is the one i use it support noip and many others
    – SeanClt
    Commented Mar 28, 2016 at 18:18

You must log in to answer this question.

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