Installing TURN server

Pierre St Juste edited this page Jul 6, 2014 · 11 revisions

Sometimes SocialVPN nodes cannot connect because of crazy NATs (i.e. symmetric) or strict firewalls. In such cases, we rely on relaying. This page shows you how to run a TURN relay in the cloud. We are currently using the following TURN implementation. TURN servers require a public IP address.

These instructions have only been tested on Ubuntu 12.04 (64-bit).

Download TURN server

  1. Install TURN implementation dependencies

    sudo apt-get update
    sudo apt-get install libconfuse0
  2. If you are running on the cloud (e.g. EC2), you need to use IP aliasing to allow the TURN server to bind your public IP address

    sudo ifconfig eth0:0 <public-ip-of-vm> up
  3. Download and extract pre-packaged TURN binaries

    wget -O turn.tgz http://goo.gl/EMzy9Z
    tar xzvf turn.tgz

Configure and run TURN server

  1. Update the TURN config file with the public IP address

    sed -i 's/listen_address = .*/listen_address = { "public-ip-address" }/g' turn/turn.conf
  2. (Optional) Update turn.conf to increase number of sessions per users

    vi turn/turn.conf
    
    ## Max relay per username.
    max_relay_per_username = 100000
    
    ## Allocation lifetime.
    allocation_lifetime = 720000
  3. (Optional) Increase file descriptor limit to allow for thousands of TURN connections by adding following to /etc/security/limits.conf file. Be sure to log out and log back in for changes to take effect.

    ubuntu    hard    nofile    100000
    ubuntu    soft    nofile    100000
    
  4. Run the TURN server

    cd turn; ./turnserver -c turn.conf; cd ..
  5. Verify TURN server is running

    netstat -aupn | grep 19302

Configure SocialVPN/GroupVPN

  1. Update your config.json file with your TURN settings, see below for template

    {
        "ip4": "172.31.0.100",
        "xmpp_username": "ipopuser@ejabberd",
        "xmpp_password": "password",
        "xmpp_host": "public-ip-of-ejabberd-server",
        "stun": ["public-ip-of-your-vm:19302"],
        "turn": [
            {"server": "public-ip-of-your-vm:19302", "user": "svpnjingle", "pass": "1234567890"}
        ]
    }
    
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.