DynDNS plus SSH = Awesome

My desktop computer sits at my house. I, however, am usually roving around Ann Arbor with my laptop. I would love to be able to SSH into my desktop computer from my laptop computer wherever I go, but my ISP gives me a dynamic IP address, and I’m not inclined to keep track of its changes. Luckily, I figured out a way to ssh into my desktop while I roam around my city, even if my ISP decides to spuriously change my external IP address. Here’s how I did it.

  1. Sign up for a free account from dyndns.org.
    This is a pretty cool service that assigns you a publicly accessible dns name and then makes sure it is bound to your dynamic IP address that you ISP gives you. My blind guess on how this works is that your router talks to the dyndns servers and constantly associates the DNS name they give you to what your router reports its external IP to be. Thats just a guess though. 😀 Once you sign up, and choose one of the DNS names they give to you, save all that info for step 2
  2. Configure your router
    First of all, I have a D-Link router at my house, which has a built in configuration screen for dyndns services. I hope other brands of routers have similiar configuration options, but basically I just put in the information dyndns.org gave me into the router’s configuration screen, and saved it. I also forwarded the port I use for SSH to my desktop. I’m assuming you have many devices hooked up to your router, so find a way to forward your ssh port directly to the IP address that your desktop is using. I advise setting up a static IP address for your desktop when you’re doing this. Each router is different, so poke around until you have the port you use for SSH forwarded to your desktop.
  3. Configure your computer for SSH. This depends on what distro you’re using, but get sshd up and running. For Arch linux, running
     sudo pacman -Sy openssh && /etc/rc.d/sshd start

    will get you up and running with a default configuration. For Ubuntu systems, running

     sudo apt-get install openssh-server && /etc/init.d/ssh start

    should get you going. I advise changing the port number the SSH daemon looks for connections on by modifying the “Port” field in /etc/ssh/ssh_config. This number should match the port you forwarded in the previous step.

  4. Test it out!
     ssh username@example.homelinux.org -p $PORT_NUM

    (replace username, example.homelinux.org, and $PORT_NUM appropriately, of course) If that works, then you can ssh into to your desktop computer wherever you happen to be in the world! Sweet.

I really like this service and hope you can find a way to use it to great effect. Remember, this setup is probably not feasible for setting up a real webserver, residential upload speed is usually pretty sucky. Its great though if you need to pull some howework you forgot on your desktop, or access your files while you’re on the go 😀

This entry was posted in Open Source, Ubuntu. Bookmark the permalink.

4 Responses to DynDNS plus SSH = Awesome

  1. joshp says:

    I, too have been using dyndns for my dns needs (being on comcast and not willing to shell out the extra bucks for a static ip). I recently switched to open dns when i bought my own domain name, but still use dyndns to webhop the previous domain example.homelinux.com to my new addy newexample.com…which i find awesome.
    I also recently discovered the wonders of ssh, which is VERY handy when I am at my school (EMU) on my EeePC. I also make fun use of aMpache so that I don’t need to have ANY of my music files actually on my lapop so long as there is an internet connection where I am, and the wireless washtenaw project takes care of that nicely in downtown ann arbor (and I can also tether my cell phone as a modem to ALWAYS have internet if I want).
    Dynamic DNS services are simply awesome, I agree.:D

  2. Christopher says:

    Dynamic DNS is pretty cool! I just fiqured this out last week, and I use port forwarding to gain access to a number of computers and services on my network.

    I was also considering trying to set up tunnelling or VPN or something like that, so I could have a more unrestricted access to my LAN.

    I think that, at least initially, you could use this set up to run a personal webserver (say, for a personal website). However, you might want to set up some kind of traffic shaping system so that your personal traffic always took precedence over that of your webserver. But, of course, if your website ever became well-known you’d have to switch to some other arrangement.

    I’d think there would be plenty of bandwidth to run your own mail server. Though, if you went that route, you might want to use a paid dynamic dns service. From what I understand, if your router or client program fails to communicate with dyndns.org for over thirty days, then you lose your account. (I could see this happening to someone who went on vacation and turned their equipment off.)

  3. scap says:

    Unless your ISP blocks ssh, which I haven’t heard of any that do, why would you want to change the port number. It buys you nothing really. If someone searches for your computer and sees you running something on an obscure port if they telnet to it ssh is nice enough to say…

    SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2

    So immediately anyone can figure out it is ssh.

  4. Kevin says:

    True, but using a nonstandard port is likely to stop simple bot attacks, so in my book, its worth it if only for that reason.

Leave a Reply

Your email address will not be published. Required fields are marked *