1
| apt-get install pptpd |
1
| nano -w /etc/ppp/chap-secrets |
1
| yourusername pptpd yourpassword * |
1
| nano -w /etc/pptpd .conf |
1
2
| localip 10.10.0.1 remoteip 10.10.0.5-100 |
Save the file and exit the editor. Now edit the ppp configuration file:
pico -w /etc/ppp/pptpd-optionsadd the following at the end of file:
name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 ms-dns 8.8.8.8 #ms-dns 8.8.4.4 proxyarp nodefaultroute lock nobsdcomp mtu 1490 mru 1490
Now, let’s get IP forwarding working by editing sysctl.conf file
1
| nano -w /etc/sysctl .conf |
1
| net.ipv4.ip_forward=1 |
1
| sysctl -p |
1
| nano -w /etc/rc . local |
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth0 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPTNote that iptables MASQUERADE doesn’t work on OpenVZ VPS containers. Works on KVM and XEN.
If you use OpenVZ, you need to use iptables SOURCE like this:
iptables -t nat -A POSTROUTING -j SNAT --to-source <Public Server IP>now restart pptpd by running:
service pptpd restart
Post a Comment