OSPF在帧中继环境中的解决方法

OSPF在帧中继环境中的解决方法
【实验目的】
l 掌握OSPF在NBMA环境下不同的解决方法
【命令列表】
命令 描述
l Frame-relay switching 将路由器模拟成帧中继交换机
l Encapsulation frame-relay
将接口封装成帧中继接口
l Frame-relay intf-type dce
更改接口类型为dce
l Frame-relay route {input dlci} interface {出口} { output dlci} 指定DLCI号的对应关系
l Ip ospf priority {0-255} 设备路由器优先级,手动指定DR
l Neighbor {IP address} 手动指定邻居
l Ip ospf network broadcast 将接口改为BMA 广播多访问型
l Ip ospf network non-broadcast 将接口改为NBMA 非广播多访问型
l Ip ospf network point-to-multipoint 将接口改为点到多点类型
l Ip ospf network point-to-point 将接口改为点到点类型
l frame-relay map ip {IP address} {DLCI} broadcas手动指定IP地址和DLCI号的关系
l show frame-relay route 查看DLCI对应关系和状态
l show frame-relay map 查看IP和DLCI号的对应关系
l clear ip ospf process 重启OSPF协议
【实验过程】
步骤一:配置IP
R1
接口 IP地址
S1/0 192.168.1.1
L0 1.1.1.1
R2
接口 IP地址
S1/0 192.168.1.2
L0 2.2.2.2
R3
接口 IP地址
S1/0 192.168.1.3
L0 3.3.3.3
* 注:接口必须封装成帧中继接口
步骤二:配置帧中继及DLCI的对应关系
FRSW
frsw(config)#frame-relay switching
frsw(config)#in s1/0
frsw(config-if)#encapsulation fram
frsw(config-if)#encapsulation frame-relay
frsw(config-if)#frame-relay intf
frsw(config-if)#frame-relay intf-type dce
frsw(config-if)#frame-relay route 102 interface s1/2 201
frsw(config-if)#frame-relay route 103 interface s1/1 301
frsw(config-if)#no shutdown
frsw(config-if)#in s1/1
frsw(config-if)#en frame-relay
frsw(config-if)#frame-relay intf-type dce
frsw(config-if)#frame-relay route 301 interface s1/0 103
frsw(config-if)#no shutdown
frsw(config-if)#in s1/2
frsw(config-if)#en frame-relay
frsw(config-if)#frame-relay intf-type dce
frsw(config-if)#frame-relay route 201 interface s1/0 102
frsw(config-if)#no shutdown
将路由器模拟成帧中继,改变接口类型,配置DLCI号的对应关系。
* 注:虽然不用配IP,no shutdown还是要打的。
步骤三:查看网络是否正常
FRSW
frsw#show frame-relay route
Input Intf Input Dlci Output Intf Output Dlci Status
Serial1/0 102 Serial1/2 201 active
Serial1/0 103 Serial1/1 301 active
Serial1/1 301 Serial1/0 103 active
Serial1/2 201 Serial1/0 102 active
处有接口处于激活状态,说明帧中继的配置没问题。
R1
r1#show frame-relay map
Serial1/0 (up): ip 192.168.1.2 dlci 102(0x66,0x1860), dynamic,
broadcast,
CISCO, status defined, active
Serial1/0 (up): ip 192.168.1.3 dlci 103(0x67,0x1870), dynamic,
broadcast,, status defined, active
r1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 312/609/864 ms
r1#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 = 448/608/720 ms
路由器动态学习到了DLCI号和IP的对应关系,测试说明是正常的。
R2
r2#show frame-relay map
Serial1/0 (up): ip 192.168.1.1 dlci 201(0xC9,0x3090), dynamic,
broadcast,
CISCO, status defined, active
r2#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 = 432/613/864 ms
r2#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 0 percent (0/5)
可以看到路由器没有R3的IP和DLCI号的对应关系,不能进行通讯。
R3
r3#show frame-relay map
Serial1/0 (up): ip 192.168.1.1 dlci 301(0x12D,0x48D0), dynamic,
broadcast,, status defined, active
r3#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 = 576/692/864 ms
r3#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
路由器上没R2的IP和DLCI号的对应关系,也不能进行通讯。
步骤四:启用OSPF协议
R1
r1(config)#router ospf 1
r1(config-router)#network 1.1.1.0 0.0.0.255 area 0
r1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R2
r2(config)#router ospf 1
r2(config-router)#network 2.2.2.0 0.0.0.255 area 0
r2(config-router)#network 192.168.1.0 0.0.0.255 area 0
R3
r3(config)#router ospf 1
r3(config-router)#network 3.3.3.0 0.0.0.255 area 0
r3(config-router)#network 192.168.1.0 0.0.0.255 area 0
配置OSPF协议,查看路由表,如下:
R1
r1#show ip route
C 192.168.1.0/24 is directly connected, Serial1/0
r1#show ip ospf neighbor
R2
r2#show ip route
C 192.168.1.0/24 is directly connected, Serial1/0
r2#show ip ospf neighbor
R3
r3#show ip route
C 192.168.1.0/24 is directly connected, Serial1/0
r3#show ip ospf neighbor
OSPF并没有学到任何条目,从查看邻居的命令可以看出他们都没有邻居。原因是帧中继是二层寻址,而OSPF的邻居的形成是通过三层寻址。
步骤五:OSPF在帧中继环非全网状环境下的解决方法
方法一:在默认NBMA环境下手动指定邻居,DR,IP和DLCI的对应关系。
R1
r1(config-if)#router ospf 1
r1(config-router)#neighbor 192.168.1.2
r1(config-router)#neighbor 192.168.1.3
r1(config)#in s1/0
r1(config-if)#ip ospf priority 255
r1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R2
r1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
r2(config)#router ospf 1
r2(config-router)#neighbor 192.168.1.1
r2(config-router)#in s1/0
r2(config-if)#ip ospf priority 0
r2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R3
r3(config)#router ospf 1
r3(config-router)#neighbor 192.168.1.1
r3(config-router)#in s1/0
r3(config-if)#ip ospf priority 0
r3#clear ip ospf process
Reset ALL OSPF processes? [no]: y
将三台路由器手动指定邻居,把R1的优先级改为最高,使其的DR地位不会变更,R2和R3的改为0,不参与DR选举,再重启OSPF使手动更改生效。查看路由表如下:
R1
r1#show ip route
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/65] via 192.168.1.2, 00:00:24, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 192.168.1.3, 00:00:24, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
R2
r2#show ip route
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.168.1.1, 00:00:04, Serial1/0
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/65] via 192.168.1.3, 00:00:04, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
居然学到了R3的环回地址,但他的下一跳在上面的测试中是不可达的,重新验证下,
r2#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)
和上面的测试结果一样,由于帧中继是二层通过DLCI号寻址,他跟本不知道192.168.1.3从哪个DLCI号出去,所以PING不通,手动配置下IP和DLCI号的关系后再验证。
r2(config)#in s1/0
r2(config-if)#frame-relay map ip 192.168.1.3 201 broadcast
r2#show frame-relay map
Serial1/0 (up): ip 192.168.1.1 dlci 201(0xC9,0x3090), dynamic,
broadcast,
CISCO, status defined, active
Serial1/0 (up): ip 192.168.1.3 dlci 201(0xC9,0x3090), static,
broadcast,
CISCO, status defined, active
可以看到配置生效了,为了保险起见,看下R3的路由表
R3
r3#show ip route
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.168.1.1, 00:00:11, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 192.168.1.2, 00:00:11, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial1/0
可以看到R3也学到了R2的环回地址,和R2一样,都没有DLCI号的对应关系,这时即使R2的数据能到达R3,R3也不能进行回应,所以也必须手动配置IP和DLCI的对应关系。
r3(config)#in s1/0
r3(config-if)#frame-relay map ip 192.168.1.2 301 broadcast
r3#show frame-relay map
Serial1/0 (up): ip 192.168.1.1 dlci 301(0x12D,0x48D0), dynamic,
broadcast,, status defined, active
Serial1/0 (up): ip 192.168.1.2 dlci 301(0x12D,0x48D0), static,
broadcast,
CISCO, status defined, active
配置完成后,分别到两台路由器上进行验证。
R2
r2#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:
!!!!!
R3
r3#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
成功解决了问题,该方法是有效的,但手配置的步骤太多,再看下其他方法是否更简单。
方法二:使用Ip ospf network broadcast命令将接口改成BMA多路访问广播类型
R1
r1(config)#in s1/0
r1(config-if)#ip ospf network broadcast
R2
r2(config)#in s1/0
r2(config-if)#ip ospf network broadcast
R3
r3(config)#in s1/0
r3(config-if)#ip ospf network broadcast
在路由器的接口下改变接口为BMA广播多路访问类型,默认情况下是NBMA非广播多路访问类型。
R1
r1#show ip route
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/65] via 192.168.1.2, 00:01:57, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 192.168.1.3, 00:01:57, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
R2
r2#show ip route
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.168.1.1, 00:10:15, Serial1/0
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/129] via 192.168.1.1, 00:10:15, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
学到了R3的环回地址,而且下一跳192.168.1.1路由器是知道怎么走的,难道成功了,测试下:
r2#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: .....
奇怪了,为什么会不通,路由器除了没有到192.168.1.3的DLCI对应关系外其他的都正常,而192.168.1.1的对应关系是有的,难道R3不能回复,看下R3的路由表再说。
R3
r3#show ip route
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.168.1.1, 00:09:27, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/129] via 192.168.1.1, 00:09:27, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial1/0
很清楚的看到,路由器能回应R2的环回地址,但不能回应192.168.1.2,因为没有他的DLCI的对应关系,而使用ping命令时源地址默认使用的是离目标最近的地址,也就是192.168.1.2,所以ping不通,在R2上以源地址为环回口,用扩展ping命令测试下。
R2
r2#ping
Target IP address: 3.3.3.3
Source address or interface: 2.2.2.2
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
说明上面的推理是正确的,这时只需要手工配置R2和R3上DLCI号的对应关系就行了。
R2
r2(config-if)#frame-relay map ip 192.168.1.3 201 broadcast
R3
r3(config-if)#frame-relay map ip 192.168.1.2 301 broadcast
配置完成,测试结果如下:
R2
r2#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:
!!!!!
R3
r3#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
测试成功。
 

你可能感兴趣的:(职场,休闲,ospf)