- 论坛徽章:
- 0
|
在linux 下用锐捷, 在网上也有很多资料, 可是我们学校的情况可能和其他的有些不同,
所以小弟在这里贴出这个贴子, 与大家个方便, )
先说一下我们学校的ip 的分配情况: 当你开机的时候, 学校的dhcp服务器会分给你一个用于学校内网的ip 地址 是192.168. *.* 的ip ,这样ip只能上学校的内网(交换机对这样的ip 访问网络作了限制)
然后当你用锐捷连接 sam 服务器,通过sam 的认证后, dhcp服务器会再次分给你一个用于上外网的ip 大都 是222.22 .*.* , 这时你可以上外网,
在linux 下, 我用的是xrgsu , 也写了自动连接的脚本, 如下,大家可能也见过:
#! /usr/bin/expect
#supplicant
# filename ruijie
spawn xrgsu -d
expect " lease input your user name:"
send "yourconut\r"
expect " lease input your password:"
send " yourpasswd\r"
expect "Use default auth parameter,0-Use 1-UnUse(Default: 0):"
send "\r"
expect " lease input 'unauth' to LogOff:"
sleep 30000
参数 -d 是说在认证后才获取新的ip
但这个脚本连接大约120 秒后网络就会断掉, ping 不通自已的网关, 但当你自己直接运行
xrgsu -d ,然后自己填你的账号密码时, 网络就不会断, 我搞不明白这是什么 原因,有知道的前辈能告知小弟,则不胜感激 ) , 于是我作了一个自动重联命名为netlogin:
#! /bin/bash
while [ 1 ]
do
ruijie >/dev/null 2>&1
sleep 110
done
~
觉得可以把 ruijie 和netlogin 两个脚 本合在一块, 把ruijie 作为一个函数让 while 项中的命令调用.
但没写出来, 水平有限, 也欢ying 大家补充.
写完后,把 ruijie 和 netlogin 两个文件加上运行权限
chmod +x ruijie
chmod + netlogin
将它们放到 /usr/local/bin/ 中.
下面的对我比较有用的一步,
我修改了/etc/X11/xinit/Xclients
在脚 本命令开始前加了这句
#!/bin/bash
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#(这个是小企鹅输入法, 选择让它在桌面启动的时候运行)
fcitx &
# 这就是我的网络联接, 也让它桌面启动时运行, 在这之前网卡已被激活且有了一个ip
netlogin &
# check to see if the user has a preferred desktop
PREFERRED=
if [ -f /etc/sysconfig/desktop ]; then
. /etc/sysconfig/desktop
...........
好了, 到这里,当我启动系统进入桌面的时候 ,已经可以联到外网了, ~~~
第一次写了这么长的东西(对于自己来说), 其中不免有不妥之处, 希望大家指出~~ |
|