R1配置
r1(config)#int s3/0
r1(config-if)#en fr
r1(config-if)#no fr inv
r1(config-if)#frame map ip 192.168.0.2 102 b
r1(config-if)#ip ad 192.168.0.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#end
R2配置
r2(config)#int s3/0
r2(config-if)#en fr
r2(config-if)#fr map ip 192.168.0.1 201 b
r2(config-if)#no fr inv
r2(config-if)#ip ad 192.168.0.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#end
R1配置路由
r1(config)#router os 100
r1(config-router)#net 192.168.0.1 0.0.0.0 a 0
r1(config-router)#exi
R2配置路由
r2(config)#router os 100
r2(config-router)#net 192.168.0.2 0.0.0.0 a 0
r2(config-router)#exi
查看R1网络类型
r1#sh ip ospf int
Serial3/0 is up, line protocol is up
Internet Address 192.168.0.1/24, Area 0
Process ID 100, Router ID 192.168.0.1, Network Type NON_BROADCAST, Cost: 64 网络类型为非广播
Transmit Delay is 1 sec, State WAITING, Priority 1
No designated router on this network
No backup designated router on this network
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:26
Wait time before Designated router selection 00:01:26
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
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)
更改R1,R2的网络类型
r1(config)#int s3/0
r1(config-if)#ip os net b
r1(config-if)#exi
r1(config)#do sh ip os int
Serial3/0 is up, line protocol is up
Internet Address 192.168.0.1/24, Area 0
Process ID 100, Router ID 192.168.0.1, Network Type BROADCAST, Cost: 64 网络类型已经成为广播
Transmit Delay is 1 sec, State DROTHER, Priority 1
Designated Router (ID) 192.168.0.2, Interface address 192.168.0.2
Backup Designated router (ID) 192.168.0.2, Interface address 192.168.0.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:06
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
r2(config)# int s3/0
r2(config-if)#ip ospf network broadcast
清除OSPF进程,调试R1,R2邻居建立过程
r1#deb ip os adj
OSPF adjacency events debugging is on
r1#clear ip os pr
Reset ALL OSPF processes? [no]: y
r1#
*Jul 23 15:03:48.747: OSPF: Interface Serial3/0 going Down
*Jul 23 15:03:48.747: OSPF: 192.168.0.1 address 192.168.0.1 on Serial3/0 is dead, state DOWN
*Jul 23 15:03:48.747: OSPF: Neighbor change Event on interface Serial3/0
*Jul 23 15:03:48.747: OSPF: DR/BDR election on Serial3/0
*Jul 23 15:03:48.747: OSPF: Elect BDR 0.0.0.0
*Jul 23 15:03:48.747: OSPF: Elect DR 192.168.0.2
*Jul 23 15:03:48.747: OSPF: Elect BDR 0.0.0.0
*Jul 23 15:03:48.747: OSPF: Elect DR 192.168.0.2
*Jul 23 15:03:48.747: DR: 192.168.0.2 (Id) BDR: none
*Jul 23 15:03:48.747: OSPF: 192.168.0.2 address 192.168.0.2 on Serial3/0 is dead, state DOWN
*Jul 23 15:03:48.747: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.0.2 on Serial3/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Jul 23 15:03:48.751: OSPF: Neighbor change Event on interface Serial3/0
*Jul 23 15:03:48.751: OSPF: DR/BDR election on Serial3/0
*Jul 23 15:03:48.751: OSPF: Elect BDR 0.0.0.0
*Jul 23 15:03:48.751: OSPF: Elect DR
r1# 0.0.0.0
*Jul 23 15:03:48.751: DR: none BDR: none
*Jul 23 15:03:48.751: OSPF: Remember old DR 192.168.0.2 (id)
*Jul 23 15:03:48.763: OSPF: Interface Serial3/0 going Up
*Jul 23 15:03:48.879: OSPF: 2 Way Communication to 192.168.0.2 on Serial3/0, state 2WAY
*Jul 23 15:03:48.879: OSPF: Backup seen Event before WAIT timer on Serial3/0
*Jul 23 15:03:48.879: OSPF: DR/BDR election on Serial3/0
*Jul 23 15:03:48.879: OSPF: Elect BDR 192.168.0.1
*Jul 23 15:03:48.883: OSPF: Elect DR 192.168.0.2
*Jul 23 15:03:48.883: OSPF: Elect BDR 192.168.0.1
*Jul 23 15:03:48.883: OSPF: Elect DR 192.168.0.2
*Jul 23 15:03:48.883: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id)
*Jul 23 15:03:48.883: OSPF: Send DBD to 192.168.0.2 on Serial3/0 seq 0x13D4 opt 0x52 flag 0x7 len 32
*Jul 23 15:03:48.971: OSPF: Rcv DBD from 192.168.0.2 on Serial3/0 seq 0x3D9 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART
*Jul 23 15:03:48.971: OSPF: NBR Negotiation Done. We are the SLAVE
*Jul 23 15:03:48.
r1#971: OSPF: Send DBD to 192.168.0.2 on Serial3/0 seq 0x3D9 opt 0x52 flag 0x0 len 32
*Jul 23 15:03:49.047: OSPF: Rcv DBD from 192.168.0.2 on Serial3/0 seq 0x3DA opt 0x52 flag 0x3 len 72 mtu 1500 state EXCHANGE
*Jul 23 15:03:49.047: OSPF: Send DBD to 192.168.0.2 on Serial3/0 seq 0x3DA opt 0x52 flag 0x0 len 32
*Jul 23 15:03:49.071: OSPF: Rcv DBD from 192.168.0.2 on Serial3/0 seq 0x3DB opt 0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE
*Jul 23 15:03:49.071: OSPF: Exchange Done with 192.168.0.2 on Serial3/0
*Jul 23 15:03:49.071: OSPF: Send LS REQ to 192.168.0.2 length 24 LSA count 2
*Jul 23 15:03:49.075: OSPF: Send DBD to 192.168.0.2 on Serial3/0 seq 0x3DB opt 0x52 flag 0x0 len 32
*Jul 23 15:03:49.111: OSPF: Rcv LS UPD from 192.168.0.2 on Serial3/0 length 96 LSA count 2
*Jul 23 15:03:49.111: OSPF: Synchronized with 192.168.0.2 on Serial3/0, state FULL
*Jul 23 15:03:49.111: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.0.2 on Serial3/0 from LOADING to FULL, Loading Done
*Jul 23 15:03:49
r1#.247: OSPF: Build router LSA for area 0, router ID 192.168.0.1, seq 0x80000001
*Jul 23 15:03:50.939: OSPF: Neighbor change Event on interface Serial3/0
*Jul 23 15:03:50.939: OSPF: DR/BDR election on Serial3/0
*Jul 23 15:03:50.939: OSPF: Elect BDR 192.168.0.1
*Jul 23 15:03:50.939: OSPF: Elect DR 192.168.0.2
*Jul 23 15:03:50.939: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id)
r1#
*Jul 23 15:03:53.955: OSPF: Rcv LS UPD from 192.168.0.2 on Serial3/0 length 64 LSA count 1
*Jul 23 15:03:54.207: OSPF: Rcv LS UPD from 192.168.0.2 on Serial3/0 length 64 LSA count 1
r1#
*Jul 23 15:03:55.103: OSPF: Build router LSA for area 0, router ID 192.168.0.1, seq 0x80000003
r1#u all
All possible debugging has been turned off
r1#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
192.168.0.2 1 FULL/DR 00:00:32 192.168.0.2 Serial3/0
更改R1,R2的网络类型为点到点
r1(config)#int s3/0
r1(config-if)#ip ospf network point-to-point
r2(config)#int s3/0
r2(config-if)#ip ospf net point-to-p
查看修改后的效果
r1#sh ip os int
Serial3/0 is up, line protocol is up
Internet Address 192.168.0.1/24, Area 0
Process ID 100, Router ID 192.168.0.1, Network Type POINT_TO_POINT, Cost: 64 网络类型现在为点到点
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:09
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 192.168.0.2
Suppress hello for 0 neighbor(s)