The method of establishing VPN server under Ubuntu Server

VPN server software installation

sudo apt-get install pptpd

 

If the prompt cannot be found, then update apt

sudo apt-get update

 

 

 

Modify three files:

/etc/pptpd.conf

localip 192.168.0.1 The ip of the VPN server (not the real ip, but an ip of the pptp subnet)
remoteip 192.168.0.100-192.168.0.200


/etc/ppp/pptpd-options Set DNS

ms-dns 8.8.8.8

ms-dns 8.8.4.4

 


/etc/ppp/chap-secrets set username and password

# client        server  secret                  IP addresses

username * password *

 

Restart the pptp service:

sudo /etc/init.d/pptpd restart
Enable IP forwarding

# sudo nano /etc/sysctl.conf
Uncomment: net.ipv4.ip_forward=1

Reload configuration: sudo sysctl -p
Add forwarding rules: # sudo nano /etc/rc.local

Add two lines before exit 0 :

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -p tcp --syn -s 192.168.0.0/24 -j TCPMSS --set-mss 1356

This chestnut uses 192.168.0 as the PPTP subnet

Restart server reboot

https://help.ubuntu.com/community/PPTPServer

 

The above method may not work for VPS (VPS does not have eth0 -j MASQUERADE )

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326229678&siteId=291194637