文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>linux上vpn的服务端和客户端配置

linux上vpn的服务端和客户端配置

时间:2007-04-05  来源:linuxyueye

vpn常见问题分析与解决办法http://pptpclient.sourceforge.net/howto-diagnosis.phtml vpn配置http://pptpclient.sourceforge.net     先去站点:http://www.poptop.org/
  需要下载的软件:
  dkms-2.0.5-1.noarch.rpm
  kernel_ppp_mppe-0.0.5-2dkms.noarch.rpm
  ppp-2.4.3-4.rhel3.i386.rpm(下载自己的相应的系统就可以了,我用的是rhel3)
  pptpd-1.2.3-1.i386.rpm

  检查自己系统内是否有相应的软件包已经安装,没有的话安装,有的话使用升级.
  分别使用命令:
  安装 : rpm -ivh xxx.rpm
  升级 : rpm -Uvh xxx.rpm

      注意最好用rpm包安装,不要自己编译不然后面会很麻烦.

  安装完成.

  编辑/etc/pptp.conf
  只需要在最后输入两行:
  localip 192.168.100.1 //定义服务器上的IP.(也就是连上后的ppp0的ip)
  remoteip 192.168.1.1-30 //定义客户端的IP.
  保存.

  编辑/etc/ppp/chap-secrets
  只需要加入:
  “user” pptpd “password” * //将user,password 修改为你的用户名和密码就可以了.
  或者如下:
  “user” pptpd “password” 192.168.1.1 //将 * 用ip代替后,就是指定客户端连上后的ip.
  保存.

  编辑/etc/ppp/options.pptpd
  只需要加入:
  ms-dns 202.101.172.35 //将ip换为你的dns ip 即可.
  保存.

  启动服务.

  /etc/rc.d/init.d/pptpd start

      如果无法连接,可以通过/var/log/message来查看.

  使用win系统,建立一个新的vpn连接,输入服务器ip,用户名和密码.即可.
----------------------------------

注意1.这样配置的vpn不加密,在windows建立vpn客户端连接要在连接属性去掉“加密”选项。

注意2.

按照上面方法安装的,在windows客户端登陆时可能会出下面的错误:
GRE: read(fd=6,buffer=804e560,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs

在/etc/ppp/options.pptpd中注释掉下面行即可
#require-mppe-128

》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》linux上vpn客户端配置

1.下载ppp-mppe-2.4.0-4.tar.gz(pppd的补丁版),pptp-linux-1.0.3-1.tar.gz
(pptp客户端),假定下载文件放在/opt下

  2.安装

  解压缩、安装pppd2.4.0
   # cd /opt
   # tar zxvf ppp-mppe-2.4.0-4.tar.gz -C /opt
   # cd /opt/ppp-mppe-2.4.0-4
   # sh unpack.sh ;执行这个脚本,给pppd打patch
   # cd ppp-2.4-0
   # ./configure
   # make
   # mv /usr/sbin/pppd /usr/sbin/pppd.old ;原来的pppd做个备份
   # cp pppd /usr/sbin/pppd ;将新的pppd放入系统路径

  解压缩、安装pptp-linux

   # cd /opt
   # tar zxvf pptp-linux-1.0.3-1.tar.gz -C /opt
   # cd /opt/pptp-linux-1.0.3-1
   # cp options.pptp /etc/ppp/
   # mkdir /etc/pptp.d/ ; 这一步不做也可以
   # tar zxvf pptp-linux-1.0.3.tar.gz
   # cd pptp-linux-1.0.3
   # make
   # cp pptp /usr/sbin
   # cp pptp-callmgr /usr/bin

  3. 设置

   # cd /opt/pptp-linux-1.0.3-1
   # ./pptp-command

   1.) start
   2.) stop
   3.) setup
   4.) quit
   What task would you like to do?:3

  选3,设置

   1.) List CHAP secrets
   2.) Add a New CHAP secret
   3.) Delete a CHAP secret
   4.) List PPTP Tunnels
   5.) Add a NEW PPTP Tunnel
   6.) Delete a PPTP Tunnel
   7.) Configure resolv.conf
   8.) Select a default tunnel
   9.) Quit
   ?:2 ;先建立一个CHAP secrets,选择2
   Add a NEW CHAP secret.

   NOTE: Any backslashes (\\) must be doubled (\\\\).

   Local Name:

    This is the \'local\' identifier for CHAP authentication.

   NOTE: If the server is a Windows NT machine, the local name
      should be your Windows NT username including domain.
      For example:

         domain\\\\username

   Local Name:pptp ;这里填上pptp的登录用户名称,然后出现
   Remote Name:

   This is the \'remote\' identifier for CHAP authentication.
   In most cases, this can be left as the default. If must be
   set if you have multiple CHAP secrets with the same local name
   and different passwords. Just press ENTER to keep the default.

   Remote Name [PPTP]: ;用默认的PPTP就行,所以,回车进入下一项

   Password:

   This is the password or CHAP secret for the account specified. The
   password will not be echoed.

   Password: ;在这里敲入密码,密码不回显
   
  回到主选单
   
   Adding secret pptp PPTP *****

   1.) List CHAP secrets
   2.) Add a New CHAP secret
   3.) Delete a CHAP secret
   4.) List PPTP Tunnels
   5.) Add a NEW PPTP Tunnel
   6.) Delete a PPTP Tunnel
   7.) Configure resolv.conf
   8.) Select a default tunnel
   9.) Quit
   ?: ;此时建立一个新的PPTP Tunnel,选择5
   Add a NEW PPTP Tunnel.

   1.) Other
   Which configuration would you like to use?:1 ;只有这一个,选1
   Tunnel Name: test ;给连接起名字test
   Server IP: 10.0.0.227 ;vpn服务器的ip
   What route(s) would you like to add when the tunnel comes up?
   This is usually a route to your internal network behind the PPTP server.
   You can use TUNNEL_DEV and DEF_GW as in /etc/pptp.d/ config file
   TUNNEL_DEV is replaced by the device of the tunnel interface.
   DEF_GW is replaced by the existing default gateway.
   The syntax to use is the same as the route(icon_cool.gif command.
   Enter a blank line to stop.
   route: TUNNEL_DEV ;用提示的输入
   route: ;一个就够了,回车结束
   Local Name and Remote Name should match a configured CHAP secret.
   Local Name is probably your NT domain\\username.
   NOTE: Any backslashes (\\) must be doubled (\\\\).

   Local Name: pptp
   Remote Name [PPTP]:
   Adding test - 10.0.0.227 - pptp - PPTP
   Added tunnel test
   1.) List CHAP secrets
   2.) Add a New CHAP secret
   3.) Delete a CHAP secret
   4.) List PPTP Tunnels
   5.) Add a NEW PPTP Tunnel
   6.) Delete a PPTP Tunnel
   7.) Configure resolv.conf
   8.) Select a default tunnel
   9.) Quit
   ?:9

  退出后再进入程序
   # ./pptp-command

   1.) start
   2.) stop
   3.) setup
   4.) quit
   What task would you like to do?: 1 ;选1,开始
   1.) test
   Start a tunnel to which server?: test ;在选择要连接的名称

  注意:pptp-command这个脚本有个bug,开始连接后不能正常结束程序,并且在连接建立后给出个错误的路由,

   # route
   Kernel IP routing table
   Destination Gateway Genmask Flags Metric Ref Use Iface
   10.0.0.227 * 255.255.255.255 UH 0 0 0 ppp0
   10.0.0.0 * 255.255.255.0 U 0 0 0 eth0
   127.0.0.0 * 255.0.0.0 U 0 0 0 lo
   default 10.0.0.1 0.0.0.0 UG 0 0 0 eth0
------------------------------------------------------------

注意1.不能创建隧道,根据提示去掉pptp-command里面的-T的参数,等建立隧道完成后再恢复。

注意2.vpn连接后首先删除那个ppp0那个路由,然后使用route add -net 218.30.85.0/24 dev ppp0添加到具体网络的路由

注意3.pptp-linux-1.0.3-1.tar.gz 要update到1.2,然后安装,vpnserver修改地址后,直接在vpn客户端上修改隧道配置文件/etc/ppp/peers/* 中得地址即可。配置文件路径可以在启动文件中查找到。 
排行榜 更多 +
房间毁灭模拟器最新版

房间毁灭模拟器最新版

休闲益智 下载
街头追逐者最新版

街头追逐者最新版

休闲益智 下载
弓箭手2内置作弊菜单

弓箭手2内置作弊菜单

休闲益智 下载