banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

[Linux] Configuring VPN Proxy Server on Ubuntu

Previously, we mentioned how to configure a VPN server on CentOS. Today, let's briefly discuss how to configure a VPN proxy service on Ubuntu. The process of configuring VPN on Ubuntu is similar to CentOS. Here, I will use a DigitalOcean VPS as a test server. The reason for choosing it is simple - because VPS allows complete control over the PPP device and does not require submitting a ticket to customer service for activation. The operating system is Ubuntu Server 12.04.3. All operations are performed after executing "sudo su".

  1. Confirm whether the PPP device or TUN device is installed (skip this step for DigitalOcean VPS).

ls /dev/ppp
ls /dev/net/tun

or#

cat /dev/ppp
cat /dev/net/tun

If it prompts "No such file or directory" or "No such device or address", it means it is not installed. You can request activation by submitting a ticket.

  1. Install pptpd.

apt-get install pptpd

  1. After successful installation, modify the /etc/pptpd.conf file to configure the IP address of the VPN. Write:

localip XXX.XXX.XXX.XXX
remoteip XXX.XXX.XXX.XXX-XXX

Reference configuration#

localip 10.0.0.1#

remoteip 10.0.0.100-200#

localip is the local IP, which is the IP of the local machine. remoteip is the IP that will be assigned to the remote host. It is usually set as a continuous IP range.

  1. Modify the /etc/ppp/options.pptpd file to complete the DNS modification of the VPS server.

ms-dns 8.8.8.8
ms-dns 8.8.4.4

  1. Edit /etc/ppp/chap-secrets to configure the users for VPN connection. The format is:

username pptpd password *

username represents the username. pptpd represents the service name, usually the default. password represents the password. The asterisk (*) means that all IPs can connect.

  1. Enable IP forwarding by opening /etc/sysctl.conf. After opening the file, find the following content and modify it. If it doesn't exist, please add it.

Enable IP forwarding#

net.ipv4.ip_forward=1

net.ipv4.tcp_syncookies=0

Apply the changes to /etc/sysctl.conf (optional).

sysctl -p

  1. Open the firewall.

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save

  1. Start the pptp VPN service.

service pptpd start

Tutorial provided by DigitalOcean: https://www.digitalocean.com/community/articles/how-to-setup-your-own-vpn-with-pptp

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.