Linux命令行vpn拨号

  1. rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  2. yum install -y pptp.x86_64 pptp-setup.x86_64
  3. pptpsetup --create vpn --server $VPN_Server_IP --username $User_Name --password $Password  --encrypt --start
  4. route add -net 0.0.0.0 dev ppp0
  5. #/usr/share/doc/ppp-x.x.x/scripts/pon
  6. #/usr/share/doc/ppp-x.x.x/scripts/poff
  7. ponpoff命令
  8. cp /usr/share/doc/ppp-2.4.5/scripts/poff /usr/sbin/
  9. cp /usr/share/doc/ppp-2.4.5/scripts/pon /usr/sbin/
  10. chmod +x /usr/sbin/poff
  11. chmod +x /usr/sbin/pon

linux Centos命令行拨号记录备忘。

centos64位安装pptpd

  1. 1) vi /etc/yum.repos.d/nux-misc.repo
  2.  
  3. [nux-misc]
  4. name=Nux Misc
  5. baseurl=http://li.nux.ro/download/nux/misc/el6/x86_64/
  6. enabled=0
  7. gpgcheck=1
  8. gpgkey=http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
  9.  
  10. 2) yum --enablerepo=nux-misc install pptpd -y
  11.  
  12. 3) vim /etc/sysctl.conf
  13. net.ipv4.ip_forward = 1
  14. sysctl -p
  15.  
  16. 4) vim /etc/pptpd.conf
  17. localip 10.0.0.1
  18. remoteip 10.0.0.2-254
  19.  
  20. 5) vim /etc/ppp/options.pptpd
  21. ms-dns 8.8.8.8
  22. ms-dns 8.8.4.4
  23.  
  24. 6) vim /etc/ppp/chap-secrets
  25. username   pptpd   password       *
  26.  
  27. 7) iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE

from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs

pptpd vpn错误619的解决办法

  1. #/var/log/messages错误日志为:
  2. Apr  5 19:45:25 localhost pptpd[2000]: GRE: read(fd=6,buffer=8059680,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs
  3. Apr  5 19:45:25 localhost pptpd[2000]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
  4.  
  5. # 打开options.pptpd
  6. # vi /etc/ppp/options.pptpd
  7. # 找到debug,在下面添加一行 debug dump 打开连接调试
  8. #错误日志提示为:Cannot determine ethernet address for proxy ARP
  9.  
  10. Apr  5 19:49:25 localhost pppd[2026]: nobsdcomp         # (from /etc/ppp/options.pptpd)
  11. Apr  5 19:49:25 localhost pppd[2026]: require-mppe-128          # (from /etc/ppp/options.pptpd)
  12. Apr  5 19:49:25 localhost pppd[2026]: pppd 2.4.4 started by root, uid 0
  13. Apr  5 19:49:25 localhost pppd[2026]: Using interface ppp0
  14. Apr  5 19:49:25 localhost pppd[2026]: Connect: ppp0 <--> /dev/pts/1
  15. Apr  5 19:49:25 localhost pppd[2026]: MPPE 128-bit stateless compression enabled
  16. Apr  5 19:49:25 localhost pptpd[2025]: CTRL: Ignored a SET LINK INFO packet with real ACCMs!
  17. Apr  5 19:49:27 localhost pppd[2026]: Cannot determine ethernet address for proxy ARP
  18. Apr  5 19:49:27 localhost pppd[2026]: local  IP address 10.0.0.1
  19. Apr  5 19:49:27 localhost pppd[2026]: remote IP address 10.0.0.2
  20.  
  21. # 重启pptpd服务
  22. service pptpd restart
  1. windows上 开始运行cmd
  2. apr -d *
  3. 再拨VPNOK

centos配置vpn 基于pptpd

centos上配置vpn并指定出口IP

  1. 添加centos的源
  2. /etc/yum.repos.d/CentOS-Base.repo 
  3.  
  4. [doylenet]
  5. name=Doylenet custom repository for CentOS
  6. baseurl=http://files.doylenet.net/linux/yum/centos/5/i386/doylenet/
  7. gpgcheck=1
  8. gpgkey=http://files.doylenet.net/linux/yum/centos/RPM-GPG-KEY-rdoyle
  9. enabled=1
  10.  
  11. yum install ppp pptpd.i386 -y
  12.  
  13. echo 1 > /proc/sys/net/ipv4/ip_forward 
  14. sysctl -p
  15.  
  16. 修改 /etc/pptpd.conf
  17. 注释掉logwtmp
  18. 并添加IP范围
  19. localip 10.0.0.1
  20. remoteip 10.0.0.2-254
  21.  
  22. 修改 /etc/ppp/options.pptpd
  23. 添加DNS
  24. ms-dns 8.8.8.8
  25. ms-dns 8.8.4.4
  26.  
  27. 添加用户名密码
  28. /etc/ppp/chap-secrets 
  29.  
  30. iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j SNAT --to-source YourIPs
  31. iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE #或者轮询
1 1