Monday, April 18, 2011

notes: OSPF Hello Protocol

The hello protocol serves several purposes:

- It is the means by which neighbors are discovered.
- It advertises several parameters on which two routers must agree before they can become neighbors.
- Hello packets also act as keepalives between neighbors.
- It ensures bidirectional communication between neighbors when a neighbor sees his own router ID in a received hello.
- It elects Designated Routers (DRs) and Backup Designated Routers (BDRs) on Broadcast and NBMA networks.

Hello-Interval

- OSPF-speaking routers periodically sends a hello packet out of each OSPF-enabled interface.
- Uses a default hello-interval of 10 seconds for broadcast and 30 seconds for non-broadcast networks.
- Configured on a per interface basis with "ip ospf hello-interval" below.

Note: - By changing the hello manually with "ip ospf hello-int", the dead-interval is adjusted accordingly to 4x the new hello value.

Router Dead-Interval

- Is the period of time to elapse, if a router does not receive a hello from a neighbor, before declaring that neighbor down.
- Cisco default is four times the hello-interval but can be changed with the command
"ip ospf dead-interval" below.

Each hello packet contains the following information:

- Router ID of the originating router. Identifies the router; highest IP chosen; loopback overrides all interfaces, however; can also be set with the router-id command; this ID is used to break ties for DR election.
- Area ID of the originating router interface. Area identifier (always 0 for backbone). All routers in the area must agree on this setting to form a stub area.
- Address mask of the originating interface.
- Authentication type and information of the originating interface. This password must match on routers configured for authentication.
- Hello-interval of the originating interface. Frequency at which hellos are sent and the amount of time that can elapse before router is declared dead; default is 10 seconds, and the default dead interval is 4 times that for an Ethernettype network; these defaults vary based on network type.
- Router dead-interval of the originating interface.
- Router priority. Priority value used for DR and BDR election.
- DR and BDR. IP addresses of the DR and BDR if known.
- Five flag bits signifying optional capabilities.
- Router IDs of the originating router's neighbors. List of the adjacent routers

Here are the details of the exchange process between two routers on a LAN (Router 1 and Router 2) and the OSPF adjacency states involved:
1. Router 1 begins in the down state because it is not exchanging OSPF information with any other router. It sends hello packets via multicast address 224.0.0.5 (all SPF).
2. Router 2 receives the OSPF hello and adds Router 1 in its list of neighbors. This is the beginning of the Init State.
3. Router 2 sends a unicast hello packet response to Router 1.
4. Router 1 receives the hello and notes that it is listed in the packet. It adds Router 2 to its list of neighbors. Router1 knows that it has bidirectional communication with Router 2. This is known as the two-way state.
5. In a LAN environment, the DR and BDR are elected.
6. In a LAN environment, the hello packets function as a keepalive mechanism every 10 seconds.

After the DR and BDR are established, the routers are in Exstart State, and they are ready to exchange database information. The exchange protocol functions as follows:

1. In the Exstart State, the DR and BDR establish an adjacency with each router in the network; a master-slave relationship is formed with the router ID indicating the master in the relationship.
2. The master and slave routers exchange DBD packets; this is the Exchange State. The LSAs in the DBD include sequence numbers used to indicate freshness.
3. When a DBD is received, the router acknowledges the receipt and compares the information with its current database. If more recent information is described in the DBD, the router sends an LSR to request the information, which is the Loading State. The router receiving the LSR responds with an LSU; this LSU is also acknowledged by the receiver.
4. The router adds the new information to its LSDB.
5. When the exchange completes, the routers are in Full State.

Router information is later maintained using the following process:
1. The router notices the change and multicasts an LSU to the OSPF DR and BDR multicast address of 224.0.0.6.
2. The DR acknowledges the LSU and floods to all using multicast 224.0.0.5. This process involves acknowledgments,too.
3. The DR also sends the LSU to any other networks to which it is attached.
4. Routers update their LSDB with the new information in the LSU.

Summaries are sent every 30 minutes to ensure synchronization, and link state entries have a Max Age of 60 minutes

To establish adjacency, the following values must match the values configured on the receiving interface

- Area ID.
- Authentication.
- Network mask (point-to-point links are the exception).
- Hello-interval and Dead-interval.
- MTU.
- Options.

Fast Hello Packets

- Provides a way to configure the sending of hello packets in intervals less than 1 second.
- This is achieved by using the "ip ospf dead-interval minimal" command. Setting the dead interval to 1 second.
- The hello-multiplier value is set to the number of hello packets you want sent during that 1 second.
- Example: #ip ospf dead-interval min hello-multiplier 5 - hellos are sent 5 times per/sec, thus at a interval of 200ms.

-----------
COMMANDS
-----------
- Shows information from the neighbor data structure
- Shows all OSPF speaking neighbors, their state, dead-timer, connected interface

sh ip ospf neighbor


- Displays OSPF-related interface information, DR, BDR, etc

sh ip ospf interface

- Shows brief summary of which interface is running which ospf areas

sh ip ospf interface brief

- Specifies how often hellos are sent (10 sec/broadcast and 30 sec/non-broadcast)
- How long to wait before declaring a neighbor dead (default = 4x hello-interval)
- Configures OSPF fast hello
- Disables the MTU check. Used when a switch uses a different system MTU
- The MTU size in a hello must be the same on between neighbors

interface ser0
ip ospf hello-interval {1-65535 sec}
ip ospf dead-interval {1-65535 sec | minimal}
ip ospf dead-interval min hello-multiplier {no}
ip ospf mtu-ignore


OSPF Packet Types

- Type 1, Hello: Builds adjacencies
- Type 2, Database Description (DBD): Checks for database synchronization between routers
- Type 3, Link-State Request (LSR): Requests link-state specifics from the router
- Type 4, Link-State Update (LSU): Sends requested link-state records
- Type 5, Link-State Acknowledgment (LSA): Acknowledges the other packet types

OSPF Adjacencies

- Occurs through the exchange of hello packets.
- After adjacency is established, link-state databases (LSDB) are synched.
- Two OSPF neighbors on a point-to-point link form full adjacency with each other.
- In LANs, all routers form an adjacency with the DR and BDR; updates need to be sent only to the DR, which updates all other routers; and all other routers on the LAN are called DROTHERS and maintain a partial neighbor relationship with each other.

After adjacencies have been established, LSAs are exchanged through a reliable mechanism. LSAs are flooded to ensure topological awareness. LSAs have a sequence number and a lifetime value. LSAs convey the cost of links used for the SPF calculation. The cost metric is based on interface bandwidth. The LSA aging timer is a 30-minute default.

Note:  Hello and update packets in OSPF has TTL of 1.

Tweaking OSPF Timers

- timers are based on network interface types.

- faster links hello packets are sent every 10 seconds.
- slower links hello packets are sent every 30 seconds.
- hold and dead timer is 4x hello interval.

Lab Scenario:  Changing timers:

thinking of multiple stuff:
 - hello
 - hold
- dead
- spf timers  (shortest path first calculation
   5 seconds after updates are recieved. (basic)
   10 seconds after consecutive updates are received. (consecutive)

command:

timers spf (basic) (consecutive)

ex. 20% less

router ospf 1
timers spf 4 8

 - adjusting hello interval will automatically adjust the dead timer which is 4x hello.
- you can just independently the dead interval
Note: when adjusting timer you should think to adjust other side as well. or router in the same domain.

to check the defaults:

show ip ospf interface


Ex.

interface e0/0
ip ospf hello-interval 10
ip ospf dead interval 5

note: adjacency may disapear.  So watch your command router will allow you to enter this figures. even if it doesn't make sense.


Fast Hellos

ip ospf dead-interval minimal hello-multiplier 5

- sets dead time to 1 second.
- multiplier is the number of hellos within 1 second.
- yiels 200 ms hellos in this case

No comments:

Post a Comment