Hello, welcome to NETVN channel
In this video I would like to introduce how to route VPN on Raspberry PI so that you can access the internal network from the internet
On hand I have a Raspberry Pi 3 and a memory card 16GB
I will install Zerotier on it and route VPN
First you install the operating system for the Raspberry Pi, there are several operating system options for it
You can use Raspbian or Ubuntu
In this case I choose to install Ubuntu OS for Raspberry Pi
You go to the Ubuntu homepage and download the OS image for the Raspberry Pi
After obtaining the operating system image file, you use specialized software for Raspberry Pi to write it to the SD Card
You pay attention to enable SSH for Raspberry Pi to be able to access it over the network
You write down your username and password to use in the next step
Then you wait patiently for a few minutes to complete
And here is the SD card with Ubuntu installed for Raspberry Pi
I plugged it into the Raspberry Pi
Next you connect your Raspberry Pi to the internet using a network cable or wifi
To set up Raspberry Pi over the network I use a Windows computer on the same local network
Because I don't know the ip address of the Raspberry Pi so I use an ip address scanner software
After scanning I know it has an ip address of 192.168.1.67
I will use this ip address and the username and password set up in the previous step to remotely access the Raspberry Pi over the network
You open a command window and use the command ssh username @ ip address to access over the intranet
Before setting up vpn for Raspberry Pi, update the operating system for it
The VPN service I use in this video is Zerotier and you only need a free account for this
Here I have prepared a free Zerotier account to set up a vpn network
I login to Zerotier and create a new vpn network
I then named it netvn network, this is a vpn network that helps me access the intranet from outside the internet
To do so, you can refer to the instructions from Zerotier's homepage
This vpn service helps you to route between physical network and vpn network to access local network resources from internet
You can access servers, printers, file sharing and more
NNow you install Zerotier on Raspberry Pi running Ubuntu operating system
You copy and paste this command to install Zerotier
Zerotier can be installed on various operating systems like Windows, macOS, Linux, Android and even on NAS
Next you set up Raspberry Pi to join the newly created vpn network with this command
You update the vpn network identifier to complete the command
Raspberry Pi needs administrator permission to join this vpn network
Here I allowed it to join the vpn network called netvn and found it online
This command will tell you information about vpn connection such as ip address, network interface name
So Raspberry Pi has joined the vpn network I just created called netvn
Next you set up vpn network routing
First of all you need to determine the network ip address range you are using, so you open a command window and use the ipconfig command to find out.
As here my subnet is 192.168.1.0/24
I will route so that computers outside the internet can access this internal network through Raspberry Pi as above
You replace 24 with 23 to avoid unexpected access error
Devices such as computers or phones access the local network through the ip address of the Raspberry Pi provided by Zerotier
On Raspberry Pi you set up port forwarding between two network interfaces
Specifically you forward the port between the physical network interface and the Zerotier network interface
Default port forwarding on Ubuntu OS is disabled so I enabled it by editing the sysctl.conf file
Just uncomment the net.ipv4-ip.forward line and save your changes
After editing the file you use the command to enable port forwarding
You can stop for a moment to find yourself a t-shirt below the video or click like and subscribe
After finding your t-shirt, continue forwarding the port between the two network interfaces with the above three commands
To do so, you need to specify the names of the network interfaces on the Raspberry Pi
So you install the network tool to display information about its network interfaces
After installation you use the ifconfig command to display information, you only need to care about the physical network interface name and the zerotier network interface name
Once you have the network interface names you use it to edit the three commands as above
I will edit the physical network interface name first
I then edit the Zerotier vpn network interface name
And here are the 3 edited commands, just copy and paste it into the command window
With these 3 commands you have forwarded the port between two physical network interfaces and vpn
The last two commands help you save the settings to avoid the Raspberry Pi rebooting
So I've finished setting up Zerotier routing on Raspberry Pi
Now I will check if it works or not
So I use a laptop from outside the internet to access the intranet using Zerotier
On this laptop I install Zerotier client and join the vpn network
To join a vpn network called netvn, I need to enter its exact network identifier
After correctly entering the network identifier, this laptop needs the permission of the vpn network administrator account named netvn
On the management page I allowed the laptop to join this vpn network and found that both devices are online and belong to two different internet networks based on the public ip address
On the laptop I will try to test the connection to the intranet using the ping command
With the ping command I know that I have successfully connected to the local network so Raspberry Pi works fine with Zerotier
Thanks for watching, don't forget to like and subscribe
From laptop I can access shared folder over internet thanks to Zerotier's help