I decided to see if I could get a VPN connection working between my laptop (running MacOSX) and my home server running Solaris 10. It turned out to be pretty easy to do a simple config. I am using OpenVPN. To compile the software on my Solaris box I needed to download 3 items:
- Virtual Point-to-Point (Tun) and Ethernet (TAP) devices driver. I got the version 1.1 from http://vtun.sourceforge.net/tun/ in source code form.
- LZO version 1.08 compression software from : http://www.oberhumer.com/opensource/lzo/download/LZO-v1/
- OpenVPN software, I am using the version 2.1RC because I wanted the version to match what I am going to run on the Mac. It can be downloaded from http://openvpn.net/index.php/open-source/downloads.html
Once I got everything downloaded, just compile the LZO, Tun, and OpenVPN:
I decided to have everything related to the vpn installed in /opt/vpn. One thing to note, I tried using the new version 2.x of LZO, and OpenVPN would not find it, so I had to use Version 1 even though 2 is supposed to be supported. So I did the following to compile LZO:
gzip -d lzo-1.08.tar.gz tar -xvf lzo-1.08.tar cd lzo-1.08 ./configure --prefix=/opt/vpn/lzo make sudo make install
Next was to compile TUN
gzip -d tun-1.1.tar tar -xvf tun-1.1.tar cd tun-1.1 ./configure --prefix=/opt/vpn/tun make sudo make install
Only issue with tun was that it did not use the –prefix, it puts everything where it needs to be in /usr/kernel/drv on solaris.
Next is openvpn:
gzip -d openvpn-2.1_rc19.tar.gz tar -xvf openvpn-2.1_rc19.tar cd openvpn-2.1_rc19 ./configure --prefix=/opt/vpn/openvpn --with-lzo-headers=/opt/vpn/lzo/include --with-lzo-lib=/opt/vpn/lzo/lib make sudo make install
Once that is installed I did the simple 1 to 1 vpn connection (static key) for just testing to see if it would work. So in the /opt/vpn/openvpn/sbin directory I did this:
cd /opt/vpn/openvpn/sbin ./openvpn --genkey --secret static.key
I then copy that key to my client via some “secure” means
Then created a server.conf that looks like this:
dev tun ifconfig 10.8.0.1 10.8.0.2 secret static.key cipher AES-256-CBC keepalive 10 120
On my client (MacOSX) I downloaded Tunnelblick from http://code.google.com/p/tunnelblick/downloads/list and installed it. Next I copied that static.key from the server to the client and put it in ~/Library/openvpn. I also created a openvpn.conf in that directory that looked like this:
remote a.b.c.d dev tun ifconfig 10.8.0.2 10.8.0.1 secret static.key cipher AES-256-CBC route 10.0.0.0 255.255.255.0
In the above, a.b.c.d represents my public IP address for my solaris server.
Now when you start tunnelblick it will search that directory and find that config file and ask if you want to load it. But we are not quite ready to start yet. The next thing I had to do was forward port 1194 UDP off of my router to my OpenVPN server. I will leave this exercise to you. You will also need to make sure IP forwarding is enabled on the Solaris 10 server (because I only have 1 network card in it, but “two” different networks on the box. IP Forwarding will allow your remote machine to be able to see your local network. And since my OpenVPN server is not the router for the entire network, I had to add a static route on my router to say that 10.8.0.0 is available via the openvpn servers local network address, I.e. 10.0.0.1.
You should be able to start the openvpn server now:
/opt/vpn/openvpn/sbin/openvpn server.conf
Once it is started you can use tunnelblick to connect. Once you are connected, you should see that is is connected and the icon has changed from this:
to look like this:
You should also see a tun0 device show up:
ifconfig tun0 tun0: flags=8851 < up ,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST > mtu 1500 inet 10.8.0.2 --> 10.8.0.1 netmask 0xffffffff open (pid 608)
You should now be able to see all your hosts on the “remote” network. Next up I am going to work on doing the pki infrastructure so I can hopefully link other clients both static and dynamic.
This make is really nice to be able to see your “home” network while you are away.