Single Area OSPF (page 2)
26 Oct 2003 @ 01:02PM

Updated: 20 Jan 2010 @ 09:08AM
The following details the structure of the OSPF Packet Header.

Comments (0)
The following details the structure of the Hello header.

Comments (0)
OSPF has 5 steps of operation (not to be confused with the 7 states). These steps are basically what an OSPF router does while initializing, establishing, and maintaining routing information. The table below lays out the steps.

StepDescription
1. Establish Router Adjacencies This is where the router begins building its router adjacencies. This particular step includes the first two states of OSPF; down and init.
2. Elect DR and BDR The Designated Router and Backup Designated Router are elected at this step, but only on multiaccess networks. This would include the two-way state and the beginning of the ExStart state.
3. Discover Router This concludes the ExStart state moves into the Exchange state. Database description packets (DBDs) are swapped, which include the link-state type, address of advertising router, cost and sequence number. If the advertised information differs from the local database, the routers proceed to the loading state. Full adjacency is then established in this phase, if needed (in multiaccess network, router only become fully adjacent to the DR).
4. Select Appropriate Routes At this point the SPF algorithm is run over the link-state database, thereby generating the forwarding database. Cost is calculated based on bandwidth. SPF hold-timers are implemented to prevent too-frequent updates of routing information. The command is timers spf, the default value being 10 seconds.
5. Maintain Routing Information If a dead-interval expires without receiving a hello packet, a link is designated as 'down' and LSUs are sent. In point-to-point networks, the LSUs are multicast to 224.0.0.5. In a multiaccess network, non-DR/BDR routers multicast to 224.0.0.6, while the DR multicasts to 224.0.0.5. Additionally, there is a 30 minute (default) age timer on routes, after which point route information is rebroadcast.
Comments (0)
To configure OSPF on a Cisco router, use the following commandline in config mode.
Router OSPF process-id (1-65,535)
network address wildcard-mask area area-id


A real-world example would be:
Router(config)#Router OSPF 1
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Comments (0)
Some optional OSPF commands include the following:

CommandDescriptionExample
interface loopback numberThis allows you to create a loopback interface. This functions like any other interface, but can never go down.interface loopback 1 or int lo1
ip ospf priority number (0-255)This allows you to set the priority on a router so as to rig DR/BDR elections. 0 means a router will never be DR/BDR, while 255 assures at least a tie.int e0 / ip OSPF priority 0
ip ospf cost [1-65535]This allows you to manually set a cost on a link. This can be handy if the cost automatically calculated by OSPF is incorrect (such as serial lines).int s0 / ip OSPF cost 1000
Comments (0)
To calculate the cost of a link, simply divide 108 by the bandwidth in bits per second. In other words, a 56kbps modem would be 56,000bps. 108 (or 100,000,000) divided by 56,000 = 1785. Below is a table of default costs. Note that the cost system needs to be reworked due to the advent of gigabit ethernet. Gigabit ethernet would have a cost of .1, but cost doesn't allow decimal values, so it's 1, the same as fastethernet.

Mediumcost
56kbps serial1785
T1 (1.544Mb/s)64
E1 (2.048Mb/s)48
4Mbps Token Ring25
Ethernet10
16 Mbps Token Ring6
100 Mb/sec ethernet1
Comments (0)