You are here:Home > Best VPN > Building a VPN with Linux

Building a VPN with Linux

Summary:The experimental scenario allows remote computers to access the intranet by configuring a VPN server on Linux.My purpose:Now we need to develop third-…
horizonVPN Official website sandVPN Official website VPNhood Official website hailianVPN Official website
GoduckVPN Official website Fast Wind VPN Official website Fast Orange VPN Official website(Recommend) NetShekanVPN Official website

This book is available as an e-book in EPUB format

PayPal sponsors this website for any amount. I will send you an EPUB e-book via email. Please send me an email

Email: shuxueha@outlook.com

PayPal: https://paypal.me/zhipinglei

You can also scan the PayPal QR code below to sponsor

You can also purchase this book on Amazon: click to enter the Amazon official website

The experimental scenario allows remote computers to access the intranet by configuring a VPN server on Linux.

My purpose:

Now we need to develop third-party interfaces, which have server IP address authentication configurations. This means that programs developed locally need to be released to the server for testing every time. If it is during the debugging process, it can be troublesome every time. Therefore, it is necessary to be able to directly dial to this server through VPN, and then the local system can be developed and debugged directly.

1、 Download and install VPN service

1. Download the required installation package

Input: wget http://poptop.sourceforge.net/yum/stable/packages/dkms-2.0.17.5-1.noarch.rpm

Input: wget http://poptop.sourceforge.net/yum/stable/packages/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm

Input: http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm

Because the official package above often undergoes upgrades and changes, if it cannot be downloaded, it will be updated according to its name http://poptop.sourceforge.net/yum/stable/packages/ Download

2. Install sequentially

Install gcc, which is a C compilation library (if the server already has it, there is no need to install it)

yum -install gcc

If the server is configured with yum, refer to my other blog for configuration, or search for information online to configure yum.

● Install dkms-2.017.5-1. noarch.rpm

rpm -ivh dkms-2.0.17.5-1.noarch.rpm

● Install kernel_ppp_cppe-1.0.2-3dkms.noarch.rpm

rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm

● Install pptpd-1.3.4-2. rhel5. x86_64.rpm

rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm

2、 Configure VPN server

1. Configure the main configuration file

vi /etc/pptpd.conf

Add content at the end:

debug

ppp /usr/sbin/pppd

option /etc/ppp/options.pptpd

localip 117.34.78.222

remoteip 192.168.0.2-4

2. Configure account file

vi /etc/ppp/chap-secrets

The editing content is (the * symbol in the IP represents all):

# Secrets for authentication using CHAP

# client        server  secret                  IP addresses

Username pptpd Password*

Username pptpd Password 192.168.0.3

Username pptpd Password 192.168.0.4

3. Start service

service pptpd start

4. View port PPTP listening on port 1723

netstat -ntpl

5. Set NAT and enable Linux kernel routing function

Execute the following commands in sequence:

iptables -t nat -F

iptables -t nat -A POSTROUTING -s 192.168.0.2/24 -j SNAT –to 117.34.78.222

echo 1 > /proc/sys/net/ipv4/ip_forward

6. Configure VPN auto start

Execute command: ntsysv

7. Set up iptables to allow VPN connections (or disable firewall)

Execute the commands in sequence:

iptables -I INPUT -p tcp –dport 1723 -j ACCEPT

iptables -I INPUT -p tcp –dport 47 -j ACCEPT

iptables -I INPUT -p gre -j ACCEPT

3、 Use VPN client to access

The server IP address is 117.34.78.22 that we configured above, and the account and password are also set in the configuration file (the part I changed with red correction fluid above, you can configure it yourself)

I won't go into detail about how to dial up and connect to VPN in Win7 here.


High-speed VPN Fast VPN Preferred Accelerator VPN Reliable VPN
High quality VPN Old fashioned VPN Stable VPN(Recommend) Smooth VPN
Share with Friends: