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

DEV=LectronTunnel #can change name to lectron-GRE-tunnel or any name you want
LOCAL= #your origin server IP address - Use the public IP address that you received from your hosting provider
REMOTE= #DO NOT CHANGE THIS - This is Lectron Netflow endpoint
IP= #Use the Private Origin Side Private IP Address that we give you
IP_REMOTE= #Use the Private Tunnel Side Private IP Address that we give you
NET= #Use the Private Network Address with subnet /30 that we give you
IP_INTERNET= #Use one of any of Lectron Tunnel Usable IP Address that we give you
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 via $IP_REMOTE table 139
ip rule add from $IP_INTERNET table 139
ip address add $IP_INTERNET dev $DEV
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
 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 up

To test, use the following services:

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

if the server got a ping then it’s good

Leave a Reply

Your email address will not be published.