A few months ago, I bought and assembled a computer and some disk drives to create a home NAS device. My home storage was out of control, so the FreeNAS solution has been wonderful. I am still in the process of organizing all of my files making sure that I only have one copy of my files, but that is for another post. Actually, that would be boring.

When building a robust NAS solution at home, the first thing I wanted to do is to be able to access it from outside my home network. I have chosen to use noip to provide dynamic DNS access, which works wonderfully for apps like Plex. However, when I am at work, I am not able to reap the benefits of a dynamic IP service. I have resorted to using my ssh-config to provide home access while I am work, and I have been happy surprised at the benefits of using a ssh-config. For the rest of this post, I would like to demonstrate how I access my home git service.

Without getting too much into the weeds, allow me to explain my home network. It it quite simple. I have one FreeNAS server that has several jails configured. One of the jails provide git services using gitolite which allows robust management of keys and permissions to git repositories.

I only have one IP, and it is a dynamically assigned IP. It does not change very often, so I am using that to my advantage. My home router is an Apple Airport Extreme, which is able to do port mapping. On my local network, my git repositories are served from 10.0.1.201. It is using the standard ssh port of 22. I have configured my Apple Airport Extreme to map an external port of 2022 to my local port of 10.0.1.201:22.

On my laptop, I have the following ssh-config file. The configuration should be located at ~/.ssh/config. The IP is fake, FWIW.

Host git-remote
  HostName 97.97.97.97
  Port 2022
  User git

Host git-home
  HostName 10.0.1.201
  User git

This configuration shows that when I am at home, I can use my git-home host, and when I am remote, I can use my git-remote host. Where did those names come from? The neat this is that I made them up. At this point, if I am at work, and I wanted to clone this website's git repo, I would use the following command.

git clone git@git-remote:greghewett.com.git

git-remote does not resolve outside of the use of ssh, so I would not be able to use it in my web browser. When the IP changes, it is not very hard to go to noip and figure out what the IP has changed to and update my ssh-config.

Recently, I discovered that Transmit will also use the ssh-config, which allows me to change the IP address in one place to affect not only my git repositories, but also my Transmit server configurations. Below, you can see the access to my home developer service, which is just a FreeNAS jail that has all of the developer bells and whistles installed.

Transmit Screenshot