Guide to Setting up VPN Server under Linux
Summary:After half a day of dismantling, the VPN server has finally been fixed. The process is now announced for everyone's reference1、 Configure environm…
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
After half a day of dismantling, the VPN server has finally been fixed. The process is now announced for everyone's reference
1、 Configure environment
Linux(2.6.7)(FC2)
eth0: 1Array2.168.1.8
Eth0:1 1Array2.168.0.1 (manually added)
2、 Required software
1. Kernel_ppp_cppe-0.0.4-2dkms.noarch.rpm (MPPE kernel patch)
2. Dkms-1.21-1.noarch.rpm (upgrade dkms)
3. Pptpd-1.2.1.tar.gz (pptpd service software)
Note: The system must have PPP services installed, otherwise they must be installed separately
3、 Install software
1. First, install dkms
Rpm Uvh dkms 1.12-1. noarch.rpm (upgrade installation)
2. Install MPPE
rpm -Uvh kernel_ppp_mppe-0.0.4-2dkms.noarch.rpm
3. Install pptpd
tar -vxzf pptpd-1.2.1.tar.gz
cd pptpd-1.2.1
./configure
make
make install
Installation completed, now start configuring
4、 Configure server
Convert the files under pptpd-1.2.1/samples/
Copy pptpd.conf to/etc
Copy Chap secrets to/etc/ppp
Copy options.pptpd to/etc/ppp
Modify pptpd.conf file:
ppp /usr/sbin/pppd
Specify PPP service program
option /etc/ppp/options.pptpd
Specify option configuration
localip 1Array2.168.1.8
Specify local IP address
remoteip 1Array2.168.0.10-245
Specify the assigned remote IP address
netmask 255.255.255.0
Specify subnet mask
Modify the/etc/ppp/options.pptpd file
name pptpd
auth
require-chap
-chap
-mschap
+mschap-v2
require-mppe
lcp-echo-failure 30
lcp-echo-interval 5
ipcp-accept-local
ipcp-accept-remote
multilink
proxyarp
logfd 2
logfile /var/log/pptpd.log
debug
dump
lock
Modify/etc/ppp/Chap secrets file
# client server secret IP addresses
#username pptpd password *
“xinhe” pptpd “xinhe” *
This is the user account for configuring VPN
Start service:
/usr/local/sbin/pptpd
Then use Netstat to check if port 1723 is open. If so, it indicates that the service has been successfully started.
Find a Windows machine with IP address 1Array2.166.1.7, create a new VPN connection, server 1Array2.168.1.8, username: xinhe, password: xinhe, you can successfully connect.
Run under cmd on Windows: ipconfig
I saw an additional network connection with IP address 1Array2.168.0.10, which is exactly the remote IP set in the configuration file. As a result, this Windows client successfully connected to this VPN server
But there is a problem here. Originally, this Windows machine could access the internet through gateway 1Array2.168.1.1, but after connecting to a VPN, it cannot access the internet. Because all the data has been uploaded to the VPN server, to solve this problem, we can use iptables to forward the data.
Create a new iptables file with the following content:
echo 1 > /proc/sys/net/ipv4/ip_forward
echo “clear the iptables rules”
/etc/init.d/iptables stop
/sbin/iptables -A INPUT -p icmp -j DROP
/sbin/iptables -t nat -A POSTROUTING -s 1Array2.168.1.0/24 -j MASQUERADE
/sbin/iptables -F FORWARD
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -t nat -A POSTROUTING -j MASQUERADE
/sbin/iptables -F FORWARD
/sbin/iptables -A FORWARD -p udp -s 1Array2.168.1.0/24 –dport 53 -j ACCEPT
/sbin/iptables -A FORWARD -p tcp -s 1Array2.168.1.0/24 –dport 1723 -j ACCEPT
/sbin/iptables -A FORWARD -p gre -s 1Array2.168.1.0/24 -j ACCEPT
/sbin/iptables -A FORWARD -m state –state ESTABLISHED,RELATED -j ACCEPT
Then execute this iptables file, OK, the Windows client can now access the internet
| High-speed VPN | Fast VPN | Preferred Accelerator VPN | Reliable VPN |
| High quality VPN | Old fashioned VPN | Stable VPN(Recommend) | Smooth VPN |

