linux怎么上校园网:Linux平台下大学校园网实现实例分析来源: 发布时间:星期四, 2009年2月12日 浏览:236次 评论:0
![]() 机为2924,划分为3个VLAN ![]() ![]() ![]() ![]() ![]() ![]() 网关机采用Linux系统 ![]() ![]() ![]() ![]() ![]() ![]() 另外要求cqs在9:00——22:00能够上网 ![]() ![]() ![]() ![]() 教室不能访问办公室 ![]() 2、2924交换机上VLAN ![]() 在Cisco2924交换机上 ![]() ![]() ![]() ![]() ![]() ![]() VLAN ![]() ![]() ![]() ![]() ![]() Cisco2924#conf t (进入全局配置模式) Cisco2924(config)# ![]() Cisco2924(config- ![]() Cisco2924(config- ![]() ![]() ![]() ![]() ![]() Cisco2924(config- ![]() ![]() ![]() ![]() ![]() Cisco2924(config- ![]() ![]() 3、Linux系统(Gataway)上 ![]() 1、编译内核 ![]() ![]() Linux2.4.20内核:http://www.kernel.org/pub//kernel/v2.4/-2.4.20.tar.bz2 cp linux-2.4.20.tar.bz2 /usr/src tar -jxvf linux-2.4.20.tar.bz2 ln -s linux-2.4.20 linux cd linux make menuconfig Networking options ---> ![]() ……………… 编译完成后启用新内核 ![]() 2、VLAN ![]() VLAN配置工具软件Software:http://www.candelatech.com/~greear/vlan/vlan.1.7m.tar.gz tar -zxvf vlan.1.7m.tar.gz cd vlan cp vconfig /usr/sbin 注: 如果需要支持基于MAC地址划分 ![]() ![]() ![]() ![]() ![]() (1)、创建VLAN10、VLAN12、VLAN13 vconfig add eth0 10 vconfig add eth0 12 vconfig add eth0 13 (2)、为接口设置IP地址: ip address add 192.168.5.3/28 dev eth0.12 (DMZ区域 ![]() ip address add 192.168.10.1/24 dev eth0.13 (Classroom ![]() ip address add 192.168.9.1/27 dev eth0.10 (cqs ![]() ip link ![]() ip link ![]() ip link ![]() 4、配置拨号 1、创建cqs ![]() (1)创建拨号脚本文件:/etc/ppp/dialisp1 #!/bin/sh /usr/sbin/pppd /dev/ttyS0 115200 connect '/usr/sbin/chat -f /etc/ppp/chat95788' login user 95788 mru 1500 mtu 1500 crtscts file /etc/ppp/options.pstn_isp1 (2)创建拨号用 ![]() "" at OK ate1v1 OK atdt95788 CONNECT (3)、创建拨号用 ![]() local nodefaultroute noauth login user 95788 mru 1500 mtu 1500 crtscts updetach 注:由于有多个拨号 ![]() ![]() ![]() 2、创建Classroom ![]() (1)创建拨号脚本文件:/etc/ppp/dialisp2 #!/bin/sh /usr/sbin/pppd /dev/ttyS1 115200 connect '/usr/sbin/chat -f /etc/ppp/chat9_95788' login user 95788 mru 1500 mtu 1500 crtscts file /etc/ppp/options.pstn_isp2 (2)创建拨号用 ![]() "" at OK atm3 OK atdt9,,95788 CONNECT 注:该电话需要拨9字头 (3)、创建拨号用 ![]() local noauth login user 95788 nodefaultroute mru 1500 mtu 1500 crtscts updetach 5、创建VPN(卫星)拨号脚本: 1、Linux下 ![]() 解压后将pptp文件拷贝到/usr/sbin下 ![]() 2、下载卫星卡 ![]() ![]() 3、创建cqs ![]() ip route add 210.12.254.4 dev ppp0 (x.x.x.x 为ISP提供 ![]() ![]() ![]() ![]() sleep 2 /usr/sbin/pptp 210.12.254.4 file /etc/ppp/options.pptp1 (建立PPTP连接) /etc/ppp/options.pptp1为建立cqs ![]() ![]() ![]() local user username +chap remotename 210.12.254.4 noauth mru 1400 mtu 1400 updetach 注:由于在PPTP内还要对数据进行封装 ![]() ![]() ![]() ![]() ![]() ![]() 4、创建Classroom ![]() ip route add x.x.x.x dev ppp2 (x.x.x.x 为ISP提供 ![]() ![]() ![]() ![]() sleep 2 /usr/sbin/pptp x.x.x.x file /etc/ppp/options.pptp2 (建立PPTP连接) /etc/ppp/options.pptp2为建立cqs ![]() ![]() ![]() local user username +chap remotename x.x.x.x noauth mru 1400 mtu 1400 updetach 5、进行拨号测试: 注意拨号 ![]() ![]() 6、设置路由策略: 1.设置路由表名称: 编辑/etc/iproute2/rt_tables文件 ![]() ![]() ![]() 100 ![]() ![]() ![]() 110 cqs (将编号为110 ![]() 2.设置路由: (设置教室 ![]() ip route add 192.168.5.0/28 dev eth0.12 table ![]() (设置办公室 ![]() ip route add 192.168.5.0/28 dev eth0.12 table cqs (设置路由策略) ip rule add from 192.168.9.0/27 table cqs (来自192.168.9.0/27 ![]() ip rule add from 192.168.10.0/24 table ![]() ![]() ![]() ip rule add to 192.168.9.0/27 table ![]() ![]() ![]() ip rule add to 192.168.10.0/27 table ![]() ![]() ![]() 3.设置缺省路由: 根据前面 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ip route add default dev ppp1 table offcie ip route add default dev ppp3 table ![]() (注:ppp1为基于ppp0 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 将上面 ![]() ![]() ![]() ![]() /sbin/ip addr add 0.0.0.0 dev eth0 /sbin/ip link ![]() /sbin/vconfig add eth0 10 /sbin/vconfig add eth0 12 /sbin/vconfig add eth0 13 /sbin/ip route add 192.168.5.0/28 dev eth0.12 table ![]() /sbin/ip route add 192.168.5.0/28 dev eth0.12 table cqs /sbin/ip rule add from 192.168.9.0/27 table cqs /sbin/ip rule add from 192.168.10.0/24 table ![]() /sbin/ip rule add to 192.168.9.0/27 table ![]() /sbin/ip rule add to 192.168.10.0/27 table ![]() 2、办公室 ![]() /usr/sbin/pppd /dev/ttyS0 57600 connect '/usr/sbin/chat -f /etc/ppp/chat95788' login user 95788 crt 1
相关文章读者评论发表评论 |
|