Vpn with Nokia N900 and Fritzbox

This is an small tutorial to connect your Nokia N900 phone with you network at home or work with an secure VPN connection. Very handy for printing at home, accessing you nas or where i´m using it alot for, Remote desktop from your N900. As VPN server i wanted to use my Fritzbox because it´s already there to communicate with the rest of the world.
The build in VPN functionality of the Fritzbox was not compatible with the OpenVpn that was used on the N900, so OpenVpn was also needed on the Fritzbox.

To begin with i have used this article. The author used it to connect 2 Fritzbox together.
Using this tutorial requires some basic knowledge of Linux, but if you have the N900 then you´re have else you have an iphone.Smile and Steve Jobs determine what you’re doing with it.
First of all some warnings, you can really mess up your N900 or Fritzbox or even delete the whole Internet. Don´t blame me, i´m just some nerd that´s typing this tutorial for you.

Tested it with Fritzbox 7170 with firmware version 58.04.74, Nokia N900 version 3.2010.02.

  1. First we need to download and install OpenVpn and OpenVpn Applet on the N900. The both can be found in the extra-devel repository.
  2. On the Fritzbox we must enable Telnet, this can be done by dialing on the land-line phone connected to the Fritzbox #96*7*
    You can now make an telnet connection with your favourite program to the Frtizbox. The password is the same as for the web interface of the Fritzbox.
  3. The Fritzbox has not enough internal storage to store the Openvpn program. To overcome this problem we use an usb-stick(or external hdd). Make on your usb-stick the subdirectoy vpn. You van do this in your (windows) pc. Keep in mind that we are working with Linux so everything is case sensitive.
  4. Lets make the necessary script and configuration files, or if you really lazy download them. And place the in the correct maps.
    Debug.cfg (Place in the root of the Usb-stick)
    mkdir /var/usb
    mount /dev/sda1 /var/usb
    /var/usb/startup.sh
    startup.sh (Place in the root of the Usb-stick)
    echo Starting telnetd
    /usr/sbin/telnetd -l /sbin/ar7login
    # wait until the DSL connection is establist
    echo Waiting for internet connection
    while !(ping -c 1 www.google.com); do
    sleep 5
    done
    # tun-Device creating if not available yet
    echo Creating TUN device
    mknod /var/tmp/tun c 10 200
    # start OpenVPN
    echo Starting OpenVPN
    cd /var/usb/vpn
    ./openvpn –config Server.ovpn –daemon

    Server.ovpn (Place in the vpn map on the Usb-stick)
    dev tun0
    dev-node /var/tmp/tun
    ifconfig 10.8.0.1 10.8.0.2
    secret /var/usb/vpn/static.key
    keepalive 10 60
    Client.ovpn (Place in the Mydoc directory or sd-card of your N900)
    remote Your.Domain.name
    dev tun
    ifconfig 10.8.0.2 10.8.0.1
    secret static.key
    keepalive 10 60
    ping-timer-rem
    persist-tun
    persist-key
    #route must be in the same subnet as your network
    route 192.168.1.0 255.255.255.0

  5. Download openvpn for your Fritzbox,  unzip it and place the contens on your usb stick in the vpn directory. Place now the usb-stick in your FritzBox.
  6. Now lets mount the usb-stick ;
    mkdir /var/usb
    mount /dev/sda1 /var/usb
    And copy the debug.cfg to the flash directory so that the debug.cfg will executed during the next reboot;
    cat /var/usb/debug.cfg > /var/flash/debug.cfg
  7. Lets make now the key file needed for the vpn connection;
    cd /var/usb/vpn
    ./openvpn --genkey --secret static.key

    Copy this key also to you N900  in the same directory as you used in step 4.
    You need the key to make an secure connection, but it’s a key so don’t lose it.
  8. We need also forward the vpn udp port 1194 to the Fritzbox himself. Fritz doesn’t allow this using the webinterface, so we must do it by hand using nvi (works the same as vi).
    Now where are gone editing the config file of the Fritzbox becarefull you can mess it really up now!
    cd /var/flash
    nvi ar7.cfg
    Find now the section that’s named  forwardrules = if you have already some ports forwarded you see them here also.
    There are multiply forwardrules, but there’s only one that is named only forwardrules. If you doubt, make an dummy port forwarding in the webinterface and search for that one.
    Now add the following line to the section
    "udp 0.0.0.0:1194 0.0.0.0:1194 0 # OpenVPN",
    Don’t forget the comma at the end and save the file. If it’s the last entry the comma should be an ;
  9. Settings should be finished now, lets reboot the Fritzbox by typing reboot.
    After reboot login again with telnet and check if Openvpn is running by typing ps.
    You should see a process running that called openvpn, for example;
    654 root       1600 S   ./openvpn –config Server.ovpn –daemon
    If not try rebooting again or you (or me) has made an mistake in the previous 8 steps.
  10. Final we need configure the settings on the Nokia N900. That’s very easy to do, tap in the status bar on the Openvpn button and choose manage connections.
    Choose new and then select for the configuration file Client.ovpn that we made in step 4. For key file you take the static.key file that we created in step 7.
    Press import to finish. You can use the test button to test the connection. There’s a lot info on the test screen, but when the connection is successfully the last 2 lines are Peer connection initiated withYourIp and Initialization Completed.
  11. It’s ready to be used now!
    Bear in mind that 90% of all connection problems encountered by OpenVPN users are firewall/port forwarding related.For more info about OpenVpn just click