Some infos About PPTP :
1) Basic : Point-to-Point Tunneling Protocol - Wikipedia, the free encyclopedia
2) Advance : http://www.ietf.org/rfc/rfc2637.txt


First you must install PPTP server. You must be sudoer.

Code:
# sudo apt-get install pptpd
And then you must edit config file

Code:
# sudo nano /etc/pptpd.conf
And then you must choose IP address for your server(using localip SERVER_IP) and then address range for clients(using remoteip). use invalid IP addresses for local and remote (10.0.0.0/24, 172.16.0.0/12, 192.168.0.0/16)

Code:
For example :
localip 10.0.0.1
remoteip 10.0.0.2-100
Ctrl+O then Enter finally Ctrl+X

and then you must select primary and secondary DNS servers :
Code:
# sudo nano /etc/ppp/pptpd-options
What is DNS ?
Basic : http://en.wikipedia.org/wiki/Domain_Name_System
Advance : http://www.ietf.org/rfc/rfc1035.txt

Code:
For example:
ms-dns 8.8.8.8 #google dns server
ms-dns 4.2.2.4 #sun's
An then you must add some usernames and passwords :
Code:
# sudo nano /etc/ppp/chap-secrets
for example :
Code:
# client        server  secret                  IP addresses
test pptpd test *
Ctrl+O then Enter finally Ctrl+X

client : Username
server : pptpd for this
secret : Password
IP addresses : to restrict this client to a special IP range

And then you must start the server :
Code:
# /etc/init.d/pptpd restart
And then you must enable port forwarding for IPV4
Code:
# sudo nano /etc/sysctl.conf
Than Uncommment this line :
Code:
net.ipv4.ip_forward=1
Ctrl+O then Enter finally Ctrl+X

Then you must load new configs :
Code:
# sudo sysctl -p
Finally you must add forwarding rule to iptable(linux's firewall)
Code:
# sudo nano /etc/rc.local
Add this rule to forward incoming packet through eth0:
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save
Ctrl+O then Enter finally Ctrl+X