First, Install the necessary components
1 | emerge -av ppp pptpd iptables |
Note: PPP should be supported by Linux Kernel. If your Kernel doesn’t support PPP, you need to re-compile it.
Modify /etc/ppp/options.pptpd
1 | nano /etc/ppp/options.pptpd |
unmark below section and use google DNS
1 2 | ms-dns 8.8.8.8 ms-dns 8.8.8.4 |
create username, password for VPN access, modify /etc/ppp/chap-secrets
1 2 3 | # Secrets for authentication using CHAP # client server secret IP addresses username * password * |
Then modify system settings for IP forward.
1 | nano /etc/pptpd.conf |
Unmark below sections:
1 2 | localip 192.168.0.1 remoteip 192.168.0.234-238,192.168.0.245 |
Then add ip forward rules, modify /etc/sysctl.conf and add
1 | net.ipv4.ip_forward = 1 |
Save and execute
1 | sysctl -p |
Add iptable rules
1 2 | iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j MASQUERADE /etc/init.d/iptables save |
Start iptable and pptp
1 2 | /etc/init.d/iptables start /etc/init.d/pptpd start |
Start the service when system start
1 2 | rc-update add iptables default rc-update add pptpd default |