Assigning the routing switch to OSPF areas

For more information, see Assigning the routing switch to OSPF areas.

Configuring an OSPF backbone or normal area

Syntax:

area [[ospf-area-id] | [backbone]] [normal] [[ospf-area-id] | [backbone]]

After using router ospf to globally enable OSPF and enter the global OSPF context, execute this command to assign the routing switch to a backbone or other normal area.

The no form of the command removes the routing switch from the specified area.

Default: No areas; Range: 1 to16 areas (of all types)

ospf-area-id

Specifies a normal area to which you are assigning the routing switch. You can assign the routing switch to one or more areas, depending on the area in which you want each configured VLAN or subnet to reside.

You can enter area IDs in either whole number or dotted decimal format. (The routing switch automatically converts whole numbers to the dotted decimal format.)

For example, if you enter an area-ID of 1, it appears in the switch's configuration as 0.0.0.1 and an area-ID of 256 appears in the switch configuration as 0.0.1.0.

An area ID can be a value selected to match the IP address of a VLAN belonging to the area or a value corresponding to a numbering system you devise for the areas in a given autonomous system (AS.)

Entering an area ID of 0 or 0.0.0.0 automatically joins the routing switch to the backbone area.

The maximum area ID value is 255.255.255.254 (4,294,967,294.)

backbone

Assigns the routing switch to the backbone area and automatically assigns an area ID of0.0.0.0 and an area type of normal.

Using 0 or 0.0.0.0 with the above ospf-area-id option achieves the same result. The backbone area is automatically configured as a normal area type.

Example

To configure a backbone and a normal area with an ID of "1" (0.0.0.1) on a routing switch:

HP Switch(ospf)# area backbone 
HP Switch(ospf)# area 1

Configuring a stub or NSSA area

Syntax:

area ospf-area-id stub 0-16777215 [no-summary]area ospf-area-id nssa 0-16777215 [no-summary] [metric-type[ type1 | type2 ]]No area ospf-area-id

After using router ospf to globally enable OSPF and enter the global OSPF context, execute this command to assign the routing switch to a stub area or NSSA. (Does not apply to backbone and normal OSPF area ABRs.)

The no form of the command removes the routing switch from the specified area.

Default: No areas; Range: 1 to 16 areas (of all types)

ospf-area-id

Same area ID as in Configuring an OSPF backbone or normal area, except you cannot assign a backbone area number ( 0 or 0.0.0.0) to a stub or NSSA area.

[ stub | nssa ]



Designates the area identified by ospf-area-id as a stub area or NSSA.

0-16777215

If the routing switch is used as an ABR for the designated area, assigns the cost of the default route (to the backbone) that is injected into the area.


[NOTE: ]

NOTE: If the routing switch is not an ABR for the stub area or NSSA, the above cost setting is still required by the CLI, but is not used.


In the default configuration, a routing switch acting as an ABR for a stub area or NSSA injects type-3 summary routes into the area. For an NSSA, the routing switch also injects a type-7 default route into the area.

[no-summary]



Where the routing switch is an ABR for a stub area or an NSSA, this option reduces the amount of link-state advertisement (LSA) traffic entering the area from the backbone by replacing the injection of type-3 summary routes with injection of a type-3 default summary route.

For NSSAs, this command also disables injection of the type-7 default external route from the backbone into the area (included in the metric-type operation described below.)

Default: Disabled

For more information, see Not-so-stubby-area (NSSA), Stub area, and Replacing type-3summary LSAs and type-7 default external LSAs with a type-3 default route LSA.

[metric-type[ type1 | type2 ]]



Used in NSSA ABRs only.

Enables injection of the type-7 default external route and type-3 summary routes into the area instead of a type 3 default route. Also specifies the type of internal cost metric to include in type-7 LSAs advertised for redistribution of external routes in the NSSA. (The redistribution—or external—cost metric is a global setting on the routing switch set by the default-metric command.)

The metric-type command specifies whether to include the redistribution cost in the cost metric calculation for a type-7 default LSA injected into the area.

type1

Calculate external route cost for a type-7 default LSA as the sum of (1) the external route cost assigned by the ASBR plus (2) the internal cost from the router with traffic for the external route to the ASBR advertising the route.

type2

Calculate external route cost for a type-7 default LSA as being only the cost from the router with traffic for the external route to the ASBR advertising the route.

If metric-type is not specified, the default (type2) will be used.

Using the area ospf-area-id nssa 0-16777215 without entering either no-summary or metric-type resets the routing switch to the state where injection of type-3 summary routes and the type-7 default external routes is enabled with metric-type set to type2.

Default: Enabled with metric-type type2


[NOTE: ]

NOTE: Different routers in the NSSA can be configured with different metric-type values.


Examples

The following examples of configuring a stub area and an NSSA on a routing switch use an (arbitrary) cost of "10".

Creating stub area and NSSA assignments

Creating stub area and NSSA assignments

Assigning VLANs and/or subnets to each area

After you define an OSPF area (page A-25), you can assign one or more VLANs and/or subnets to it. When a VLAN is assigned to an area, all currently configured IP addresses in that VLAN are automatically included in the assignment unless you enter a specific IP address.


[NOTE: ]

NOTE: All static VLANs configured on a routing switch configured for OSPF must be assigned to one of the defined areas in the AS.


Syntax:

vlan vid # ip ospf [ ip-addr | all ] areaospf-area-id

Executed in a specific VLAN context to assign the VLAN or individual subnets in the VLAN to the specified area. Requires that the area is already configured on the routing switch (page A-25.)

When executed without specifying an IP address or using the all keyword, this command assigns all configured networks in the VLAN to the specified OSPF area.

vlan vid

Defines the VLAN context for executing the area assignment.

ip-addr

Defines a specific subnet on the VLAN to assign to a configured OSPF area.

all

Assigns all subnets configured on the VLAN to a configured OSPF area.

area ospf-area-id



Identifies the OSPF area to which the VLAN or selected subnet should be assigned.


[NOTE: ]

NOTE: If you add a new subnet IP address to a VLAN after assigning the VLAN to an OSPF area, you must also assign the new subnet to an area:

  • If all subnets in the VLAN should be assigned to the same area, just execute ip ospf area ospf-area-id .

  • But if different subnets belong in different areas, you must explicitly assign the new subnet to the desired area.



Also, to assign a VLAN to an OSPF area, the VLAN must be configured with at least one IP address. Otherwise, executing this command results in the following CLI message:

OSPF can not be configured on this VLAN.

Example

To assign VLAN 8 on a routing switch to area 3 and include all IP addresses configured in the VLAN, enter the following commands:

HP Switch(ospf)# vlan 8
HP Switch(vlan-8)# ip ospf area 3

Suppose that a system operator wants to assign the three subnets configured in VLAN 10 as shown below:

  • 10.10.10.1 to OSPF area 5

  • 10.10.11.1 to OSPF area 5

  • 10.10.12.1 to OSPF area 6

The operator could use the following commands to configure the above assignments:

HP Switch(ospf)# vlan 10
HP Switch(vlan-10)# ip ospf 10.10.10.1 area 5
HP Switch(vlan-10)# ip ospf 10.10.11.1 area 5
HP Switch(vlan-10)# ip ospf 10.10.12.1 area 6

Assigning loopback addresses to an area

Optional: After you define the OSPF areas to which the switch belongs, you can assign a user-defined loopback address to an OSPF area. A loopback interface is a virtual interface configured with an IP address and is always reachable as long as at least one of the IP interfaces on the switch is operational. Because the loopback interface is always up, you ensure that the switch's router ID remains constant and that an OSPF network is protected from changes caused by downed interfaces.

For more information, see the management and configuration guide for your switch.

Syntax:

interface loopback 0-7 ip ospf lo-ipaddress area ospf-area-id

Executed in a specific loopback context to assign a loopback interface to the specified OSPF area. Requires that the specified loopback interface is already configured with an IP address on the switch.

interface loopback 0-7

Defines the loopback context for executing the area assignment.

ip ospf lo-ipaddress

Specifies the loopback interface by its IP address to assign to a configured OSPF area.

area ospf-area-id

Identifies the OSPF area to which the loopback interface is assigned.

You can enter a value for the OSPF area in the format of an IP address or a number in the range 0 to 4,294,967,295.

Example:

To assign user-defined loopback interface 3 on the switch to area 192.5.0.0 and include the loopback IP address 172.16.112.2 in the OSPF broadcast area, enter the following commands:

HP Switch(config)# interface loopback 3
HP Switch(lo-3)# ip ospf 172.16.112.2 area 192.5.0.0

Syntax:

interface loopback 0-7# ip ospf lo-ip-address cost number

Executed in a specific loopback context to modify the cost used to advertise the loopback address (and subnet) to the area border router (ABR.) Requires that the specified loopback interface is already configured with an IP address on the switch.

loopback interface 0-7

Defines the loopback context for executing the cost assignment.

ip ospf lo-ip-address

Specifies the loopback interface by its IP address.

cost number

Specifies a number that represents the administrative metric associated with the loopback interface. Valid values are from 1 to 65535.

Default: 1.

Example

To configure a cost of 10 for advertising the IP address 172.16.112.2 configured for loopback interface 3 in an OSPF area 192.5.0.0, enter the following commands:

HP Switch(config)# interface loopback 3
HP Switch(lo-3)# ip ospf 172.16.112.2 area 192.5.0.0
HP Switch(lo-3)# ip ospf 172.16.112.2 cost 10

OSPF redistribution of loopback addresses

When you assign a loopback address to an OSPF area, the route redistribution of the loopback address is limited to the specified area.

When route redistribution is enabled:

  • The switch advertises a loopback IP address that is not assigned to an OSPF area as an OSPF external route to its OSPF neighbors, and handles it as a connected route.

  • The switch advertises a loopback address that is assigned to an OSPF area as an OSPF internal route.

To enable redistribution of loopback IP addresses in OSPF, enter the redistribution connected command as described in Enabling route redistribution.

Example

Assigning loopback IP addresses to OSPF areas

The loopback IP address 13.3.4.5 of loopback 2 is advertised only in OSPF area 0.0.0.111. The IP addresses 14.2.3.4 and 15.2.3.4 of loopback 1 are advertised in all OSPF areas. The lines in bold below show that the IP address of loopback interface 2 is assigned to OSPF area 111.

HP Switch(config)# interface loopback 1
HP Switch(lo-1)# ip address 14.2.3.4
HP Switch(lo-1)# ip address 15.2.3.4
HP Switch(lo-1)# exit


HP Switch(config)# interface loopback 2
HP Switch(lo-2)# ip address 13.3.4.5


HP Switch(lo-2)# ip ospf 15.2.3.4 area 0.0.0.111
HP Switch(lo-2)# exit

Verifying OSPF redistribution of loopback interfaces

To verify the OSPF redistribution of loopback interfaces, enter the show ip routecommand from any context level to display IP route table entries.

In this example, a loopback address assigned to an area is displayed as an ospf intra-area (internal) route to its neighbor; a loopback address not assigned to a specific area is displayed as an ospf external route:

HP Switch(config)# show ip route

                 IP Route Entries
Destination     Gateway      VLAN  Type  Sub-Type   Metric   Dist
-----------     -------      ----  ----  --------   ------   ----
20.0.15.1/32   25.0.67.131   25    ospf  external2   10      110
20.0.16.2/32   25.0.67.131   25    ospf  intra-area  2       110