Lectron Tunnel Setup for Ubuntu 20.04 or higher

More guides can be found here:

Lectron Tunnel uses GRE tunneling protocol.

Generic Routing Encapsulation (GRE) is a tunneling protocol developed by Cisco Systems which can encapsulate a wide variety of network layer protocols inside virtual point-to-point links or point-to-multipoint links over an Internet Protocol network.

This is where you can go to create your tunnel: https://dashboard.lectron.com/tunnels

Afterwards, you can follow the steps below to connect your server to Lectron Tunnel

Step 1 – Module loading #

For setting up a GRE tunnel on Linux you must have ip_gre module loaded in your linux kernel. To make sure it’s loaded just do:

sudo modprobe ip_gre
lsmod | grep gre

And you should see the result similar to what’s showing below:

ip_gre                 #####  0
gre                    #####  1 ip_gre

Step 2 – Tunnel setup #

You will create a script file, let’s call it script.sh

Do the following command to open a script file

nano script.sh

then, enter the following script content below into your script file

      LOCAL=           #Origin IP
      REMOTE=           #GRE Tunnel Endpoint IP Address
      NET=               #Private Network Address/30
      IP=                   #Private Origin Side Private IP Address
      IP_REMOTE=             #Private Tunnel Side Private IP Address
      IP_INTERNET=      #Lectron Tunnel Usable IP Address/32
      ip tunnel add $DEV mode gre remote $REMOTE local $LOCAL ttl 255
      ip link set $DEV up
      ip addr add $IP dev $DEV
      ip addr add $IP_INTERNET dev $DEV
      ip route add $NET dev $DEV
      ip route add via  $IP_REMOTE table 139
      ip rule add from  $IP_INTERNET table 139
      ip route del via $IP_REMOTE table 139
      ip rule del from $IP_INTERNET table 139
      ip link set $DEV down
      ip tunnel del $DEV
      case "$1" in
          up) up ;;
          down) down ;;
          *) echo "gre [up|down]" ;;

then, save the file.

Then, you can run the Tunnel by doing:

sh script.sh up

if you need to turn off the Tunnel for any reason, type the command below

sh script.sh down

To test, use the following services:

  • ping.pe/{your tunneled IP address such as}

if the server got a ping then it’s good

Delete a Tunnel #

ifconfig (or ip a in Debian)

ip tunnel show ( show the tunnels currently running )

sudo ip link set <tunnel name> down

sudo ip tunnel del <tunnel name>

Ensure you added proper filters and firewalls for the game/application if you are running in the lectron tunnel dashboard under Filters and Firewalls.

Leave a Reply

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