Wednesday, April 23, 2014

OSPF Adjacencies / OSPF Database

Lessons Learned:

OSPF initial configs – Routers R1 – R3 will be in Area 0.

router ospf 1234
log-adjacency-changes
network 192.168.12.0 0.0.0.255 area 0
network 192.168.13.0 0.0.0.255 area 0
!

Note: you can use an all zero’s network to advertise every interface into OSPF but that will limit the control you have over the networks.
EX:
Router ospf 0.0.0.0 255.255.255.255 are 0
Basically any Interface that has an IP Address assigned, ospf will be running on it

R1#sh ip protocols
Routing Protocol is "ospf 1234"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 192.168.13.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.12.0 0.0.0.255 area 0
    192.168.13.0 0.0.0.255 area 0
Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
  Distance: (default is 110)

Area 0 is going to be the backbone area for OSPF that all the other non- backbone areas are going to have to transit through to reach other. If you have more than one area you will need an Area 0.
Technically you can run all routers in Area 1 – but to transit to another area you would need to have and area 0 in the environment.

Once enabled we can issue a – “sh ip ospf” – This will show the basic information about the process       

R1#sh ip ospf
Routing Process "ospf 1234" with ID 192.168.13.1 -- > Says we’re running process # 1234. The router ID is 192.168.13.1

Start time: 00:14:01.904, Time elapsed: 00:09:13.688
Supports only single TOS(TOS0) routes

Supports opaque LSA  -- optional Capabilities
Supports Link-local Signaling (LLS) – Traffic engineering or NSF
Supports area transit capability  -- has to do with Virtual links
Router is not originating router-LSAs with maximum metric  -- Used for Stub router advertisement feature
Initial SPF schedule delay 5000 msecs – Default timers

Minimum hold time between two consecutive SPFs 10000 msecs  – Default timers
Maximum wait time between two consecutive SPFs 10000 msecs – Default timers  - this is a delay incase the process is rerun – gives a delay for changes in the network.

Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
    Area BACKBONE(0)  –This says the router currently two interfaces in the area 0
        Number of interfaces in this area is 2  - Number of interfaces
        Area has no authentication
        SPF algorithm last executed 00:00:02.308 ago
        SPF algorithm executed 4 times
        Area ranges are
        Number of LSA 3. Checksum Sum 0x00E639
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0

R1#

Basically the main verifications you’ll want to see form there is, what’s the process ID number. And whats the Router-ID.

Next:

We would want to look at the #SH IP OSPF Interfaces

FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.12.2/24, Area 0   --- The Interface Address and the Area

  Process ID 1234, Router ID 192.168.23.2, Network Type BROADCAST, Cost: 1 – Process ID (1234) and the Router ID and the network type (Broadcast) – The Cost value which is “1” which is derived from the interfaces bandwidth – the higher the bandwidth, the lower the cost value.

  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 192.168.23.2, Interface address 192.168.12.2
  Backup Designated router (ID) 192.168.13.1, Interface address 192.168.12.1
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5  -- Timers
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  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 4 msec, maximum is 4 msec

  Neighbor Count is 1, Adjacent neighbor count is 1  -- We have one neighbor and one adjacency. Technically there can be a difference between the neighbor count and the adjacency.

    Adjacent with neighbor 192.168.13.1  (Backup Designated Router)  -- Here is the Address of the neighbor that we’re adjacent with.
  Suppress hello for 0 neighbor(s)


This will show all the detail about the link level attributes of OSPF. Details of the interface

If we want ot just see an overall summary about the links we’re running OSPF on. We can issue the command –

# Sh IP ospf brief

R2#sh ip ospf interface brief
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Fa0/1        1234  0               192.168.23.2/24    1     BDR   1/1
Fa0/0        1234  0               192.168.12.2/24    1     DR    1/1
R2#              


Here we see there are two interfaces running OSPF. All in process 1234, all in area 0, the addresses of the interfaces. The Cost values. Then the “state” of the adjacency. In this example, the local router is the DR and there is one neighbor on the link.

If there was any problems with the adjacency – Example – mismatched Timers.

I’ll change the hello-timers on the interface between R2 and R3
Then run the debug command:
R2#debug ip ospf adj

We lose the neighbor right away.
*Mar  1 00:25:56.015: %OSPF-5-ADJCHG: Process 1234, Nbr 192.168.23.3 on FastEthernet0/1 from FULL to DOWN, Neighbor Down: Dead timer expired

#Sh ip ospf Neighbors

Now I only have one neighbor on R3 instead of two.

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.13.1      0   FULL/  -        00:00:31    192.168.13.1    Serial0/0
R3#

I can also verify the timer and neighbor adjacency with the debug command:

R3#debug ip ospf hello
OSPF hello events debugging is on

R3#
*Mar  1 00:29:59.659: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.23.3
*Mar  1 00:30:00.495: OSPF: Rcv hello from 192.168.23.2 area 0 from FastEthernet0/0 192.168.23.2
*Mar  1 00:30:00.499: OSPF: Mismatched hello parameters from 192.168.23.2
*Mar  1 00:30:00.499: OSPF: Dead R 40 C 20, Hello R 10 C 5  Mask R 255.255.255.0 C 255.255.255.0  -- Says – My dead interval received is 40, my local configured is 20.

Also – if the configured MTU is different we will not be able to form a full adjacency.
Example under the serial interface we change the MTU to 100. Then run the debug ip ospf command –

*Mar  1 00:30:55.251: OSPF: Retransmitting DBD to 192.168.23.3 on Serial0/0 [4]
*Mar  1 00:30:55.283: OSPF: Rcv DBD from 192.168.23.3 on Serial0/0 seq 0x11B8 opt 0x52 flag 0x7 len 32  mtu 1492 state EXSTART
*Mar  1 00:30:55.287: OSPF: Nbr 192.168.23.3 has larger interface MTU
R1#

We will be unable to form ADJ until this is corrected. Eventually after too many retransmissions the neighbors will time themselves out.

*Mar  1 00:34:04.387: OSPF: Retransmitting DBD to 192.168.23.3 on Serial0/0 [2]
*Mar  1 00:34:04.387: OSPF: Rcv DBD from 192.168.23.3 on Serial0/0 seq 0x1775 opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART – here is where we start to exchange copies of the database. Basic first exchange of LSA’s.

*Mar  1 00:34:04.387: OSPF: NBR Negotiation Done. We are the SLAVE
*Mar  1 00:34:04.387: OSPF: Send DBD to 192.168.23.3 on Serial0/0 seq 0x1775 opt 0x52 flag 0x2 len 172
*Mar  1 00:34:04.395: OSPF: Rcv DBD from 192.168.23.3 on Serial0/0 seq 0x1776 opt 0x52 flag 0x3 len 172  mtu 1500 state EXCHANGE

*Mar  1 00:34:04.395: OSPF: Send DBD to 192.168.23.3 on Serial0/0 seq 0x1776 opt 0x52 flag 0x0 len 32
*Mar  1 00:34:04.407: OSPF: Rcv DBD from 192.168.23.3 on Serial0/0 seq 0x1777 opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE

*Mar  1 00:34:04.407: OSPF: Exchange Done with 192.168.23.3 on Serial0/0
*Mar  1 00:34:04.407: OSPF: Synchronized with 192.168.23.3 on Serial0/0, state FULL
*Mar  1 00:34:04.407: %OSPF-5-ADJCHG: Process 1234, Nbr 192.168.23.3 on Serial0/0 from LOADING to FULL, Loading Done

*Mar  1 00:34:04.407: OSPF: Send DBD to 192.168.23.3 on Serial0/0 seq 0x1777 opt 0x52 flag 0x0 len 32
*Mar  1 00:34:04.891: OSPF: Rcv LS UPD from 192.168.23.3 on Serial0/0 length 88 LSA count 1
*Mar  1 00:34:04.947: OSPF: Build router LSA for area 0, router ID 192.168.13.1, seq 0x80000007
*Mar  1 00:34:04.959: OSPF: Rcv LS UPD from 192.168.23.2 on FastEthernet0/0 length 88 LSA count 1
R1#

OSPF Hello packets:
Example:
R1 sends a hello to R2.
R1 send a hello with its own Router-ID ex: a.b.c.d
R2 then sends a hello to R1 with tis router-ID ex: e.f.g.h AND the Router ID a.b.c.d


SH IP OSPF NEIGBORS:

R2#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DROTHER    00:00:35    192.168.23.3    FastEthernet0/1
10.45.4.4         1   FULL/BDR        00:00:34    192.168.23.4    FastEthernet0/1
1.1.1.1           1   FULL/BDR        00:00:35    192.168.12.1    FastEthernet0/0

I have 3 routers on this segment. The neighbor ID is the router-ID of the neighbor. One is the DR, one the BDR and the other is a DROTHER.  The table also lists the remaining Dead Time – the address of the neighbor and the interface it was learned over.

SH IP OSPF DATABSE:

If we show the database from any router in the topology, we should see that everyone has the identical information. For who are all the routers in the topology, and what are the connected links that they are advertising.
This is what you will see in the router LSA – LSA type 1


Additionally for any segments what are running the DR and BDR election –
The Designated Router will be generating the “Network LSA”.  The Network LSA is an optimization basically of the search function of the SPF algorithm. It’s used to cut down on the amount of flooding of LSA’s but it also simpliflies the look-up.

In a single area topology we should only see two LSA types in the database.
LSA Type 1 – which is the router LSA
LSA Type 2 – which is generated by the DR or Designated routers.

R2#sh ip ospf database

            OSPF Router with ID (192.168.23.2) (Process ID 1234)

                Router Link States (Area 0)

LSA – TYPE 1 – Router LSA
Link ID         ADV Router      Age         Seq#                Checksum Link count
1.1.1.1         1.1.1.1              111             0x80000003   0x005B30       4
3.3.3.3         3.3.3.3              104              0x80000003    0x00F986     3
192.168.23.2    192.168.23.2    161      0x80000004   0x00E83E      2

                Net Link States (Area 0)

LSA – TYPE 2  - Network

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.2    192.168.23.2    161         0x80000002 0x003A7E
192.168.23.2    192.168.23.2    161         0x80000003 0x002140

We can see there are 3 routers in the Topology – the TYPE 1 or Router LSA
We can also see there are 2 different Link States. LSA type 2 will tell everyone else in the network, how many links each router has – (Link count under LSA 1 section) and what are the properties of them. Ex: what are the cost values, the other router ADJ.

OSPF will use this information to build a graph of the topology, once all routers have synchronized the database and know what the topology looks like. OSPF will then use this information to SPF algorithm and output the shortest path tree.

The Key – on any link state protocol like OSPF and IS-IS. Is the database has to be identical on everyone in the area. Otherwise we would end up with different calculations for the Shortest path tree.

NOTE: Only between Area’s can routers have different views of the topology.

To see the details of what each router is advertising, for example link 1.1.1.1
We would issue the command:

R2#sh ip ospf database router 1.1.1.1


R2#sh ip ospf database router 1.1.1.1

            OSPF Router with ID (192.168.23.2) (Process ID 1234)

                Router Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 1005
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1  -- This is the advertising router and the router ID of Router 1
  LS Seq Number: 80000003
  Checksum: 0x5B30
  Length: 72
  AS Boundary Router
  Number of Links: 4  -- Router 1 says it has 4 different links that its advertising.

    Link connected to: a Stub Network  -- Says one of the networks is a stub network – this is the loopback of R1
     (Link ID) Network/subnet number: 1.1.1.1
     (Link Data) Network Mask: 255.255.255.255 
      Number of TOS metrics: 0
       TOS 0 Metrics: 1  -- This is the OSPF Cost value

Note: by default Loopback interfaces in OSPF are treated as Stub networks in database. Which means they are advertised with a / 32 mask.

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 3.3.3.3
     (Link Data) Router Interface address: 192.168.13.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 64  (Cisco’s implementation of OSPF does not allow for TOS routing)

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 192.168.13.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.12.2  - Designated router on the segment.
     (Link Data) Router Interface address: 192.168.12.1  - Router 1 Address
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

The rest of the output describes all the links as seen by R1 in the database.
Note: A transit network is a link that has adjacencies that go to the Designated Router.  Now all other routes in the toplopgy know that Router 1 has an ADJ to the DR

Network LSA type 2 – Is used to build the rest of the graph and find ADJ that the DR has. We need to ask the DR who are the other routers on the segment – The function of LSA type 2. Internally once the other routers see that R1 is connected to a DR. Then they will need to know what are the details about the DR’s advertisements.

From the output above we know the DR’s IP address is. (192.168.12.2 )  


R2#sh ip ospf database network 192.168.12.2

            OSPF Router with ID (192.168.23.2) (Process ID 1234)

                Net Link States (Area 0)

Note: Says this is a network link State in Area 0.


  Routing Bit Set on this LSA
  LS age: 912
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 192.168.12.2 (address of Designated Router)
  Advertising Router: 192.168.23.2  --
  LS Seq Number: 80000003
  Checksum: 0x387F
  Length: 32
  Network Mask: /24
        Attached Router: 192.168.23.2
        Attached Router: 1.1.1.1
Note: These are the routers that are connected to the DR. Now everyone else in the graph that the DR is connected to 192.168.23.2  and 1.1.1.1

The OSPF search function will continue to find all routers that are in the area and all ADJ, Ex who are Point-to-point, transit link etc.
 If it sees a links that is a transit link then we need to figure out who is the DR and who is it adjacent with. Once everyone has completed this search they now know what the overall topology looks like. They also know are all the cost values so they can calculate what is the best path to reach any destination.

The database can be used to find out why a particular router is forwarding in a certain destination.

Review –

From a # sh ip ospf database.

The first portion are the Router LSA’s. This is everyone in the area describing what they have directly connected. They will either have stub networks directly connected – like a loopback – or a a LAN segment that goes to no routers. Or they will have point to point or Transit adj.
PPP ADJ will be over like a PPP link and transit will be over an Ethernet or multipoint frame link


Verifying OSPF:

Once we know all the lookups are compete –

We can simply do a # sh ip route

No comments:

Post a Comment