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

#!/bin/bash
DEV=LectronTunnel #can change name to lectron-GRE-tunnel or any name you want
LOCAL=139.99.28.9 #your origin server IP address - Use the public IP address that you received from your hosting provider
REMOTE=205.220.230.49 #DO NOT CHANGE THIS - This is Lectron Netflow endpoint
IP=10.10.56.1 #Use the Private Origin Side Private IP Address that we give you
IP_REMOTE=10.10.56.2 #Use the Private Tunnel Side Private IP Address that we give you
NET=10.10.56.0/30 #Use the Private Network Address with subnet /30 that we give you
IP_INTERNET=168.100.15.0/32 #Use one of any of Lectron Tunnel Usable IP Address that we give you
up(){
ip tunnel add $DEV mode gre remote $REMOTE local $LOCAL ttl 255
ip link set $DEV up
ip addr add $IP dev $DEV
ip route add $NET dev $DEV
ip route add 0.0.0.0/0 via $IP_REMOTE table 139
ip rule add from $IP_INTERNET table 139
ip address add $IP_INTERNET dev $DEV
}
down(){
ip route del 0.0.0.0/0 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]"
 ;;
esac

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 up

To test, use the following services:

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

if the server got a ping then it’s good

Leave a Reply

Your email address will not be published.