OSPF Cheat Sheet
The following are a list of commands and syntax used when working with OSPF.
Show OSPF configuration on the local router or L3 switch:
4510RE-SW1#sh run | b router ospf
router ospf 1
log-adjacency-changes
area 0 range 10.0.0.0 255.255.252.0
network 172.16.101.0 0.0.0.255 area 0
network 172.16.201.0 0.0.0.255 area 1
!
Show local routes, both static and OSPF. Note: O refers to OSPF defined routes.
4510RE-SW1
#sh ip rou
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 route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.201.0 is directly connected, FastEthernet0/0.410
C 172.16.101.0 is directly connected, FastEthernet0/0.400
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O 10.0.2.0/24 [110/2] via 172.16.101.2, 00:32:16, FastEthernet0/0.400
O 10.0.3.0/24 [110/2] via 172.16.101.2, 00:32:16, FastEthernet0/0.400
O 10.0.0.0/24 [110/2] via 172.16.101.2, 00:32:16, FastEthernet0/0.400
C 10.1.0.0/30 is directly connected, FastEthernet0/0
O 10.0.1.0/24 [110/2] via 172.16.101.2, 00:32:16, FastEthernet0/0.400
O 10.0.4.0/24 [110/2] via 172.16.101.2, 00:32:16, FastEthernet0/0.400
C 192.168.255.0/24 is directly connected, FastEthernet0/1.300
4510RE-SW1#
Show local routing table:
4510RE-SW1> show route
inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.0.0.0/22 *[OSPF/10] 00:00:54, metric 3
> to 172.16.201.1 via ge-0/0/3.410
10.0.4.0/24 *[OSPF/10] 00:40:29, metric 3
> to 172.16.201.1 via ge-0/0/3.410
172.16.88.2/32 *[Direct/0] 00:43:45
> via lo0.0
172.16.101.0/24 *[OSPF/10] 00:40:24, metric 2
> to 172.16.201.1 via ge-0/0/3.410
172.16.201.0/24 *[Direct/0] 00:41:24
> via ge-0/0/3.410
172.16.201.2/32 *[Local/0] 00:43:22
Local via ge-0/0/3.410
192.168.255.0/24 *[Direct/0] 00:41:28
> via ge-0/0/0.300
192.168.255.80/32 *[Local/0] 00:43:22
Local via ge-0/0/0.300
224.0.0.5/32 *[OSPF/10] 00:43:46, metric 1
MultiRecv
Show routes originating from OSPF:
4510RE-SW1#sh ip route ospf
10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks
O 10.0.2.0/24 [110/2] via 172.16.101.2, 00:12:10, FastEthernet0/0.400
O 10.0.3.0/24 [110/2] via 172.16.101.2, 00:12:10, FastEthernet0/0.400
O 10.0.0.0/24 [110/2] via 172.16.101.2, 00:12:10, FastEthernet0/0.400
O 10.0.0.0/22 is a summary, 00:12:10, Null0
O 10.0.1.0/24 [110/2] via 172.16.101.2, 00:12:10, FastEthernet0/0.400
O 10.0.4.0/24 [110/2] via 172.16.101.2, 00:12:10, FastEthernet0/0.400
11.0.0.0/24 is subnetted, 3 subnets
O E2 11.0.2.0 [110/0] via 172.16.201.2, 00:12:10, FastEthernet0/0.410
O E2 11.0.1.0 [110/0] via 172.16.201.2, 00:12:10, FastEthernet0/0.410
O E2 11.0.0.0 [110/0] via 172.16.201.2, 00:12:10, FastEthernet0/0.410
2621-R9#2621-R9#sh run | b router ospf
router ospf 1
log-adjacency-changes
area 0 range 10.0.0.0 255.255.252.0
area 1 range 11.0.0.0 255.255.254.0
network 172.16.101.0 0.0.0.255 area 0
network 172.16.201.0 0.0.0.255 area 1
!
Show routes related to route protocol OSPF:
4510RE-SW1> show route protocol ospf
inet.0: 22 destinations, 22 routes (22 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
11.0.0.0/24 *[OSPF/150] 00:17:20, metric 0, tag 0
> to 172.16.101.1 via ge-0/0/3.400
11.0.1.0/24 *[OSPF/150] 00:17:20, metric 0, tag 0
> to 172.16.101.1 via ge-0/0/3.400
11.0.2.0/24 *[OSPF/150] 00:17:20, metric 0, tag 0
> to 172.16.101.1 via ge-0/0/3.400
172.16.201.0/24 *[OSPF/10] 01:02:48, metric 2
> to 172.16.101.1 via ge-0/0/3.400
224.0.0.5/32 *[OSPF/10] 01:06:09, metric 1
MultiRecv
Additional diagnostic commands:
#show ip ospf database
#show ospf neighbor
#show ip ospf interface
A downloadable OSPF PDF cheat sheet is available here.
Comments are closed.