More guides can be found here:
- https://community.hetzner.com/tutorials/linux-setup-gre-tunnel
- https://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.tunnel.gre.html
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 LOCAL=123.123.123.123 #Origin IP REMOTE=205.220.230.49 #GRE Tunnel Endpoint IP Address NET=10.10.56.0/30 #Private Network Address/30 IP=10.10.56.1 #Private Origin Side Private IP Address IP_REMOTE=10.10.56.2 #Private Tunnel Side Private IP Address IP_INTERNET=168.100.15.1/32 #Lectron Tunnel Usable IP Address/32 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 addr add $IP_INTERNET 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 } 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 down
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
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>
makesure you added proper filters and firewalls for the game/application are you are running in lectron tunnel dashboard under Filters and Firewalls.