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.
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] area ospf-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.
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:
switch(ospf)# vlan 8 switch(vlan-8)# ip ospf area 3
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:
switch(ospf)# vlan 10 switch(vlan-10)# ip ospf 10.10.10.1 area 5 switch(vlan-10)# ip ospf 10.10.11.1 area 5 switch(vlan-10)# ip ospf 10.10.12.1 area 6