13.把NBMA网络类型改成broadcast网络
R1(config)#router ospf 1 R1(config-router)#no neighbor 192.168.0.3 //取消邻居指定 R1(config-router)#no neighbor 192.168.0.2 R1(config-router)#exit R1(config)#interface s0/0 R1(config-if)#ip ospf network broadcast //修改OSPF网络类型为broadcast R1(config-if)#end |
R2(config)#interface s0/1 R2(config-if)#no ip ospf priority 0 //取消接口优先级指定 R2(config-if)#ip ospf network broadcast R2(config-if)#end |
R3(config)#interface s0/2 R3(config-if)#no ip ospf priority 0 R3(config-if)#ip ospf network broadcast R3(config-if)#end |
说明:当OSPF网络类型修改为broadcast时候,就不需要手动指定邻居,OSPF会用组播224.0.0.5自动建立邻居关系。
14.查看OSPF信息
R1#show ip ospf int Serial0/0 is up, line protocol is up Internet Address 192.168.0.1/24, Area 0 Process ID 1, Router ID 192.168.0.1, Network Type BROADCAST, Cost: 64 Transmit Delay is 1 sec, State DR, Priority 1 //默认优先级是1 Designated Router (ID) 192.168.0.1, Interface address 192.168.0.1 Backup Designated router (ID) 3.3.3.3, Interface address 192.168.0.3 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:01 Supports Link-local Signaling (LLS) 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 4 msec Neighbor Count is 2, Adjacent neighbor count is 2 Adjacent with neighbor 2.2.2.2 Adjacent with neighbor 3.3.3.3 (Backup Designated Router) Suppress hello for 0 neighbor(s) Loopback0 is up, line protocol is up Internet Address 1.1.1.1/24, Area 0 Process ID 1, Router ID 192.168.0.1, Network Type LOOPBACK, Cost: 1 Loopback interface is treated as a stub Host |
15.查看OSPF邻居表
R1#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/DROTHER 00:00:37 192.168.0.2 Serial0/0 3.3.3.3 1 FULL/BDR 00:00:37 192.168.0.3 Serial0/0 |
R2#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 192.168.0.1 1 FULL/DR 00:00:30 192.168.0.1 Serial0/1 说明:此时,R2是DR。 |
16.测试连通性
R1#ping 3.3.3.3 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/56/80 ms R1#ping 2.2.2.2 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 16/52/68 ms |
R3#ping 1.1.1.1 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/39/72 ms R3#ping 2.2.2.2 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 64/90/108 ms |
17.把broadcast类型网络改成point-to-multipoint网络
R1(config)#interface s0/0 R1(config-if)#no ip ospf network broadcast R1(config-if)#ip ospf network point-to-multipoint //把OSPF网络类型改成点到多点 R1(config-if)#end |
R2(config)#int s0/1 R2(config-if)#no ip ospf network broadcast R2(config-if)#ip ospf network point-to-multipoint R2(config-if)#end |
R3(config)#int s0/2 R3(config-if)#no ip ospf network broadcast R3(config-if)#ip ospf network point-to-multipoint R3(config-if)#end |
18.查看OSPF的邻居表
R1#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 0 FULL/ - 00:01:41 192.168.0.3 Serial0/0 2.2.2.2 0 FULL/ - 00:01:46 192.168.0.2 Serial0/0 R2#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 192.168.0.1 0 FULL/ - 00:01:35 192.168.0.1 Serial0/1 R3#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 192.168.0.1 0 FULL/ - 00:01:57 192.168.0.1 Serial0/2 |
说明:OSPF把点到多点网络看成多条点到点网络的集合,所以它具有点到点网络的特点,即支持广播,没有DR和BDR的选举。
19.测试连通性
R1#ping 2.2.2.2 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 36/69/92 ms R1#ping 3.3.3.3 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 36/71/92 ms R3#ping 1.1.1.1 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 36/70/108 ms R3#ping 2.2.2.2 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/86/128 ms |
20.网络把Point-to-multipoint类型网络改成point-to-multipoint nonbroadcast
R1(config)#interface s0/0 R1(config-if)#no ip ospf network point-to-multipoint R1(config-if)#ip ospf network point-to-multipoint non-broadcast //指定网络类型为点到多点非广播 R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#neighbor 192.168.0.2 //指定邻居 R1(config-router)#neighbor 192.168.0.3 R1(config-router)#end |
说明:OSPF认为点到多点非广播网络没有广播能力,所以必须手动指定邻居,没有DR和BDR选举
R2(config)#interface s0/1 R2(config-if)#no ip ospf network point-to-multipoint R2(config-if)#ip ospf network point-to-multipoint non-broadcast R2(config-if)#end R3(config)#interface s0/2 R3(config-if)#no ip ospf network point-to-multipoint R3(config-if)#ip ospf network point-to-multipoint non-broadcast R3(config-if)#end |
21.查看OSPF邻居表
R1#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 0 FULL/ - 00:01:31 192.168.0.3 Serial0/0 2.2.2.2 0 FULL/ - 00:01:31 192.168.0.2 Serial0/0 R2#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 192.168.0.1 0 FULL/ - 00:01:47 192.168.0.1 Serial0/1 R3#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface 192.168.0.1 0 FULL/ - 00:01:34 192.168.0.1 Serial0/2 |
22.测试连通性
R1#ping 3.3.3.3 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 12/48/84 ms R1#ping 2.2.2.2 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 16/53/84 ms R2#ping 3.3.3.3 source lo0
Type escape sequence to abort. 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 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 24/55/96 ms R2#ping 1.1.1.1 source lo0
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 2.2.2.2 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/50/76 ms |