实验:运行在NBMA网络上的OSPF
目的:了解OSPF在NBMA网络上的解决方案
拓扑图:
实验连接:
SZ S0/0 <----> FR S0/0
GZ S0/1 <----> FR S0/1
DG S0/2 <----> FR S0/2
IP地址表:
SZ S0/0 192.168.1.1/24 Loopback 0 1.1.1.1/24
GZ S0/1 192.168.1.2/24 Loopback 0 2.2.2.2/24
DG S0/2 192.168.1.3/24 Loopback 0 3.3.3.3/24
具体情况:
SZ
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname SZ
SZ(config)#int loopback 0 //定义了环回地址
SZ(config-if)#ip address 1.1.1.1 255.255.255.0
SZ(config-if)#exit
SZ(config)#int s0/0
SZ(config-if)#ip address 192.168.1.1 255.255.255.0
SZ(config-if)#encap frame-relay
SZ(config-if)#frame-relay lmi-type ansi
SZ(config-if)#no shut
SZ(config-if)#end
GZ
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname GZ
GZ(config)#int loopback 0
GZ(config-if)#ip address 2.2.2.2 255.255.255.0
GZ(config-if)#exit
GZ(config)#int s0/1
GZ(config-if)#ip address 192.168.1.2 255.255.255.0
GZ(config-if)#encap frame-relay
GZ(config-if)#frame-relay lmi-type ansi
GZ(config-if)#frame-relay map ip 192.168.1.3 100
/ /静态映射语句,使IP地址与DLCI关联,使GZ与DG可以通信
GZ(config-if)#no shut
GZ(config-if)#end
DG :
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname DG
DG(config)#int loopback 0
DG(config-if)#ip address 3.3.3.3 255.255.255.0
DG(config-if)#exit
DG(config)#int s0/2
DG(config-if)#encap frame-relay
DG(config-if)#frame-relay lmi-type ansi
DG(config-if)#frame-relay map ip 192.168.1.2 200
//静态映射语句,使IP地址与DLCI关联,使DG与GZ可以通信
DG(config-if)#no shut
DG(config-if)#end
FR:
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname FR
FR(config)#frame-relay switching //定义为Frame-relay路由交换机
FR(config)#int s0/0
FR(config-if)#encap frame-relay
FR(config-if)#frame-relay lmi-type ansi
FR(config-if)#frame-relay intf-type dce // 定义为DCE
FR(config-if)#frame-relay route 100 int s0/1 100 //定义一条PVC
FR(config-if)#frame-relay route 200 int s0/2 200
FR(config-if)#clock rate 64000 //提供时钟
FR(config-if)#no shut
FR(config-if)#end
FR#config t
Enter configuration commands, one per line. End with CNTL/Z.
FR(config)#int s0/1
FR(config-if)#encap frame-relay
FR(config-if)#frame-relay lmi-type ansi
FR(config-if)#frame-relay intf-type dce
FR(config-if)#frame-relay route 100 int s0/0 100
FR(config-if)#clock rate 64000
FR(config-if)#no shut
FR(config-if)#exit
FR(config)#int s0/2
FR(config-if)#encap frame-relay
FR(config-if)#frame-relay lmi-type ansi
FR(config-if)#frame-relay intf-type dce
FR(config-if)#frame-relay route 200 int s0/0 200
FR(config-if)#clock rate 64000
FR(config-if)#no shut
FR(config-if)#end
我们先来验证一下:
GZ#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 152/226/332 ms
GZ#ping 192.168.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 164/286/640 ms
情况表明 GZ可以与SZ和DG 接口都相通
以上的配置请参考 配置部分PVC网状网络完全连接及帧中继映射(详细配置)
我们再来测试一下能不能连通 SZ 1.1.1.1 和 DG 3.3.3.3 地址
GZ#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
GZ#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
情况表明它们之间没有连通,下面我们来讨论使用OSPF来解决的方案,
1. 先使用广播式模式来实现
SZ>
SZ>en
SZ#config t
Enter configuration commands, one per line. End with CNTL/Z.
SZ(config)#int s0/0
SZ(config-if)# ip ospf network broadcast //设置网络类型为广播类型
SZ(config-if)# ip ospf priority 10 //配置OSPF的优先级为10 ,在这里使它成为DR
SZ(config-if)#no shut
SZ(config-if)#exit
SZ(config)#
SZ(config)#router ospf 64
SZ(config-router)#network 192.168.1.0 0.0.0.255 area 0
SZ(config-router)#network 1.1.1.0 0.0.0.255 area 0
SZ(config-router)#end
注意: 优先级高的不一定成为DR,只是极有可能成为DR而已。
GZ#config t
Enter configuration commands, one per line. End with CNTL/Z.
GZ(config)#int s0/1
GZ(config-if)#ip ospf network broadcast
GZ(config-if)# ip ospf priority 0 //使它不会成为DR和BDR
GZ(config-if)#no shut
GZ(config-if)#exit
GZ(config)#router ospf 64
GZ(config-router)#network 192.168.1.0 0.0.0.255 area 0
GZ(config-router)#network 2.2.2.0 0.0.0.255 area 0
GZ(config-router)#end
GZ#
注意:优先级为0,只能成为DROTHER !
DG(config)#int s0/2
DG(config-if)#ip ospf network broadcast
DG(config-if)#ip ospf priority 0
DG(config-if)#no shut
DG(config-if)#exit
DG(config)#router ospf 64
DG(config-router)#network 192.168.1.0 0.0.0.255 area 0
DG(config-router)#network 3.3.3.0 0.0 0.0.0.255 area 0
注意: 由于把网络配置为广播类型,所以它必须选择DR, 在以上配置中没有BDR。
我们验证一下:
GZ#show ip ospf int s0/1
Serial0/1 is up, line protocol is up
Internet Address 192.168.1.2/24, Area 0
Process ID 64, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 48
Transmit Delay is 1 sec, State DROTHER, Priority 0
Designated Router (ID) 1.1.1.1, Interface address 192.168.1.1
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:02
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 1.1.1.1 (Designated Router)
Suppress hello for 0 neighbor(s)
解释一下上面的一些参数:
Process ID :是CISCO特有的,不是OSPF协议开放标准的一部分。
COST 48: 是指从该接口发送出去的数据包的出站接口代价;CISCO 使用的缺省代价是100000000,而接口配置的带宽为2048k(由于我没改带宽,所以使用默认值) ,所以相除就得到 48 。
注意:由于网络是广播式,意味着DR已被选出,所以不需要定义邻居。
GZ#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 10 FULL/DR 00:00:36 192.168.1.1 Serial0/1
注意: 由于SZ是网络中的DR,所以GZ与SZ是完全邻接的。
我们来看一下SZ上的OSPF邻居的状态:
SZ#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 0 FULL/DROTHER 00:00:31 192.168.1.3 Serial0/0
2.2.2.2 0 FULL/DROTHER 00:00:39 192.168.1.2 Serial0/0
注意:DROTHER意味着它们既不是DR也不是BDR,而且SZ与GZ,DG是完全邻接的。
特别注意: 当你要改变DR状态的时候,DR必须重启,因为一旦网络中的DR被选定,其它路由器无法成为DR直到DR失效。
查看路由表
SZ#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/49] via 192.168.1.2, 00:15:02, Serial0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/49] via 192.168.1.3, 00:15:02, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/0
测试一下能不能连通 SZ 1.1.1.1 和 DG 3.3.3.3 地址
GZ#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/119/168 ms
GZ#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/283/384 ms
到这里NBMA网络上广播式的配置已经完成。
为了避免DR/BDR选取的处理,在多厂商的网络环境中,点到多点类型可能是除广播型网络之外唯一的一种选择。
2.在NBMA网络点到多点模型上配置OSPF
先删掉广播式模型的配置,
GZ#config t
Enter configuration commands, one per line. End with CNTL/Z.
GZ(config)#int s0/1
GZ(config-if)#no ip ospf network broadcast
GZ(config-if)#no ip ospf priority 0
GZ(config-if)#no shut
GZ(config-if)#end
GZ#
01:03:21: %SYS-5-CONFIG_I: Configured from console by console
GZ#show ip ospf int s0/1
Serial0/1 is up, line protocol is up
Internet Address 192.168.1.2/24, Area 0
Process ID 64, Router ID 2.2.2.2, Network Type NON_BROADCAST, Cost: 48
Transmit Delay is 1 sec, State DR, Priority 1 //默认优先级为1
Designated Router (ID) 2.2.2.2, Interface address 192.168.1.2
No backup designated router on this network
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:01
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
注意:这个时候网络类型为默认类型非广播类型(Frame-relay)
开始OSPF 点到多点的配置 ,SZ ,GZ,DG路由器的配置类似。
GZ>
GZ>en
GZ#config t
Enter configuration commands, one per line. End with CNTL/Z.
GZ(config)#int s0/1
GZ(config-if)#ip ospf network point-to-multipoint //配置点到多点类型
GZ(config-if)#no shut
GZ(config-if)#end
GZ#
01:48:37: %SYS-5-CONFIG_I: Configured from console by console
注:网络配置为点到多点类型
验证一下:
GZ#show ip ospf int s0/1
Serial0/1 is up, line protocol is up
Internet Address 192.168.1.2/24, Area 0
Process ID 64, Router ID 2.2.2.2, Network Type POINT_TO_MULTIPOINT, Cost: 48
Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:17
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 1.1.1.1
Suppress hello for 0 neighbor(s)
注:网络类型为点到多点类型,这意味着没有DR/BDR,也不需要定义邻居
GZ#show ip ospf neighbor //查看OSPF邻居
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/ - 00:01:54 192.168.1.1 Serial0/1
注意:GZ与SZ时完全邻接的,但并没有DR的概念,这条链路被看作点到点的链路
OSPF的路由表:
GZ#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/49] via 192.168.1.1, 00:13:12, Serial0/1
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/97] via 192.168.1.1, 00:13:12, Serial0/1
192.168.1.0/24 is variably subnetted, 3 subnets, 2 masks
O 192.168.1.1/32 [110/48] via 192.168.1.1, 00:13:12, Serial0/1
C 192.168.1.0/24 is directly connected, Serial0/1
O 192.168.1.3/32 [110/96] via 192.168.1.1, 00:13:12, Serial0/1
验证连通性:
GZ#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 92/128/168 ms
GZ#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 188/215/240 ms
情况表明网络正常!
到这里点到多点配置完成。
本文出自 “我是一只小小鸟” 博客,转载请与作者联系!