Set up VPN within 15 minutes

VPN, virtual private network, can be translated as internal virtual network. You may wonder, already in the intranet, is it still virtual? Remote business users use a VPN to connect to running services or programs that can be used as if they were sitting in the office. That's the reason for the virtual name.

VPN, virtual private network, can be translated as internal virtual network. You may wonder, already in the intranet, is it still virtual? Remote business users use a VPN to connect to running services or programs that can be used as if they were sitting in the office. That's the reason for the virtual name. VPN can also be used with wireless networks or between two (or more) different locations.

This article will not make you sleepy with so many different types of VPNs and protocols (pptp, l2tp, ipsec, gre, mpls) that will go straight to how to set up internal virtual networks using OpenVPN.

OpenVPN uses tun / tap devices (mostly available on Linux versions) and openssl to authenticate (authenticate), encrypt (when sending) and decode (when receiving) the connection between the two parties into a single network. This means when the user connects
Remote OpenVPN server, they can use services such as file sharing using Samba / NFS / FTP / SCP, read mail (by
How to declare the internal address on their computer, for example, 192.168.1.1), browse intranet, use other software.v.v.as they are sitting in the office.

Why should users use OpenVPN without using FreeS / WAN (using ipsec) or PoPToP (using pptp)? Because setting up VPN using these programs is relatively troublesome, or having problems with workstations that use NAT, users or are bound / restricted with some software to connect to the server from many different operating systems.v.v .

With OpenVPN you don't have to worry about NAT traversal, it's easy to set up and can run on many different operating systems like * BSD, Linux, Mac OS X, Solaris and Windows 2000 and above.

Installing OpenVPN is quite simple. It is most likely available on the Linux version you are using. If not, you can download it from the OpenVPN website. The current beta version is 2.0 beta15. The current stable version is 1.6.0.

The example below will show you how to set up a VPN in two different modes: Use the device with a static key and use the tun device with TLS-based to set up a connection between the two computers or a server and multiple workstations.

Use a key

On a Linux machine

a. Load tun device : modprobe tun

b. Adjust firewall to allow UDP connection (or TCP) port 5000 : iptables -A INPUT -p UDP --dport 5000 -j ACCEPT

c. Tuning the firewall allows the tun device to go back and forth :
iptables -A INPUT -i tun + -j ACCEPT
iptables -A FORWARD -i tun + -j ACCEPT

d. Key grinding : openvpn --genkey --secret chiakhoa

e. Run OpenVPN : openvpn --dev tun0 --ifconfig 10.4.0.1 10.4.0.2 --verb 5 --secret sharekhoa

f. Copy the file onto a floppy disk or scp it over the machine you want to connect to the Linux machine from --verb 5, which means you want to see what openvpn is doing on the screen. If you don't want to see it, don't use --verb 5

On a Windows machine

a. Download OpenVPN for Windows from the OpenVPN website

After installing OpenVPN software, you will see in the Control Panel -> Network Connections section, a device is available with the name TAP-Win32 Adapter. If you do not see the installation, it is a problem.

Set up VPN within 15 minutes Picture 1Set up VPN within 15 minutes Picture 1

b. Start VPN :

Select Start -> Run, type cmd to open the command prompt window.
Type cd pro * openvpn
Type openvpn.exe --remote local_chỉ_máy_Linux --dev tun0 --ifconfig 10.4.0.2 10.4.0.1 --verb 5 --secret sharekhoa

chiakhoa is the split file you create from the Linux machine above

c. Accomplished

So how do you know if the VPN is working?

On Windows machines, type ping 10.4.0.1

You will see the Linux machine responding to the pong pong screen. Or you will see the same screen below after running openvpn

Set up VPN within 15 minutes Picture 2Set up VPN within 15 minutes Picture 2

On Linux machines, type ping 10.4.0.2

You will see the Windows machine responding to the pong pong screen. Or you will see the same screen below after running the openvpn command.

Set up VPN within 15 minutes Picture 3Set up VPN within 15 minutes Picture 3

Larry ( According to Vnlinux )

5 ★ | 1 Vote