2016-11-01

http://blog.51yip.com/linux/1404.html
https://linux.cn/article-3376-1.html 此例子有不足,更改如下

http://blog.163.com/monk…popo/blog/static/208680220111014101233949/

http://rainbird.blog.51cto.com/211214/394403/ 针对ufw
https://www.crazycen.com/linux/1360.html 不错的ufw

sudoapt-get install pptpd
编辑配置文件:
sudovi /etc/pptpd.conf

  1. localip #vpn 服务器地址 10.100.0.1
  2. remoteip 10.100.0.2-10

第二行为分配的ip段
设置dns
sudovi /etc/ppp/pptpd-options

  1. ms-dns 8.8.8.8
  2. ms-dns 8.8.4.4

设置账号:
sudovi /etc/ppp/chap-secrets

  1. “user” pptpd “user” *
  2. sudo /etc/init.d/pptpd restart

    设置IP转发

sudovi /etc/sysctl.conf

  1. net.ipv4.ip_forward=1
  2. sudosysctl -p
  1. sudo iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE

保存规则;
sudo vi /etc/iptables-rules 创建,并赋予当期那用户权限

  1. sudo iptables-save > /etc/iptables-rules
  2. sudovi /etc/network/interfaces
  3. pre-up iptables-restore < /etc/iptables-rules
  4. sudo iptables -A FORWARD -s 10.100.0.0/24 -p tcp -m tcp —tcp-flags SYN,RST SYN -j TCPMSS —set-mss 1200
  1. sudo iptables-save > /etc/iptables-rules

恢复root权限 /etc/iptables-rules
已经成功