Advanced Juniper Networks Routing Release 5.1, Revision 0 Module 1: Open Shortest Path First (OSPF) Copyright © 2001, Juniper Networks, Inc. Module Objectives Review the basic components of the OSPF Protocol Discuss the OSPF neighbor hello protocol and adjacency formation process Examine the function of the Link-State Database (LSDB) and how it contributes routes to the routing table Look at the different kinds of OSPF packet types Configure OSPF on a Juniper Networks router Copyright © 2001, Juniper Networks, Inc. Link-State Update Packets Carry one or more link-state advertisements Link-state update packets consist of: – OSPF header – (4-byte) Number of advertisements – Link-state advertisements Field length, in bytes 1 1 Version Type number # of LSAs 2 4 Packet length Router ID LSA Header 4 Area ID LSA Data 2 2 8 Variable Checksum Authentication type Authentication Data LSA Header LSA Data Copyright © 2001, Juniper Networks, Inc. … LSA Packet Types Link-state advertisement packet types: – – – – – – – – Router LSAs - Type 1 Network LSAs - Type 2 Summary LSAs - Types 3 and 4 AS external LSAs - Type 5 Group membership LSAs - Type 6 NSSA LSAs - Type 7 External attributes LSAs - Type 8 Opaque LSAs - Types 9, 10, and 11 Each LSA type describes a portion of the OSPF routing domain Types 6, 8, 9, and 11 are not supported Copyright © 2001, Juniper Networks, Inc. LSA Packet Header Information to uniquely identify the LSA The 20-byte LSA header consists of: – (2-byte) LS Age – (1-byte) Options – (1-byte) LS Type – (4-byte) Link-State ID – (4-byte) Advertising Router – (4-byte) LS Sequence Number – (2-byte) LS Checksum – (2-byte) Length Copyright © 2001, Juniper Networks, Inc. Router LSA (Type 1) Originated by each router in an area Describes the state and cost of the router’s interfaces Router LSAs consist of LSA header plus: – (1-byte) Five 0 bits followed by the V, E and B bits – (1-byte) 0 bits – (2-byte) Number of Links – (4-byte) Link ID – (4-byte) Link Data – (1-byte) Link Type – (1-byte) Number of TOS Metrics – (2-byte) Metric – (4-byte) Additional TOS Data Copyright © 2001, Juniper Networks, Inc. Router LSA Example user@host> show ospf database router extensive OSPF link state database, area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Router *192.168.16.1 192.168.16.1 0x80000004 947 0x2 bits 0x3, link count 3 id 192.168.24.1, data 10.222.28.1, type PointToPoint (1) TOS count 0, TOS 0 metric 1 id 10.222.28.0, data 255.255.255.0, type Stub (3) TOS count 0, TOS 0 metric 1 id 192.168.16.1, data 255.255.255.255, type Stub (3) TOS count 0, TOS 0 metric 0 Gen timer 00:30:56 Aging timer 00:44:13 Installed 00:15:47 ago, expires in 00:44:13, sent 00:15:47 ago Ours Copyright © 2001, Juniper Networks, Inc. Cksum Len 0xd45b 60 Network LSA (Type 2) Originated by designated routers (DR) Describes all routers attached to a network segment Network LSAs consist of LSA header plus: – (4-byte) Network Mask – (4-byte) Attached Router Copyright © 2001, Juniper Networks, Inc. Network LSA Example user@host> show ospf database network extensive OSPF link state database, area 0.0.0.0 area 0.0.0.1 Type ID Adv Rtr Seq Age Opt Cksum Len Network 10.222.1.1 192.168.20.1 0x80000002 813 0x2 0x6876 32 mask 255.255.255.0 attached router 192.168.20.1 attached router 192.168.40.1 Aging timer 00:46:27 Installed 00:13:32 ago, expires in 00:46:27, sent 1w5d 01:07:09 ago Copyright © 2001, Juniper Networks, Inc. Summary LSA (Type 3) Originated by area border routers (ABR) Describes all routers attached to a multiaccess segment Summary LSA (Type 3) consists of LSA header plus: – (4-byte) Network Mask – (1-byte) 0 bits – (3-byte) Metric – (1-byte) TOS – (3-byte) TOS Metric Copyright © 2001, Juniper Networks, Inc. Summary LSA Example user@host> show ospf database netsummary extensive OSPF link state database, area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Summary 10.222.44.0 192.168.36.1 0x80000004 1011 0x2 mask 255.255.255.0 TOS 0x0, metric 1 Aging timer 00:43:08 Installed 00:16:49 ago, expires in 00:43:09, sent 1w5d 01:08:42 Summary 192.168.32.1 192.168.36.1 0x80000001 1355 0x2 mask 255.255.255.255 TOS 0x0, metric 1 Aging timer 00:37:25 Installed 00:22:33 ago, expires in 00:37:25, sent 1w5d 01:08:42 Summary *192.168.40.1 192.168.16.1 0x80000001 1527 0x2 mask 255.255.255.255 TOS 0x0, metric 2 Gen timer 00:14:18 Aging timer 00:34:33 Installed 00:25:27 ago, expires in 00:34:33, sent 00:25:27 ago Ours Copyright © 2001, Juniper Networks, Inc. Cksum Len 0x8530 28 ago 0x49f9 28 ago 0x87c6 28 Summary LSA (Type 4) Originated by area border router (ABR) Describes the destination of an ASBR Summary LSA (Type 4) consists of LSA header plus: – (4-byte) Network Mask – (1-byte) 0 bits – (3-byte) Metric – (1-byte) TOS – (3-byte) TOS Metric Copyright © 2001, Juniper Networks, Inc. ASBR Summary LSA Example user@host> show ospf database asbrsummary extensive OSPF link state database, area 0.0.0.0 Type ID Adv Rtr Seq Age Opt ASBRSum *192.168.20.1 192.168.16.1 0x80000003 76 0x2 mask 0.0.0.0 TOS 0x0, metric 1 Gen timer 00:48:43 Aging timer 00:58:43 Installed 00:01:16 ago, expires in 00:58:44, sent 00:01:16 ago Ours ASBRSum 192.168.32.1 192.168.36.1 0x80000001 1477 0x2 mask 0.0.0.0 TOS 0x0, metric 1 Aging timer 00:35:22 Installed 00:24:35 ago, expires in 00:35:23, sent 1w5d 01:10:44 ASBRSum *192.168.40.1 192.168.16.1 0x80000001 1649 0x2 mask 0.0.0.0 TOS 0x0, metric 2 Gen timer 00:14:36 Aging timer 00:32:30 Installed 00:27:29 ago, expires in 00:32:31, sent 00:27:29 ago Ours Copyright © 2001, Juniper Networks, Inc. Cksum Len 0x4818 28 0x3b07 28 ago 0x79d3 28 AS External LSA (Type 5) Originated by AS boundary routers (ASBR) Describes destination external to the OSPF network Two types of external destinations (Type 1 external and Type 2 external) AS external LSAs consist of LSA header plus: – (4-byte) Network Mask – E-bit (0 = Type 1 external; 1 = Type 2 external) followed by – – – – seven 0 bits (3-byte) Metric (4-byte) Forwarding Address (4-byte) External Route Tag (4-byte) Optional TOS fields Copyright © 2001, Juniper Networks, Inc. External LSA Example user@host> show ospf database extern extensive OSPF external link state database Type ID Adv Rtr Seq Age Extern *192.168.17.0 192.168.16.1 0x80000001 1919 mask 255.255.255.0 Type 1, TOS 0x0, metric 20, fwd addr 0.0.0.0, tag 0.0.0.0 Gen timer 00:00:32 Aging timer 00:28:01 Installed 00:31:59 ago, expires in 00:28:01, sent 00:31:58 Ours Extern 192.168.33.0 192.168.32.1 0x80000001 1878 mask 255.255.255.0 Type 1, TOS 0x0, metric 20, fwd addr 0.0.0.0, tag 0.0.0.0 Aging timer 00:28:42 Installed 00:31:15 ago, expires in 00:28:42, sent 00:31:15 Extern 192.168.37.0 192.168.36.1 0x80000002 1287 mask 255.255.255.0 Type 1, TOS 0x0, metric 20, fwd addr 0.0.0.0, tag 0.0.0.0 Aging timer 00:38:33 Installed 00:21:25 ago, expires in 00:38:33, sent 00:21:25 Extern 192.168.41.0 192.168.40.1 0x80000001 1708 mask 255.255.255.0 Type 1, TOS 0x0, metric 20, fwd addr 0.0.0.0, tag 0.0.0.0 Aging timer 00:31:34 Installed 00:28:25 ago, expires in 00:31:32, sent 00:28:25 Copyright © 2001, Juniper Networks, Inc. Opt 0x2 Cksum Len 0x3812 36 ago 0x2 0x1713 36 ago 0x2 0xcc54 36 ago 0x2 0x8693 36 ago NSSA External LSA (Type 7) Similar to AS external LSAs, but NSSA LSAs have only area flooding scope Selectively translated into AS external LSAs (Type 5) at the NSSA border N/P bit in the Type-7-LSA’s option field indicates whether the Type-7-LSA should be translated – N/P = 1 translate (propagate) – N/P = 0 do not translate Copyright © 2001, Juniper Networks, Inc. NSSA LSA Example user@host> show ospf database nssa extensive OSPF link state database, area 0.0.0.0 area 0.0.0.2 Type ID Adv Rtr Seq Age Opt Cksum Len NSSA 192.168.33.0 192.168.32.1 0x80000003 1639 0x8 0x7c19 36 mask 255.255.255.0 Type 1, TOS 0x0, metric 20, fwd addr 192.168.32.1, tag 0.0.0.0 Aging timer 00:32:47 Installed 00:27:12 ago, expires in 00:32:41, sent 1w5d 01:13:35 ago Copyright © 2001, Juniper Networks, Inc. Opaque LSA (Types 9 – 11) Allows for the future extensibility of OSPF Opaque LSAs consist of a standard LSA header followed by application-specific information The information field can be used directly by OSPF or by other applications Consists of a standard LSA header followed by a 32-bit application-specific information field The difference is in flooding scope Type 10 are used for MPLS Traffic Engineering Types 9 and 11 are not currently supported Copyright © 2001, Juniper Networks, Inc. Sample OSPF Database user@host> show ospf database OSPF link state database, area 0.0.0.1 Type ID Adv Rtr Router *192.168.16.1 192.168.16.1 Router 192.168.20.1 192.168.20.1 Router 192.168.40.1 192.168.40.1 Network 10.222.1.1 192.168.20.1 Summary *10.222.4.0 192.168.16.1 Summary *10.222.28.0 192.168.16.1 Summary *10.222.44.0 192.168.16.1 Summary *192.168.24.1 192.168.16.1 Summary *192.168.32.1 192.168.16.1 Summary *192.168.36.1 192.168.16.1 ASBRSum *192.168.24.1 192.168.16.1 ASBRSum *192.168.32.1 192.168.16.1 ASBRSum *192.168.36.1 192.168.16.1 OSPF external link state database Type ID Adv Rtr Extern *192.168.17.0 192.168.16.1 Extern 192.168.21.0 192.168.20.1 Extern 192.168.25.0 192.168.24.1 Extern 192.168.33.0 192.168.36.1 Extern 192.168.37.0 192.168.36.1 Extern 192.168.41.0 192.168.40.1 Seq 0x80000009 0x8000000f 0x80000004 0x80000007 0x80000005 0x80000005 0x80000005 0x80000005 0x80000003 0x80000005 0x80000004 0x80000003 0x80000004 Age 2489 296 47 596 2186 2044 1744 1444 1285 1144 685 544 385 Opt 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 Cksum Len 0xc864 60 0x3bfd 72 0xd3db 48 0x5e7b 32 0xd31c 28 0xc018 28 0x24a2 28 0x2635 28 0xe56d 28 0xaba2 28 0x1a41 28 0xd77a 28 0x9fae 28 Seq 0x80000004 0x80000007 0x80000002 0x80000001 0x80000004 0x80000002 Age 85 896 2911 2298 822 2725 Opt 0x2 0x2 0x2 0x2 0x2 0x2 Cksum Len 0x3215 36 0xe358 36 0xa593 36 0x520 36 0xc856 36 0x8494 36 Copyright © 2001, Juniper Networks, Inc. LSA Flooding Scopes Area 0 LSA 1 Area 0 LSA 2 Area 1 LSA 2 Area 0 Area 0 LSA 3 LSA 4 Area 2 Area 3 LSA 3 LSA 4 Area 3 Area 0 LSA 3 LSA 5 Area 3 LSA 5 Area 1 External Routes Area 0 LSA 5 Area 3 LSA 5 Area 1 LSA 3 Area 1 LSA 1 Backbone (0.0.0.0) Area 2 LSA 3 Area 3 Area 3 LSA 3 LSA 4 Area 2 LSA 1 Area 3 LSA 1 Area 3 LSA 2 Area 0 Area 0 LSA 3 LSA 4 Area 1 Area 0 LSA 3 LSA 5 Area 2 LSA 3 Area 3 LSA 5 Area 2 LSA 2 Area 0 LSA 3 Area 1 LSA 3 Area 3 LSA 3 Area 0 LSA 4 Area 3 LSA 4 Area 0 LSA 5 Area 3 LSA 5 Area 2 External Routes Copyright © 2001, Juniper Networks, Inc. Area 3 OSPF Router-ID Each OSPF router selects a 32-bit value to use as its Router-ID The Router-ID is populated within the LSAs that each router sends out – The link-state database uses this information for run the SPF algorithm When RPD initiates, the primary interface of the router is chosen as the Router-ID A value can be permanently set within [edit routing-options] [edit routing-options] user@host# set router-id 192.168.1.1 Copyright © 2001, Juniper Networks, Inc. OSPF Cost Cost, or metric, of an interface indicates the overhead required to send packets out a particular interface Default OSPF cost for all links is 10**8/bandwidth (bps) All links with a bandwidth greater than 100M will have a cost of 1 – Cost calculation results in a value <1, so it is rounded Cost can be set on a per interface basis [edit protocols ospf] user@host# show area 0.0.0.0 { interface so-0/0/0.0 { metric 12; } interface at-1/0/1.100 { metric 73; } } Copyright © 2001, Juniper Networks, Inc. Reference Bandwidth The 10**8 value in the cost calculation can be changed – Automatically alters the cost of interfaces – Allows for a consistent change across all interfaces Use the reference-bandwidth command within [edit protocols ospf] [edit protocols ospf] user@host# set reference-bandwidth 1g [edit protocols ospf] user@host# show reference-bandwidth 1g; area 0.0.0.0 { interface so-0/0/0.0 { metric 12; } interface at-1/0/1.100; } Copyright © 2001, Juniper Networks, Inc. Effects of Altering Metrics Metric values are advertised in Type 1 or Type 2 LSAs and populate link-state database As each router runs SPF algorithm, each LSA is examined individually for cost of outgoing interface – That cost is used in the final metric calculation Routers can disagree about the cost on a network link – HongKong sees a cost of 45 to reach Amsterdam – Amsterdam sees a cost of 60 to reach HongKong 5 HongKong 15 10 SanJose 20 Montreal Copyright © 2001, Juniper Networks, Inc. 25 30 Amsterdam OSPF Authentication Authentication occurs within an individual area – Three types are supported: none, simple, and MD5 By default, the authentication type is set to none – Effectively means no authentication is performed A plain-text password is used with type simple Each interface requires an authentication key – Multiple interfaces can use the same key – Keys are always encrypted in the configuration [edit protocols ospf] user@host# show area 0.0.0.2 { authentication-type simple; interface ge-0/0/0.0 { authentication-key "$9$-TbwgPfzn6A"; } } Copyright © 2001, Juniper Networks, Inc. MD5 Authentication Includes an encrypted checksum with all packets – Provides better security than type simple Each interface requires an authentication key – Multiple interfaces can use the same key – Keys are always encrypted in the configuration Each key requires a key-id value – If omitted, a value of 1 is used [edit protocols ospf] user@host# show area 0.0.0.1 { authentication-type md5; interface so-0/3/1.0 { authentication-key "$9$ul8b0IcyrvL7VKM" key-id 10; } } Copyright © 2001, Juniper Networks, Inc. Virtual Links Virtual links can connect remote OSPF areas together Often used for an area not physically connected to the backbone – Can also be used for a discontiguous backbone Configuration always occurs within area 0.0.0.0 – Creates a virtual ABR out of the remote router – “Tunnels” packets through a transit area Both ends must configure the link towards each other Virtual Link Area 0 Area 1 Copyright © 2001, Juniper Networks, Inc. Area 2 Virtual Link Configuration The area to be “tunneled” through is the transit-area The router at the far end of the link is the neighbor-id – This is the 32-bit router ID Once configured, the virtual link appears as an operational OSPF interface [edit protocols ospf] user@host# show area 0.0.0.1 { interface fe-0/2/2.0; } area 0.0.0.0 { virtual-link neighbor-id 192.168.0.1 transit-area 0.0.0.1; } [edit protocols ospf] user@host# show ospf interface Interface State Area vl-192.168.0.1 PtToPt 0.0.0.0 [edit protocols ospf] user@host# show ospf neighbor Address Interface 10.222.10.1 vl-192.168.8.1 DR ID 0.0.0.0 State Full ID 192.168.0.1 Copyright © 2001, Juniper Networks, Inc. BDR ID 0.0.0.0 Pri Nbrs 1 Dead 0 39 Overload Bit Used to advertise information to neighbors, but not be used for transit traffic – Sets metrics to 65535 on all transit links Can be set permanently or with a timeout value – Timer is between 60 and 1800 seconds – Timer only runs after RPD starts [edit protocols ospf] user@host# show overload; area 0.0.0.0 { interface so-0/0/0.0; interface ge-0/1/0.0; } user@host> show ospf database router extensive OSPF link state database, area 0.0.0.3 Type ID Adv Rtr Seq Age Router 192.168.56.1 192.168.56.1 0x80000005 71 id 192.168.48.1, data 10.222.61.1, type PointToPoint (1) TOS count 0, TOS 0 metric 65535 Copyright © 2001, Juniper Networks, Inc. Opt 0x2 Cksum Len 0x540b 60 Multi-Area OSPF Configuration Configured at the [edit protocols] hierarchy level List each interface and area separately protocols { ospf { area <area-id> { interface <interface-name>; interface <interface-name>; interface <interface-name>; } area <area-id> { interface <interface-name>; } area <area-id> { interface <interface-name>; } } } Copyright © 2001, Juniper Networks, Inc. Review Questions Copyright © 2001, Juniper Networks, Inc.