广告位招租!
知识无价,人有情,无偿分享知识,希望本条信息对你有用!
How to set up and install a PPTP VPN on CentOS 8
Step 1: Install PPP
Installing PPTP completely depends on PPP and PPTPD packages. To do so, first, install the related package and then configure it to initiate configuration. Use the following commands one by one:
yum install ppp iptables nano
cd /usr/local/src
For 64-bit OS:
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.el6.x86_64.rpm
rpm -Uhv pptpd-1.4.0-1.el6.x86_64.rpm
yum remove ppp-2.4.9-5.el9.x86_64
wget https://poptop.sourceforge.net/yum/stable/packages/ppp-2.4.5-33.0.fc12.x86_64.rpm
rpm -Uhv ppp-2.4.5-33.0.fc12.x86_64.rpm
wget https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/t/tcp_wrappers-libs-7.6-97.el9.x86_64.rpm
rpm -Uhv tcp_wrappers-libs-7.6-97.el9.x86_64.rpm
For 32-bit OS:
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.el6.i686.rpm
rpm -Uhv pptpd-1.4.0-1.el6.i686.rpm
Step 2: Configure and Setup your PPTPD
Edit IP settings in: /etc/pptpd.conf as shown in the following:
nano /etc/pptpd.conf
Edit the following settings to /etc/ppp/options.pptpd:
vi /etc/ppp/options.pptpd
ms-dns 8.8.8.8
ms-dns 4.4.4.4
As you can see, this code will add a DNS server to your VPN server. You can add the DNS servers provided by your internet provider or use Google DNSserver and insert them in the file.
Step 3: Create a user to access the VPN server
Add user account in/etc/ppp/chap-secrets (assign username and password) like the following:
nano /etc/ppp/chap-secrets
Step 4: Enable IP/network forwarding
We need IP forwarding to help VPN route packets between the VPN clients and the outside world. Therefore, the VPN server will become a router:
sudo vi /etc/sysctl.conf
Now, add the following line:
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
To make the changes to sysctl.conf take effect, use the following command:
sysctl -p
After running this code, you must save and close the file. Then apply the changes with the following command:
sudo sysctl -p
this command will reserve our setting between system reboots.
重启服务器。
Step 5: Setup ”iptables”
Now, you need to add the following IP-tables rules in order to open the correct ports and properly forward the data packets:
iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -i eth0 -p gre -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Step 6:Start VPN server
service pptpd restart
可能会用到的命令:
yum remove ppp-2.4.9-5.el9.x86_64
wget https://poptop.sourceforge.net/yum/stable/packages/ppp-2.4.5-33.0.fc12.x86_64.rpm
rpm -Uhv ppp-2.4.5-33.0.fc12.x86_64.rpm
wget https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/t/tcp_wrappers-libs-7.6-97.el9.x86_64.rpm
rpm -Uhv tcp_wrappers-libs-7.6-97.el9.x86_64.rpm
rpm -Uhv pptpd-1.4.0-1.el6.x86_64.rpm
最后,恭祝各位使用愉快!