学校的上网方式比较特殊,必须用VPN连接,连上了VPN之后得到一个公网的ip,就可以上
网了。为了更加方便,在ubuntu可以这么设置。
以香港中文大学的ResNet为例
首先安装pptp
代码:
sudo apt-get install pptp-linux
这个不需要上网也可以安装的,直接就有。
然后建立文件
代码:
sudo gedit /etc/init.d/connect
里面内容为
代码:
#!/bin/sh
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# Configurations
#
case "$1" in
start)
echo -n "Starting pptp"
if ifconfig|grep ppp &>/dev/null
then
echo "[already running]"
else
pptp vpn.resnet.cuhk.edu.hk debug name s012345 remotename vpn.resn
et.cuhk.edu.hk noipdefault
echo "."
fi
;;
stop)
echo -n "Stopping pptp"
if ifconfig|grep ppp &>/dev/null
then
killall -9 pptp
echo "."
else
echo "[not running]";
fi
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/connect {start|stop|restart|force-reload}"
exit 1
esac
exit 0
再编辑文件
代码:
sudo gedit /etc/ppp/options
里面的内容清除掉,改成
代码:
lock
debug
mtu 1000
nobsdcomp
nodeflate
noaccomp
nopcomp
novj
defaultroute
name s012345
然后打开文件
代码:
sudo gedit /etc/ppp/pap-secrets
在最后一行加上
代码:
s012345 vpn.resnet.cuhk.edu.hk xxxxx
上面 s012345是中大Computer ID xxxxx是CWEM密码
现在
代码:
sudo /etc/init.d/connect start
就可以上网了
最后可以上网更加方便
代码:
sudo update-rc.d connect defaults
这样开机就自动上线了
以上是一个设置VPN的教程,当我运行connect start的时候,程序报告说pptp is running;而后运行connect stop的时候,程序又报告说没有可以删除的进程。 这是怎么回事啊?
另外 单独运行pptp那段, 程序不报错,但根本连不上网。
谢谢~
在ubuntu6.10下的VPN设置问题。附配置文件
-
- 帖子: 8
- 注册时间: 2007-03-10 17:51