2009/04/27

华为系列交换机VRRP双机冗余配置

基于 IPv4 的 VRRP 典型配置举例:

一: VRRP 单备份组配置举例

组网需求
1,Host需要访问 Internet,Host的缺省网关为202.38.160.111/24;
2,Switch A 和 Switch B 属于虚拟 IP 地址为 202.38.160.111/24 的备份组 1;
3,当 Switch A 正常工作时,Host A 发送给 Host B 的报文通过 Switch A 转发;
当 Switch A 出现故障时,Host A 发送给 Host B 的报文通过 Switch B 转发。

配置步骤:
(1) 配置 Switch A
# 配置 VLAN2。
system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port GigabitEthernet 2/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 202.38.160.1 255.255.255.0
# 创建备份组 1,并配置备份组 1 的虚拟 IP 地址为 202.38.160.111。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.111
# 设置 Switch A 在备份组 1 中的优先级为 110。默认优先级为100。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 设置 Switch A 工作在抢占方式,抢占延迟时间为 5 秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
(2) 配置 Switch B
# 配置 VLAN2。
system-view
[SwitchB] vlan 2
[SwitchB-Vlan2] port GigabitEthernet 2/0/5
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 202.38.160.2 255.255.255.0
# 创建备份组 1,并配置备份组 1 的虚拟 IP 地址为 202.38.160.111。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.111
# 设置 Switch B 工作在抢占方式,抢占延迟时间为 5 秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
(3) 验证配置结果
配置完成后,在 Host A 上可以 ping 通 Host B。通过 display vrrp verbose 命令查看配置后的结果。
# 显示 Switch A 上备份组 1 的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose


VRRP 监视接口配置举例:
当 Switch A 连接 Internet 的 VLAN 接口 3 不可用时,Host A 发送给 Host B 的报文通过 Switch B 转发。

# 设置备份组的认证方式为 SIMPLE 认证,认证字为 hello。
[SwitchA-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
# 设置 Master 发送 VRRP 报文的间隔时间为 5 秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 timer advertise 5
# 设置监视接口。
[SwitchA-Vlan-interface2] vrrp vrid 1 track interface vlan-interface 3 reduced 30


VRRP 多备份组配置举例:

组网需求
1,202.38.160.0/24 网段内部分主机的缺省网关为 202.38.160.111/24,部分主机的缺省网关为 202.38.160.112/24;
2,利用 VRRP 备份组实现缺省网关间的负载分担和相互备份。


配置 Switch A
# 配置 VLAN2。
system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port GigabitEthernet 2/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 202.38.160.1 255.255.255.0
# 创建备份组 1,并配置备份组 1 的虚拟 IP 地址为 202.38.160.111。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.111
# 设置 Switch A 在备份组 1 中的优先级为 110。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 创建备份组 2,并配置备份组 2 的虚拟 IP 地址为 202.38.160.112。
[SwitchA-Vlan-interface2] vrrp vrid 2 virtual-ip 202.38.160.112

配置 Switch B
# 配置 VLAN2。
system-view
[SwitchB] vlan 2
[SwitchB-vlan2] port GigabitEthernet 2/0/5
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 202.38.160.2 255.255.255.0
# 创建备份组 1,并配置备份组 1 的虚拟 IP 地址为 202.38.160.111。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.111
# 创建备份组 2,并配置备份组 2 的虚拟 IP 地址为 202.38.160.112。
[SwitchB-Vlan-interface2] vrrp vrid 2 virtual-ip 202.38.160.112
# 设置 Switch B 在备份组 2 中的优先级为 110。
[SwitchB-Vlan-interface2] vrrp vrid 2 priority 110

验证配置结果
可以通过 display vrrp 命令查看配置后的结果。
# 显示 Switch A 上备份组的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose


VRRP 常见错误配置举例:

一:控制台上频频出现配置错误的提示

原因分析:
1,可能是备份组内的另一台交换机配置不一致造成的。
2,可能是有的机器试图发送非法的 VRRP 报文。

解决方法:
1,对于第一种情况,可以通过修改配置来解决。
2,对于第二种情况,则是有些机器有不良企图,应当通过非技术手段来解决。

二:同一个备份组内出现多个 Master 交换机

原因分析:
1,若短时间内存在多个Master 交换机,属于正常情况,无需进行人工干预。
2,若多个Master 交换机长时间共存,这很有可能是由于Master 交换机之间收不到VRRP报文,或者收到的报文不合法造成的。

解决方法:先在多个Master 交换机之间执行ping 操作。如果ping 不通,则检查网络连接是否正确;如果能ping 通,则检查VRRP 的配置是否一致。对于同一个VRRP 备份组的配置,必须要保证虚拟IP 地址个数、每个虚拟IP 地址、通告报文的发送时间间隔和认证方式完全一样。

三:VRRP 的状态频繁转换
原因分析:这种情况一般是由于 VRRP 通告报文发送时间间隔太短造成的。
解决方法:增加通告报文的发送时间间隔或者设置抢占延迟都可以解决这种故障。

转: VLAN划分,GVRP还是VTP

GVRP协议简介
GVRP是GARP的一种应用,它基于GARP的工作机制,维护交换机中的VLSN动态注册信息,并传播该信息到其它的交换机中。所有支持GVRP特性的交换机能够接收来自其它交换机的VLAN信息,并动态更新本地的VLAN注册信息,包括当前的VLAN成员、这些VLAN成员可以通过哪个端口到达等。而且所支持GVRP特性的交换机能够将本地的VLAN注册注册信息向其它交换机传播,以使同一交换网内所有支持GVRP特性的设备的VLAN信息达成一致。GVRP传播的VLAN注册信息既包括本地手工配置的静态注册信息,也包括来自其它交换机的动态注册信息。

VTP协议简介
VTP的功能与GVRP相似,也是用来使VLAN配置信息在交换网内其它交换机上进行动态注册的一种二层协议。在一台VTPServer上配置一个新的VLAN信息,则该信息将自动传播到本域内的所有交换机,从而减少在多台设备上配置同一信息的工作量,且方便了管理。VTP信息只能在Trunk端口上传播。

GVRP和VTP两个协议有何异同点
相同点:
二者都是对跨以太网交换机的VLAN进行动态注册和删除的二层协议,交换机之间的协议报文交互都必须在VLANTrunk链路上进行。
不同点:
a、GVRP是IEEE制定的基于GARP的协议;而VTP是CISCO公司开发的私有协议,目前华为等交换机也支持VTP协议;
b、GVRP协议就是通过属性的声明-注册机制将本地的VLAN信息通告给其他交换机;而VTP协议是通过检查通告报文中的配置版本号信息,版本号低的交换机向版本号高的交换机进行学习,从而实现VLAN信息的共享;
c、支持VLAN数目不同,GVRP协议所支持的VLANID范围为1-4094,而VTP协议只支持1-1001号的VLAN。

GVRP和VTP两个协议在实践中的应用比较
在具体应用上,VTP支持的是服务器-客户端模式,即在主交换机建立VTP域,并将主交换机设置成VTPServer,然后在分交换机设置为VTPClient,这样只需在主交换机上建立VLAN,就会通知到局域网中的任何一台交换机,这样便于集中管理。
GVRP相对繁琐些,它需要在每一台交换机上建立VLAN,并且在每一个交换机(无论是主交换机还是分交换机)首先全局运行gvrp命令,开启gvrp功能,然后在干道汇聚连接上运行gvrp命令,开启GVRP功能,这样才会将本交换机上建立的VLAN通知注册到局域网中的其它交换机上。

由此可见,GVRP是IEEE制定的基于GVRP的协议,VTP是厂家开发的协议,因此GVRP的适用面比较宽泛,但VTP的设置要便捷些,并且有利于设备的集中管理,在VLAN的划分中得到广泛应用。但由于VTP模式本质上是把在核心交换机上划分的VLAN复制到局域网中的所有分交换机上,这样整个网络中的VLAN广播还是会在汇聚连接上传播,会加重核心交换机的负担。GVRP本质上是在各交换机上分别划分VLAN,并且通过GVRP裁减机制限制不必要的VLAN广播,使得主交换机和分交换机的VLAN广播相对均衡,减少了主交换机的CPU占用率,因此在大型网络中GVRP有较好的表现。

现在的交换机在支持GVRP协议的同时,一般也都支持VTP协议,但是要记住这两个协议可不允许同时开启的。

2009/04/06

三向重发布路由缺失:只是特例情况的

三向重发布路由缺失:

-lo1(RIP)
R1--OSPF--R2--EIGRP--R3
----->
<-----

第一步: RIP--->OSPF

R2(config-router)#redistribute rip subnets

R1上有路由:
O E2 22.22.22.0 [110/20] via 12.1.1.2, 00:00:08, Serial1/1
而R3上没有
--->结论是,单点三向重发布,重发布路由作用只在相关的两个路由协议之间,不会再重发布给另一个协议。即,RIP重发布给OSPF的路由条目,OSPF不会再将这些条目重发布给EIGRP。
所以需要手动将RIP路由重发布到EIGRP中,需要执行重发布RIP两次。

R2(config-router)#redistribute rip metric 10000 255 100 1 255
R3上就会有:
D EX 22.22.22.0 [170/2235136] via 23.1.1.2, 00:00:08, Serial1/0

第二步:R2上
OSPF<----->EIGRP双向单点重发布

!
router eigrp 90
redistribute ospf 110 metric 10000 255 100 1 1500
redistribute rip metric 10000 255 100 1 255
network 2.2.2.2 0.0.0.0
network 23.1.1.2 0.0.0.0
no auto-summary
!
router ospf 110
router-id 2.2.2.2
log-adjacency-changes
redistribute eigrp 90 subnets
redistribute rip subnets
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
!
router rip
version 2
network 22.0.0.0
no auto-summary
!

第三步:比较三个路由器上的路由条目,都是6条路由。配置正确。

特殊情况:在重发布时使用route-map指定重发布的条目,而使用route-map是在重发布时推荐的做法。

!
router eigrp 90
redistribute connected route-map RIP2EIGRP
!
!
route-map RIP2EIGRP permit 10
match interface Loopback1
!

这样就会在R3上出现路由缺失的情况,因为route-map默认最后是deny any的,所有在redistribute connected route-map的情况下,只是重发布了route-map允许的路由,例如是lo1的路由,而redistribute connected会优于redistribute ospf,所以连R2直连的12.1.1.0网段路由都屏蔽了。如下:

R3#sh ip route

1.0.0.0/32 is subnetted, 1 subnets
D EX 1.1.1.1 [170/2235136] via 23.1.1.2, 00:01:43, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 23.1.1.2, 00:01:43, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
22.0.0.0/24 is subnetted, 1 subnets
D EX 22.22.22.0 [170/2297856] via 23.1.1.2, 00:00:49, Serial1/0

实验做到这里,感觉好像是因为自己在重发布的时候画蛇添足了,为何要这样人为地制造麻烦呢,直接redistribute rip route-map 不就行了。。。但是如果在以后需要用到重发布直连redistribute connected route-map,那么可能这些考虑就用到了。。。

这种情况原因:route-map匹配考虑不周全。
解决办法:
R2(config)#route-map RIP2EIGRP permit 20
R2(config-route-map)#end
R2#

R3#sh ip route

1.0.0.0/32 is subnetted, 1 subnets
D EX 1.1.1.1 [170/2235136] via 23.1.1.2, 00:12:59, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 23.1.1.2, 00:12:59, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
22.0.0.0/24 is subnetted, 1 subnets
D EX 22.22.22.0 [170/2297856] via 23.1.1.2, 00:12:05, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
D EX 12.1.1.0 [170/2681856] via 23.1.1.2, 00:00:06, Serial1/0

同样在RIP直连重发布到OSPF中如果使用route-map的时候也要考虑这些情况。

汇总路由回馈问题:完美解决 route-map + prefix-list

单点双向重发布:考虑汇总路由回馈问题

R1--OSPF--R2--EIGRP--R3
----->
<-----

R2#sh run
!
router eigrp 90
redistribute ospf 110 metric 10000 255 100 1 1500
network 23.1.1.2 0.0.0.0
no auto-summary
!
router ospf 110
router-id 2.2.2.2
log-adjacency-changes
summary-address 172.16.0.0 255.255.252.0
redistribute eigrp 90 subnets
network 12.1.1.2 0.0.0.0 area 0
!

R2:

172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
D 172.16.0.0/24 [90/2297856] via 23.1.1.3, 00:04:00, Serial1/1
O 172.16.0.0/22 is a summary, 00:00:20, Null0
D 172.16.1.0/24 [90/2297856] via 23.1.1.3, 00:04:30, Serial1/1
D 172.16.2.0/24 [90/2297856] via 23.1.1.3, 00:04:21, Serial1/1
D 172.16.3.0/24 [90/2297856] via 23.1.1.3, 00:04:11, Serial1/1


R3:

172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C 172.16.0.0/24 is directly connected, Loopback4
D EX 172.16.0.0/22 [170/3137280] via 23.1.1.2, 00:00:22, Serial1/0
C 172.16.1.0/24 is directly connected, Loopback1
C 172.16.2.0/24 is directly connected, Loopback2
C 172.16.3.0/24 is directly connected, Loopback3

-----------------------------------------------------------
防止汇总路由回馈:完美解决 route-map + prefix-list


R2#sh run b r e
router eigrp 90
redistribute ospf 110 metric 1000 255 100 1 1500 route-map anti-sum
network 23.1.1.2 0.0.0.0
no auto-summary
!
!
ip prefix-list anti-sum seq 5 permit 172.16.0.0/22
!
route-map anti-sum deny 10
match ip address prefix-list anti-sum
!
route-map anti-sum permit 20
!


R3:

172.16.0.0/24 is subnetted, 4 subnets
C 172.16.0.0 is directly connected, Loopback4
C 172.16.1.0 is directly connected, Loopback1
C 172.16.2.0 is directly connected, Loopback2
C 172.16.3.0 is directly connected, Loopback3

路由优选部分_调整管理距离和metric

路由优选这回事


R1 R2 R3 FR帧中继相连 s1/2 123.1.1.0/24 OSPF
R2 R3 R4 以太网相连 fa 0/0 23.1.1.0/24 EIGRP
R2R3上双点双向重发布

R1上其环回
R1(config)#int lo 1
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#int lo 2
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#int lo 3
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#int lo 4
R1(config-if)#ip add 192.168.0.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#end

这时R4将会收到这几天路由,且由R2R3负载均衡线路。
要求:
192.168.0.0和192.169.2.0走R2
192.168.1.0和192.168.4.0走R3
即要求 奇数网络号走R3,偶数网络号走R2,且不能破坏链路的冗余特性。

===>最佳解决办法,使用route-map修改相应路由条目的metric,使R4不优选从R2或R3发来的这条路由条目。

R2:

!
router eigrp 90
redistribute ospf 110 metric 10000 100 255 1 1500 route-map O2E
network 2.2.2.2 0.0.0.0
network 23.1.1.2 0.0.0.0
no auto-summary
!
router ospf 110
router-id 2.2.2.2
log-adjacency-changes
redistribute eigrp 90 subnets
network 2.2.2.2 0.0.0.0 area 0
network 123.1.1.2 0.0.0.0 area 0
!
access-list 13 permit 192.168.1.0
access-list 13 permit 192.168.3.0
route-map O2E permit 10
match ip address 13
set metric 10000 1000 255 1 1500
!
route-map O2E permit 20
!


R4上的路由表:
D EX 192.168.0.0/24 [170/284160] via 23.1.1.2, 00:00:19, FastEthernet0/0
123.0.0.0/24 is subnetted, 1 subnets
D EX 123.1.1.0 [170/284160] via 23.1.1.2, 00:00:06, FastEthernet0/0
[170/284160] via 23.1.1.3, 00:00:06, FastEthernet0/0
D EX 192.168.1.0/24 [170/284160] via 23.1.1.3, 00:00:07, FastEthernet0/0
D EX 192.168.2.0/24 [170/284160] via 23.1.1.2, 00:00:21, FastEthernet0/0
D EX 192.168.3.0/24 [170/284160] via 23.1.1.3, 00:00:07, FastEthernet0/0


同样这个实验可以大大地扩展,这只是冰山一角而已。好像还可以使用反掩码精确匹配奇数或者偶数路由网络条目。例如:使用
R2(config)#access-list 13 permit 192.168.1.0 0.0.254.255
来代替
access-list 13 permit 192.168.1.0
access-list 13 permit 192.168.3.0

+++++++++++++++++++++++++++++++++++++++++++++++++

缺省默认路由的引入

前言:NP课上的,再次听到这些内容感觉印象很是模糊,特做个笔记。。。


TOPO:

R1-----R2-----R3-----ISP(R4)

R3: 一条到ISP的默认缺省路由
ip route 0.0.0.0 0.0.0.0 34.1.1.4
================================================
R1R2R3 运行的OSPF协议

R3(config-router)#default-information originate always

在远端路由器会产生:
O*E2 0.0.0.0/0 [110/1] via 12.1.1.2, 00:00:01, Serial1/1

数据库中传播的是一条Type-5 LSA
Type-5 AS External Link States

Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 3.3.3.3 9 0x80000001 0x0092A6 110


R3(config)#router os 110
R3(config-router)#no default-information originate
R3(config-router)#end

+++++++++++++++++++++++++++++++++++++++++++++++++
R1R2R3 运行的EIGRP协议

R3(config)#router ei 90
R3(config-router)#redistribute static ?
metric Metric for redistributed routes
route-map Route map reference

R3(config-router)#redistribute static
R3(config-router)#end

远端路由器:
D*EX 0.0.0.0/0 [170/3193856] via 12.1.1.2, 00:00:11, Serial1/1

-----------------
* - candidate default

网关路由器R3:
router eigrp 90
redistribute connected
network 23.1.1.3 0.0.0.0
no auto-summary
!
ip default-network 192.168.1.0
ip route 0.0.0.0 0.0.0.0 34.1.1.4
!
interface Loopback1
ip address 192.168.1.1 255.255.255.0
end

远端路由器:
D*EX 192.168.1.0/24 [170/2809856] via 12.1.1.2, 00:00:25, Serial1/1

备注:这种情况要求default-network 3.0.0.0 是主类网络号,包括接口地址也必须是主类网络地址
例如:
!
interface Loopback0
ip address 3.3.3.3 255.0.0.0
!
ip default-network 3.0.0.0
!
远端路由器才会出现以下条目,注意是/8
D*EX 3.0.0.0/8 [170/2809856] via 12.1.1.2, 00:01:26, Serial1/1

网关路由器:
C* 3.0.0.0/8 is directly connected, Loopback0
------------------
网关路由器R3:使用汇总路由会产生一个缺省路由的特性
!
interface Serial1/0
ip address 23.1.1.3 255.255.255.0
ip summary-address eigrp 90 0.0.0.0 0.0.0.0 5
!

远端路由器:
D* 0.0.0.0/0 [90/2809856] via 12.1.1.2, 00:01:47, Serial1/1

同时在网关路由器R3上会引入一个指向null0的路由备份条目,因为先前已经存在了0.0.0.0指向ISP
P 0.0.0.0/0, 1 successors, FD is 128256
via Summary (128256/0), Null0

**注意:使用ip summary-address eigrp 90会抑制相应的详细路由,但是可以使用leakmap策略定义一些不愿被汇总路由抑制的一些详细路由条目.
+++++++++++++++++++++++++++++++++++++++++++++++++++++