资源描述
1 网络拓扑
图6-1:双机冗余拓扑图
为增加网络的健壮性,需要配置冗余策略,增加交换机SW3来做备份,网络拓扑结构如图6-1所示,SW2与SW3配置VRRP实现主机网关冗余,正常情况,在二层设备接入的VLAN 10与VLAN 20数据流经过三层交换机SW2向路由器转发,VLAN 30与VLAN 40数据流经过三层交换机SW3向路由器转发,当SW2的链路发生故障时,VLAN 10和VLAN 20主机的数据流切换到SW3向路由器转发,故障恢复之后,主机的数据流又能够切换回去,同样当SW3链路发生故障时,VLAN 30与VLAN 40数据也能切换到SW2转发。
1.1 MSTP技术简介
MSTP(Multiple Spanning Tree Protocol)即多生成树协议,区别于传统的STP生成树协议,它不再是基于整个网络产生一个属性拓扑结构,而是在网络中定义多个生成树实例,每个实例对应多个VLAN,每个实例维护自己独立的生成树,最大的优点便是可以实现网络流量的负载均衡[26]。
1.2 VRRP技术简介
VRRP (Virtual Router Redundancy Protocol) 即虚拟路由冗余协议,是一种选择协议,它可以把一个虚拟路由器的责任动态分配到局域网上的 VRRP 路由器中的一台。一个局域网络内的所有主机都设置缺省路由,当网内主机发出的目的地址不在本网段时,报文将被通过缺省路由发往外部路由器,从而实现了主机与外部网络的通信。当缺省路由器down掉(即端口关闭)之后,内部主机将无法与外部通信,如果路由器设置了VRRP时,那么这时,虚拟路由将启用备份路由器,从而实现全网通信。
2 配置方案
1.统计各个部门及所需信息点数,规划所用端口,表6-1。
表6-1:部门信息点数
部门
Vlan
信息点数
端口
部门一
VLAN10
100
SW1的E1/0/5-E1/0/8
部门二
VLAN20
40
SW1的E1/0/9-E1/0/12
部门三
VLAN30
17
SW1的E1/0/13-E1/0/16
部门四
VLAN40
13
SW1的E1/0/17-E1/0/20
部门四连接SW3以做他用,此处不做配置。
2.规划子网,表6-2。
表6-2:子网规划
部门
IP地址段
网关地址
部门一
10.0.0.0/25
10.0.0.126
部门二
10.0.0.128/26
10.0.0.190
部门三
10.0.0.192/27
10.0.0.222
部门四
10.0.0.224/28
10.0.0.238
3.在交换机SW1、SW2、SW3上配置MSTP防止二层环路,在SW2和SW3上配置VRRP,实现主机的网关冗余,正常情况下配置VLAN10和VLAN20走SW2,VLAN30和VLAN40走SW3,在某个交换机出现问题的情况下可以切换到另一台交换机,而在故障恢复的情况下又可以切换回来。
4.SW2和路由器互联地址172.16.0.0/30,SW3和路由器互联地址172.16.0.4/30。
2.1 SW2配置
建立VLAN:
vlan 10
vlan 20
vlan 30
vlan 40
配置E1/0/1为上联接口:
interface Ethernet1/0/1
port link-mode route
ip address 172.16.0.1 255.255.255.252
配置接SW1和SW3接口:
interface Ethernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan all
interface Ethernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan all
配置路由:
interface LoopBack0
ip address 9.9.9.2 255.255.255.255
ospf 1
area 0.0.0.0
network 10.0.0.0 0.0.0.127
network 10.0.0.128 0.0.0.63
network 10.0.0.192 0.0.0.31
network 10.0.0.224 0.0.0.15
network 9.9.9.2 0.0.0.0
network 172.16.0.0 0.0.0.3
ip route-static 0.0.0.0 0.0.0.0 172.16.0.2
配置MSTP:
stp enable
stp region-configuration
region-name silk
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
stp instance 1 root primary
创建备份组,配置虚拟IP地址,并设置备份组的优先级:
interface Vlan-interface10
ip address 10.0.0.1 255.255.255.128
vrrp vrid 10 virtual-ip 10.0.0.126
vrrp vrid 10 priority 120
interface Vlan-interface20
ip address 10.0.0.129 255.255.255.192
vrrp vrid 20 virtual-ip 10.0.0.190
vrrp vrid 20 priority 120
interface Vlan-interface30
ip address 10.0.0.193 255.255.255.224
vrrp vrid 30 virtual-ip 10.0.0.222
vrrp vrid 30 priority 100
interface Vlan-interface40
ip address 10.0.0.225 255.255.255.240
vrrp vrid 40 virtual-ip 10.0.0.238
vrrp vrid 40 priority 100
2.2 SW3配置
建立VLAN:
vlan 10
vlan 20
vlan 30
vlan 40
配置E1/0/1为上联接口:
interface Ethernet1/0/1
port link-mode route
ip address 172.16.0.5 255.255.255.252
配置接SW1和SW2接口:
interface Ethernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan all
interface Ethernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan all
配置路由:
interface LoopBack0
ip address 9.9.9.3 255.255.255.255
ospf 1
ospf 1
area 0.0.0.0
network 10.0.0.0 0.0.0.127
network 10.0.0.128 0.0.0.63
network 10.0.0.192 0.0.0.31
network 10.0.0.224 0.0.0.15
network 9.9.9.3 0.0.0.0
network 172.16.0.4 0.0.0.3
ip route-static 0.0.0.0 0.0.0.0 172.16.0.6
配置MSTP:
stp enable
stp region-configuration
region-name silk
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
stp instance 2 root primary
创建备份组,配置虚拟IP地址,并设置备份组的优先级:
interface Vlan-interface10
ip address 10.0.0.2 255.255.255.128
vrrp vrid 10 virtual-ip 10.0.0.126
vrrp vrid 10 priority 100
interface Vlan-interface20
ip address 10.0.0.130 255.255.255.192
vrrp vrid 20 virtual-ip 10.0.0.190
vrrp vrid 20 priority 100
interface Vlan-interface30
ip address 10.0.0.194 255.255.255.224
vrrp vrid 30 virtual-ip 10.0.0.222
vrrp vrid 30 priority 120
interface Vlan-interface40
ip address 10.0.0.226 255.255.255.240
vrrp vrid 40 virtual-ip 10.0.0.238
vrrp vrid 40 priority 120
2.3 SW1配置
建立VLAN:
vlan 10
vlan 20
vlan 30
vlan 40
配置设备互连接口:
interface Ethernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan all
interface Ethernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan all
配置各端口所属VLAN:
interface Ethernet1/0/5
port link-mode bridge
port access vlan 10
interface Ethernet1/0/6
port link-mode bridge
port access vlan 10
interface Ethernet1/0/7
port link-mode bridge
port access vlan 10
interface Ethernet1/0/8
port link-mode bridge
port access vlan 10
interface Ethernet1/0/9
port link-mode bridge
port access vlan 20
interface Ethernet1/0/10
port link-mode bridge
port access vlan 20
interface Ethernet1/0/11
port link-mode bridge
port access vlan 20
interface Ethernet1/0/12
port link-mode bridge
port access vlan 20
interface Ethernet1/0/13
port link-mode bridge
port access vlan 30
interface Ethernet1/0/14
port link-mode bridge
port access vlan 30
interface Ethernet1/0/15
port link-mode bridge
port access vlan 30
interface Ethernet1/0/16
port link-mode bridge
port access vlan 30
interface Ethernet1/0/17
port link-mode bridge
port access vlan 40
interface Ethernet1/0/18
port link-mode bridge
port access vlan 40
interface Ethernet1/0/19
port link-mode bridge
port access vlan 40
interface Ethernet1/0/20
port link-mode bridge
port access vlan 40
配置MSTP:
stp enable
stp region-configuration
region-name silk
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
2.4 路由器配置
配置互连IP:
interface GigabitEthernet0/1
port link-mode route
ip address 172.16.0.2 255.255.255.252
interface GigabitEthernet0/2
port link-mode route
ip address 172.16.0.6 255.255.255.252
配置路由:
interface LoopBack0
ip address 9.9.9.4 255.255.255.255
ospf 1
import-route static
area 0.0.0.0
network 172.16.0.0 0.0.0.3
network 172.16.0.4 0.0.0.3
network 9.9.9.4 0.0.0.0
ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet0/3 202.0.0.2
ip route-static 10.0.1.0 255.255.255.240 GigabitEthernet0/3 202.0.0.2
3 流量分析
3.1 基于SNMP协议的MRTG流量监控设计
在对网络链路进行管理时,负载流量监控是一个很好的方法,选择一个合适好用的网管软件是首要任务。大多数的免费网管软件功能单一,不提供图形化界面,而能够好用且功能强大的软件如iMC、openview则价格不菲,因此,考虑这方面的因素,既能满足我们网管的需求又能用开源软件搭建,我们选择了MRTG软件,它是基于snmp简单网络管理协议的管理工具,但是图形化界面实时监控各个设备、各个端口,给我们带来了方便。
下面我们设计实现MRTG的图形化流量监控。
我在做此设计时,软件使用平台是Windows 2003 server,用到三个软件,一个是ActivePerl版本是5.16.3,第二个是MRTG软件包,第三个是rktools工具包,命令环境DOS。
在搭建网络环境中,需要对交换机进行配置,以SW2为例:
启动SNMP Agent服务
[SW2] snmp-agent
设置snmp版本
[SW2] snmp-agent sys-info version all
设置读写团体名
[SW2] snmp-agent community write public
[SW2] snmp-agent community read private
软件安装,首先安装Perl,默认路径C:\perl,解压缩MRTG路径C:\mrtg。
在mrtg\bin目录下执行命令设置监控的网络设备:
perl cfgmaker public@172.16.0.1 public@172.16.0.5 --global "WorkDir: C:\Inetpub\wwwroot\MRTG" --output network.cfg,注意172.16.0.1与172.16.0.5是监控的SW2与SW3交换机的IP地址。
设置每隔5分钟输出一次并输出至index.html:
echo RunAsDaemon:yes>> network.cfg
echo Interval:5>> network.cfg
perl indexmaker network.cfg>c:\Inetpub\wwwroot\MRTG\index.html
运行mrtg:perl MRTG --logging=network.log network.cfg
有两个文件夹需要注意:
C:\Inetpub\wwwroot下的network.cfg与c:\Inetpub\wwwroot\MRTG文件夹下的图片文件。
在启动MRTG服务时,需要先将MRTG加入到服务中:
安装rktools,将其中的srvany.exe拷贝至c:\MRTG\bin 目录,将srvany 添加为服务:instsrv MRTG "c:\MRTG\bin\srvany.exe"。
修改注册表信息:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG,添加parameters子键,并设置项目Application的字串值,内容为c:\perl\bin\perl.exe ---该值为perl程序目录;设置AppDirectory的字串值,内容为c:\MRTG\BIN\ ----该值为MRTG程序目录;设置AppParameters的字串值,内容为MRTG --logging=network.log network.cfg。
3.2 双机冗余流量分析
在搭建网络实验环境时候,我们需要将此网络拓扑接入到校园网络中,校园网络采取动态分配的方式,我们将此环境接入10.0.9.0网段,因此需要在此网络拓扑顶层做一条路由:route-static 0.0.0.0 0.0.0.0 10.0.9.1指向网关10.0.9.1从而接入8805路由器实现路由直连。在接入层交换机SW1五号端口连接网线,连入PC,IP地址设置为10.0.0.50,子网掩码10.0.0.128,网关10.0.0.126,DNS解析到服务器192.168.100.202,经测试网络连通性,可实现互联网访问。
本实验环境接入层交换机下有4个VLAN,我们用4台电脑模拟这4个VLAN进行流量监控与分析,限制每台机器流量100Kb/S,通过测试正常通信网络及人为破坏链路来验证本网络拓扑的健壮性。
实验一:正常情况,SW2,SW3交换机工作状态,测试时间22:00-13:00点。
图6-2:负载分担的双机链路
在此环境中,我们看到MRTG监控了两个交换机的六个端口,为了能清晰分析各个端口的用途,我们把拓扑连接划出来。(如图6-3)
图6-3:设备互联端口标识
如图所示SW2和SW3的1号接口上连UTM,2号端口下连SW1,3号端口互连,SW1接入四台PC划入4个VLAN,限制各个PC的网络速率100Kb/s。当前环境,PC1和PC2走SW2访问网络,而PC3和PC4走SW3访问网络,如果我们配置正确,则在同一时间SW2和SW3上两个端口1和2号走的数据量应保持大致平衡。
通过实验我们得出图6-2,进行分析,图中绿色数据表示入数据流量,蓝色表示出数据流量,在正常情况下,我们看到SW2和SW3的1号端口绿色数据均集中在200Kb/s左右,表明这种情况下,根据我们在SW2和SW3做的VRRP实现了负载分担,此时注意到SW2和SW3的3号端口数据流量较大,但是Y轴单位是b,而不是Kb。
查看SW2的1号端口当前数据流量(图6-4)
图6-4:设备端口流量统计
此图给出了在本时间段内出数据量、入数据量最大值、平均值、当前值。
在12时左右,我们给出一个突发的数据量,据此模拟网络流量异常情况,监测网管软件是否能捕捉到,流量监控图如图6-5所示。
图6-5:突发数据量网络监控示意图
实验二:SW2链路出现故障时网络分析,测试时间13:00-17:30。
在此实验环境下,我们把SW2的2号端口断开,模拟链路故障,按照我们网络配置方案,VLAN10和VLAN20中的网络接入点不应掉线,走的路线是通过SW3的3号端口走SW2访问互联网,我们通过流量监控图来验证(图6-6)。
图6-6:链路断开时流量分析
通过监控图我们看到,因为SW2的2号链路故障,所以在时间13:00-17:30内SW2的2号口(如图6-7)没有数据通过,而SW2和SW3的3号(如图6-8)口则出现数据量保持在200Kb左右,实验证明,网络配置成功。
图6-7:SW2链路断开后2号口数据流量监控图
图6-8:SW2链路断开后3号口数据流量监控图
实验三:修复故障后,网络调整能力。测试时间17:30-22:00。
在这个测试中,我们恢复SW2的2号端口,模拟链路故障修复时的状况,若SW2的2号端口流量保持在200Kb/s则证明本网络拓扑具备自动切换的能力。注意在此图(图6-9)中,中午11点、下午3点做测试的机器因为在远程调试服务器,传文件的过程中造成两个时间有突发的数据流量达,影响了图片的一致性,而在3点这个时间段正是我们断开SW2的2号接口测试时间,数据流经SW3的3号接口走SW2因此对应SW3的3号图、SW3的2号图、SW2的3号图来看,均有一个瞬时的波峰。
图6-9:故障恢复后端口流量分析
通过此图我们看到,当SW2的下联端口故障修复后,SW2和SW3的3号端口数据量骤降,而SW2的2号端口数据量恢复到200Kb/s。
通过以上测试,我们验证了配置的MSTP+VRRP,具备了网络备份、负载分担的功能。
展开阅读全文