****######拓补图见文章结尾#######**R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#no ip domain-lookup
R1(config)#inter l 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#inter f0/0
R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#line con 0
R1(config-line)#exec-timeout 0 0
R1(config-line)#logging synchronous
R1(config-line)#end
基础配置
R1#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Loopback0 1.1.1.1 YES manual up up
R1#ping 12.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 20/23/28 ms
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1#debug ip ospf packet (开启ospf报文调试模式)
OSPF packet debugging is on
R1#debug ip ospf adj (开启ospf邻接建立过程报文调试模式)
OSPF adjacency events debugging is on
R1(config)#router ospf 2(进入ospf进程)
R1(config-router)router-id 1.1.1.1(路由器本地唯一身份标识,建议手工指定)
R1(config-router)#network 12.1.1.0 0.0.0.255 area 0(宣告f0/0接口到骨干区域,用反掩码做精确匹配)
R1(config-router)#(开始调试模式)
*Mar 1 00:12:24.507: OSPF: rcv. v:2 t:1 l:44 rid:2.2.2.2
aid:0.0.0.0 chk:E89A aut:0 auk: from FastEthernet0/0*Mar 1 00:12:24.543: OSPF: rcv. v:2 t:2 l:32 rid:2.2.2.2
aid:0.0.0.0 chk:9E73 aut:0 auk: from FastEthernet0/0*Mar 1 00:12:24.543: OSPF: Rcv DBD from 2.2.2.2 on FastEthernet0/0 seq 0x383 opt 0x52 flag 0x7 len 32 mtu 1500 state INIT
*Mar 1 00:12:24.543: OSPF: 2 Way Communication to 2.2.2.2 on FastEthernet0/0, state 2WAY
*Mar 1 00:12:24.543: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 00:12:24.543: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:12:24.543: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:12:24.543: OSPF: Elect DR 1.1.1.1
*Mar 1 00:12:24.547: DR: 1.1.1.1 (Id) BDR: 2.2.2.2 (Id)
*Mar 1 00:12:24.547: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0 seq 0x1620 opt 0x52 flag 0x7 len 32
*Mar 1 00:12:24.547: OSPF: NBR Negotiation Done. We are the SLAVE
*Mar 1 00:12:24.547: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0
R1(config-rout seq 0x383 opt 0x52 flag 0x2 len 52
*Mar 1 00:12:24.555: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
aid:0.0.0.0 chk:CC8F aut:0 auk: from FastEthernet0/0*Mar 1 00:12:24.555: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 00:12:24.555: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:12:24.559: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:12:24.559: OSPF: Elect DR 1.1.1.1
*Mar 1 00:12:24.559: DR: 1.1.1.1 (Id) BDR: 2.2.2.2 (Id)
*Mar 1 00:12:24.559: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 00:12:24.559: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:12:24.559: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:12:24.559: OSPF: Elect DR 1.1.1.1
*Mar 1 00:12:24.559: DR: 1.1.1.1 (Id) BDR: 2.2.2.2 (Id)
*Mar 1 00:12:24.591: OSPF: rcv. v:2 t:2 l:32 rid:2.2.2.2
aid:0.0.0.0 chk:9E78 aut:0 auk: from FastEthernet0/0*Mar 1 00:12:24.591: OSPF: Rcv DBD from 2.2.2.2 on FastEthernet0/0 seq 0x384 opt 0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE
*Mar 1 00:12:24.591: OSPF: Exchange Done with 2.2.2.2 on FastEthernet0/0
*Mar 1 00:12:24.595: OSPF: Synchronized with 2.2.2.2 on FastEthernet0/0, state FULL
*Mar 1 00:12:24.595: %OSPF-5-ADJCHG: Process 2, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar 1 00:12:24.595: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0 seq 0x384 opt 0x52 flag 0x0 len 32
*Mar 1 00:12:24.631: OSPF: rcv. v:2 t:3 l:36 rid:2.2.2.2
aid:0.0.0.0 chk:F5CF aut:0 auk: from FastEthernet0/0*Mar 1 00:12:24.635: OSPF: Rcv LS REQ from 2.2.2.2 on FastEthernet0/0 length 36 LSA count 1
*Mar 1 00:12:24.635: OSPF: Send UPD to 12.1.1.2 on FastEthernet0/0 length 40 LSA count 1
*Mar 1 00:12:25.003: OSPF: rcv. v:2 t:4 l:64 rid:2.2.2.2
aid:0.0.0.0 chk:139C aut:0 auk: from FastEthernet0/0*Mar 1 00:12:25.007: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 64 LSA count 1
*Mar 1 00:12:25.047: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000002, process 2
*Mar 1 00:12:25.095: OSPF: Build network LSA for FastEthernet0/0, router ID 1.1.1.1
*Mar 1 00:12:25.095: OSPF: Build network LSA for FastEthernet0/0, router ID 1.1.1.1er)#
R1(config-router)#
*Mar 1 00:12:27.159: OSPF: rcv. v:2 t:5 l:84 rid:2.2.2.2
aid:0.0.0.0 chk:9EC5 aut:0 auk: from FastEthernet0/0R1(config-router)#
*Mar 1 00:12:33.603: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
aid:0.0.0.0 chk:CC8F aut:0 auk: from FastEthernet0/0R1(config-router)#
*Mar 1 00:12:43.355: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
aid:0.0.0.0 chk:CC8F aut:0 auk: from FastEthernet0/0R1(config-router)#end(结束调试模式)
R1#un all(关闭所有调试模式)
All possible debugging has been turned off
R1#sh ip ospf interface (查看ospf接口信息)
FastEthernet0/0 is up, line protocol is up
Internet Address 12.1.1.1/24, Area 0
Process ID 2, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 1.1.1.1, Interface address 12.1.1.1
Backup Designated router (ID) 2.2.2.2, Interface address 12.1.1.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:08Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
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 2.2.2.2 (Backup Designated Router)Suppress hello for 0 neighbor(s)
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router ospf 2
R1(config-router)#network 1.1.1.1 0.0.0.255 area 0(宣告环回口路由)
R1(config-router)#end
R1#sh
*Mar 1 00:27:16.359: %SYS-5-CONFIG_I: Configured from console by console
R1#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnetsO 2.2.2.2 [110/11] via 12.1.1.2, 00:00:16, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnetsC 12.1.1.0 is directly connected, FastEthernet0/0
R1#sh ip ospf interface b
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 2 0 1.1.1.1/24 1 LOOP 0/0
Fa0/0 2 0 12.1.1.1/24 10 DR 1/1
Building configuration...
[OK]
R1配置结束
R2配置开始
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#no ip domain-lookup
R2(config)#inter l 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#inter f0/0
R2(config-if)#ip add 12.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#line con 0
R2(config-line)#exec-timeout 0 0
R2(config-line)#logging synchronous
R2(config-line)#end
基础配置
R2#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.2 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Loopback0 2.2.2.2 YES manual up up
R2#debug ip ospf packet (开启ospf报文调试模式)
OSPF packet debugging is on
R2#debug ip ospf adj (开启ospf邻接建立过程报文调试模式)
OSPF adjacency events debugging is on
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router ospf 2 (进入ospf进程)
R2(config-router)#router-id 2.2.2.2 (路由器本地唯一身份标识,建议手工指定)
R2(config-router)#network 12.1.1.0 0.0.0.255 area 0 (宣告f0/0接口到骨干区域,用反掩码做精确匹配)
R2(config-router)#(开始调试模式)
*Mar 1 00:12:23.087: OSPF: Interface FastEthernet0/0 going Up
*Mar 1 00:12:23.119: OSPF: rcv. v:2 t:1 l:48 rid:1.1.1.1
aid:0.0.0.0 chk:D992 aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.123: OSPF: 2 Way Communication to 1.1.1.1 on FastEthernet0/0, state 2WAY
*Mar 1 00:12:23.123: OSPF: Backup seen Event before WAIT timer on FastEthernet0/0
*Mar 1 00:12:23.123: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:12:23.123: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:12:23.123: OSPF: Elect DR 1.1.1.1
*Mar 1 00:12:23.123: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:12:23.123: OSPF: Elect DR 1.1.1.1
*Mar 1 00:12:23.123: DR: 1.1.1.1 (Id) BDR: 2.2.2.2 (Id)
*Mar 1 00:12:23.123: OSPF: Send DBD to 1.1.1.1 on FastEthernet0/0 seq 0x383 opt 0x52 flag 0x7 len 32
*Mar 1 00:12:23.155: OSPF: rcv. v:2 t:2 l:32 rid:1.1.1.1
aid:0.0.0.0 chk:8DD8 aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.159: OSPF: Rcv DBD from 1.1.1.1 on FastEthernet0/0 seq 0x1620 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART
*Mar 1 00:12:23.159: OSPF: First DBD and we are not SLAVE
*Mar 1 00:12:23.163: OSPF: rcv. v:2 t:2 l:52 rid:1.1.1.1
aid:0.0.0.0 chk:4358 aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.163: OSPF: Rcv DBD from 1.1.1.1 on FastEthernet0/0 seq 0x383 opt 0x52 flag 0x2 len 52 mtu 1500 state EXSTART
*Mar 1 00:12:23.167: OSPF: NBR Negotiation Done. We are the MASTER
*Mar 1 00:12:23.167: OSPF: Send DBD to 1.1.1.1 on FastEthernet0/0 seq 0x384 opt 0x52 flag 0x1 len 32
*Mar 1 00:12:23.207: OSPF: rcv. v:2 t:2 l:32 rid:1.1.1.1
aid:0.0.0.0 chk:A07B aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.207: OSPF: Rcv DBD from 1.1.1.1 on FastEthernet0/0 seq 0x384 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE
*Mar 1 00:12:23.211: OSPF: Exchange Done with 1.1.1.1 on FastEthernet0/0
*Mar 1 00:12:23.211: OSPF: Send LS REQ to 1.1.1.1 length 12 LSA count 1
*Mar 1 00:12:23.243: OSPF: rcv. v:2 t:4 l:64 rid:1.1.1.1
aid:0.0.0.0 chk:8F9B aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.243: OSPF: Rcv LS UPD from 1.1.1.1 on FastEthernet0/0 length 64 LSA count 1
*Mar 1 00:12:23.247: OSPF: Synchronized with 1.1.1.1 on FastEthernet0/0, state FULL
*Mar 1 00:12:23.247: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar 1 00:12:23.587: OSPF: Build router LSA for area 0, router ID 2.2.2.2, seq 0x80000001, process 2
*Mar 1 00:12:23.643: OSPF: rcv. v:2 t:4 l:64 rid:1.1.1.1
aid:0.0.0.0 chk:DDD5 aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.647: OSPF: Rcv LS UPD from 1.1.1.1 on FastEthernet0/0 length 64 LSA count 1
*Mar 1 00:12:23.699: OSPF: rcv. v:2 t:4 l:60 rid:1.1.1.1
aid:0.0.0.0 chk:FABC aut:0 auk: from FastEthernet0/0*Mar 1 00:12:23.703: OSPF: Rcv LS UPD from 1.1.1.1 on FastEthernet0/0 length 60 LSA count 1
R2(config-router)#end (结束调试模式)
R2#un all(关闭所有调试模式)
All possible debugging has been turned off
R2#
*Mar 1 00:12:39.727: OSPF: rcv. v:2 t:1 l:48 rid:1.1.1.1
aid:0.0.0.0 chk:CC8F aut:0 auk: from FastEthernet0/0R2#sh ip ospf in
R2#sh ip ospf interface
FastEthernet0/0 is up, line protocol is up
Internet Address 12.1.1.2/24, Area 0
Process ID 2, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 1.1.1.1, Interface address 12.1.1.1
Backup Designated router (ID) 2.2.2.2, Interface address 12.1.1.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:00Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
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 (Designated Router)Suppress hello for 0 neighbor(s)
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router ospf 2
R2(config-router)#network 2.2.2.2 0.0.0.255 area 0
R2(config-router)#end
R2#
*Mar 1 00:27:11.471: %SYS-5-CONFIG_I: Configured from console by console!
R2#sh ip ospf interface b
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 2 0 2.2.2.2/24 1 LOOP 0/0
Fa0/0 2 0 12.1.1.2/24 10 BDR 1/1
R2#wr
Building configuration...
[OK]
加粗文字