[分享]ubuntu中文网 VPN , 用pptpconfig连接~~

上网、浏览、聊天、下载等
头像
yaoms
帖子: 4952
注册时间: 2007-10-19 14:51
来自: 深圳

[分享]ubuntu中文网 VPN , 用pptpconfig连接~~

#1

帖子 yaoms » 2008-03-06 15:07

这个指南是推荐的:
http://wiki.ubuntu.org.cn/%E5%A6%82%E4% ... 8UbuntuVPN


上面oneleaf给出才是简单好用的方法,下面的方法还没有研究通。。


前天 oneleaf 架设了一个vpn服务器,方便大家跨网互联。 不过在linux下连接vpn稍微有点麻烦,为了方便大家使用,我经过几个小时的研究终于联通,特将配置过程分享如下:

1, 安装相关程序pptp-linux

代码: 全选

sudo apt-get install pptp-linux
按照糕手们的说法,这样就可以连接了,方法如下:

代码: 全选

sudo pptp ubuntu.org.cn user ubuntu passwd ubuntuvpn
此命令执行后没有任何返回值。。。
可以通过这个命令查看:

代码: 全选

$ plog
Mar  6 15:12:16 yaoms-laptop pppd[11282]: pppd 2.4.4 started by root, uid 0
Mar  6 15:12:16 yaoms-laptop pppd[11282]: Using interface ppp0
Mar  6 15:12:16 yaoms-laptop pppd[11282]: Connect: ppp0 <--> /dev/pts/4
可以看到,已经有一个ppp0出现了,不过到这一步,我也不知道怎么用,再过几秒钟,ppp0就会断开了。
为了正常使用vpn连接,还需要安装一个 pptpconfig (图形界面)。

2,下载软件包(这些包,源里没有的,奇怪。。。):
http://ftp.ubuntu.org.cn/home/yaoms/pac ... 2_i386.deb
http://ftp.ubuntu.org.cn/home/yaoms/pac ... 2_i386.deb
http://ftp.ubuntu.org.cn/home/yaoms/pac ... -0_all.deb
并安装:

代码: 全选

sudo dpkg -i *.deb
3,安装完成后启动pptpconfig

代码: 全选

sudo pptpconfig
就会见到如图的一个窗口:

添加连接信息后,点击“Add”按钮,然后选中添加的连接,右键,“start”,就可以连接了,连接成功的画面如下:

ps。 连接成功后用 ifconfig看看:

代码: 全选

$ sudo ifconfig 
eth1      Link encap:Ethernet  HWaddr 00:02:3F:06:FC:64  
          ...

lo        Link encap:Local Loopback  
          ...

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:192.168.0.2  P-t-P:192.168.0.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:88 (88.0 b)  TX bytes:106 (106.0 b)
我分配到的vpn ip是 192.168.0.2 ~~~ :oops:
附件
pptp的界面
pptp的界面
连接成功的画面
连接成功的画面
上次由 yaoms 在 2008-03-06 18:51,总共编辑 6 次。
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#2

帖子 eexpress » 2008-03-06 15:20

估计CLI的要带什么延时参数。。。需要找高人来理清头绪了。那man pptp就没东西可看。我要脚本啊。不要gui啊。

root 10005 0.0 0.7 12300 8048 pts/1 S+ 15:08 0:00 /usr/lib/php-pcntl/bin/php -q /usr/sbin/pptpconfig
root 10009 0.0 0.0 0 0 pts/1 Z+ 15:08 0:00 [sh] <defunct>
root 10011 0.0 0.0 1756 480 pts/1 S+ 15:08 0:00 sh -c pptp ubuntu.org.cn --nolaunchpppd
root 10012 0.0 0.0 1900 816 pts/1 S+ 15:08 0:00 pptp: GRE-to-PPP gateway on /dev/ptmx
root 10015 0.0 0.0 1900 516 pts/1 S+ 15:08 0:00 pptp: call manager for 59.36.101.19
root 10042 0.0 0.0 2872 664 ? Ss 15:08 0:00 /usr/sbin/pppd call ubuntu.org.cn logfd 1 updetach
● 鸣学
头像
u194252
帖子: 402
注册时间: 2007-08-04 11:06

#3

帖子 u194252 » 2008-03-06 15:30

收藏了啊 啊
图片
copdips
帖子: 58
注册时间: 2006-03-19 21:43

#4

帖子 copdips » 2008-03-06 16:19

以前在论坛看人说过, 我也测试成功过, 有一个简单的办法就是:

代码: 全选

sudo apt-get install vpnc
装好后在 /etc/vpnc 下有一个example.conf 文件, 打开它, 最上面四行:

代码: 全选

IPSec gateway 
IPSec ID 
IPSec secret 
Xauth username
分别填上相关信息, 分别是:
vpn服务器地址
所连的组的名字
所连的密药
你的用户名,
保存为 default.conf 就可以了, conf文件要保存在 /etc/vpnc下: 记得访问 /etc/vpnc 要sudo权限.

然后直接用命令

代码: 全选

vpnc
就可以自动连接了, 很简单吧

假如前面的那个conf文件没有改名为default.conf的话, 比如名字叫做china.conf. 那么运行命令是

代码: 全选

vpnc china
最后要提醒一下的是, 有的密码给的不是明文, 是很长的那种加密过后的, 这时

代码: 全选

IPSec secret

一行要改为

代码: 全选

IPSec obfuscated secret
也可以去此处得到转为明文:
http://www.unix-ag.uni-kl.de/~massar/bin/cisco-decode

些的有点多: 其实很简单: 最多一分钟就搞定: 希望各位能成功!
上次由 copdips 在 2008-03-06 16:23,总共编辑 2 次。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

我记录错误信息。知道脚本也正常。

#5

帖子 eexpress » 2008-03-06 16:19

代码: 全选

☎  sudo pptpconfig
[sudo] password for exp:

Warning: unlink(/var/run/pptpconfig.ubuntu.org.cn.undo): No such file or directory in /usr/bin/pptpconfig.php on line 1068
CHAP authentication succeeded
MPPE 128-bit stateless compression enabled
Cannot determine ethernet address for proxy ARP
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#6

帖子 eexpress » 2008-03-06 16:34

☎ dog /etc/vpnc.conf
IPSec gateway ubuntu.org.cn
IPSec ID myGroup
IPSec secret myGroupPWD
Xauth username ubuntu
Xauth password ubuntuvpn
Target networks 192.168.0.0/255
DNSUpdate no

☎ sudo vpnc
vpnc: no response from target
上次由 eexpress 在 2008-03-06 16:38,总共编辑 1 次。
● 鸣学
头像
yaoms
帖子: 4952
注册时间: 2007-10-19 14:51
来自: 深圳

#7

帖子 yaoms » 2008-03-06 16:37

4楼的方法虽然简单,但是。。
$ sudo vpnc ubuntucn
vpnc: no response from target

这是怎么回事?
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#8

帖子 eexpress » 2008-03-06 16:39

pptpconfig的。我挂了自动,就一直连接了。还要手动启动,关闭连接。
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#9

帖子 eexpress » 2008-03-06 16:39

找人,用network-manager-pptp吧。 yaoms
● 鸣学
头像
yaoms
帖子: 4952
注册时间: 2007-10-19 14:51
来自: 深圳

#10

帖子 yaoms » 2008-03-06 16:43

eexpress 写了:找人,用network-manager-pptp吧。 yaoms
找人?找什么人?
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
头像
rhfcaesar
帖子: 2996
注册时间: 2005-11-17 15:45
来自: 湖北

#11

帖子 rhfcaesar » 2008-03-06 16:46

eexpress 写了:估计CLI的要带什么延时参数。。。需要找高人来理清头绪了。那man pptp就没东西可看。我要脚本啊。不要gui啊。

root 10005 0.0 0.7 12300 8048 pts/1 S+ 15:08 0:00 /usr/lib/php-pcntl/bin/php -q /usr/sbin/pptpconfig
root 10009 0.0 0.0 0 0 pts/1 Z+ 15:08 0:00 [sh] <defunct>
root 10011 0.0 0.0 1756 480 pts/1 S+ 15:08 0:00 sh -c pptp ubuntu.org.cn --nolaunchpppd
root 10012 0.0 0.0 1900 816 pts/1 S+ 15:08 0:00 pptp: GRE-to-PPP gateway on /dev/ptmx
root 10015 0.0 0.0 1900 516 pts/1 S+ 15:08 0:00 pptp: call manager for 59.36.101.19
root 10042 0.0 0.0 2872 664 ? Ss 15:08 0:00 /usr/sbin/pppd call ubuntu.org.cn logfd 1 updetach
置顶贴里面63楼介绍了命令行pon的方法。上次你自己回帖时说要用的时候来参考,怎么不来了呢? :D :D

代码: 全选

枪杆子里面出政权
头像
yaoms
帖子: 4952
注册时间: 2007-10-19 14:51
来自: 深圳

#12

帖子 yaoms » 2008-03-06 16:49

ls,,为什么要remove network-manager network-manager-gnome???
rhfcaesar 写了:feisty下的方法:
1. 安装附件里的包。
2. sudo apt-get remove network-manager network-manager-gnome
3. sudo pico /etc/ppp/peers/vpnnet, 添加:

代码: 全选

pty "pptp vpn.classnet.cuhk.edu.hk --nolaunchpppd"
##注意: vpn.classnet.cuhk.edu.hk换成你自己的VPN服务器地址
file /etc/ppp/options.pptp
remotename PPTP
persist
defaultroute
usepeerdns
name youruserID
4. sudo pico /etc/ppp/options.pptp, 注释掉 require-mppe-128
5. sudo pico /etc/ppp/pap-secrets, 在最后一行添加:
youruserID PPTP yourpassword
##注意:如果认证方式是chap,那么就编辑chap-secrets文件,而不是pap-secrets。
6. 启动:
sudo pon vpnnet
7. 关闭:
sudo poff vpnnet[/code]
连接过来,方便使用,呵呵 viewtopic.php?t=21606&postdays=0&postorder=asc&start=62
上次由 yaoms 在 2008-03-06 16:53,总共编辑 1 次。
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
头像
rhfcaesar
帖子: 2996
注册时间: 2005-11-17 15:45
来自: 湖北

#13

帖子 rhfcaesar » 2008-03-06 16:52

yaoms 写了:ls,,为什么要remove network-manager network-manager-gnome???

连接过来,方便使用,呵呵 viewtopic.php?t=21606&postdays=0&postorder=asc&start=62
因为不好用。

代码: 全选

枪杆子里面出政权
头像
yaoms
帖子: 4952
注册时间: 2007-10-19 14:51
来自: 深圳

#14

帖子 yaoms » 2008-03-06 17:04

试了你的方法,没报错,也没成功 :shock: :cry:
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
头像
rhfcaesar
帖子: 2996
注册时间: 2005-11-17 15:45
来自: 湖北

#15

帖子 rhfcaesar » 2008-03-06 17:07

yaoms 写了:试了你的方法,没报错,也没成功 :shock: :cry:
检查下你的配置文件写对了没有。还有,最好卸载那个networkmanager,碍事。

代码: 全选

枪杆子里面出政权
回复