# OSPFv2 Configuration Examples

This page introduces a configuration example based on the diagram below.

Sample configuration diagram

## 1. SWX (1) Setting Example

SWX (1) is an interior router in the backbone area.
Register the three networks connected to vlan1 to 3 as Area 0 using the network command.

    !
    vlan database
     vlan 2-3 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface port1.3
     switchport
     switchport mode access
     switchport access vlan 3
    !
    interface vlan1
     ip address 172.16.1.1/24
    !
    interface vlan2
     ip address 172.16.2.1/24
    !
    interface vlan3
     ip address 172.16.3.1/24
    !
    router ospf
     ospf router-id 172.16.1.1
     network 172.16.1.0 255.255.255.0 area 0
     network 172.16.2.0 255.255.255.0 area 0
     network 172.16.3.0 255.255.255.0 area 0
    !

## 2. SWX (2) Setting Example

SWX (2) is the ABR (Area Boarder Router) for the backbone area (Area 0) and NSSA (Area 2).
Register 172.16.2.0/24 connected to vlan1 as Area 0 using the network command.
Register 172.18.1.0/24 connected to vlan2 as Area 2 using the network command.
Register Area 2 as NSSA using the area command. At this point, specify default-information-originate to advertise the default route from SWX (2) to Area 2.

    !
    vlan database
     vlan 2 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface vlan1
     ip address 172.16.2.2/24
    !
    interface vlan2
     ip address 172.18.1.1/24
    !
    router ospf
     ospf router-id 172.18.1.1
     network 172.16.2.0 255.255.255.0 area 0
     network 172.18.1.0 255.255.255.0 area 2
     area 2 nssa default-information-originate
    !

## 3. SWX (3) Setting Example

SWX (3) is an ABR (Area Boarder Router) for the backbone area (Area 0) and the standard area (Area 1).
Register 172.17.1.0/24 and 172.17.2.0/24 connected to vlan1 as Area 1 using the network command.
Register 172.16.1.0/24 connected to vlan2 as Area 0 using the network command.
To virtually make Area 4 adjacent to Area 0, create a virtual link using the area command.
Aggregate the two networks in Area 1 into 172.17.0.0/16 and advertise it to Area 0.
Aggregate the three networks in Area 0 into 172.16.0.0/16 and advertise it to Area 1.

    !
    vlan database
     vlan 2 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface vlan1
     ip address 172.17.1.1/24
    !
    interface vlan2
     ip address 172.16.1.2/24
    !
    router ospf
     ospf router-id 172.17.1.1
     network 172.17.1.0 255.255.255.0 area 1
     network 172.17.2.0 255.255.255.0 area 1
     network 172.16.1.0 255.255.255.0 area 0
     area 1 virtual-link 172.20.1.1
     area 0 range 172.16.0.0/16
     area 1 range 172.17.0.0/16
    !

## 4. SWX (4) Setting Example

SWX (4) is the ABR (Area Boarder Router) for the backbone area (Area 0) and the stub area (Area 3).
Register 172.16.3.0/24 connected to vlan1 as Area 0 using the network command.
Register 172.19.1.0/24 connected to vlan2 as Area 3 using the network command.
Register Area 3 as a stub area with the area command.

    !
    vlan database
     vlan 2 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface vlan1
     ip address 172.16.3.2/24
    !
    interface vlan2
     ip address 172.19.1.1/24
    !
    router ospf
     ospf router-id 172.19.1.1
     network 172.16.3.0 255.255.255.0 area 0
     network 172.19.1.0 255.255.255.0 area 3
     area 3 stub
    !

## 5. SWX (5) Setting Example

SWX (5) is the ASBR (Autonomous System Boarder Router) for NSSA (Area 2) and AS2.
Assume that RIP runs as a routing protocol other than OSPF within AS2, and that the networks 192.168.100.0/24 and 192.168.200.0/24 exist.

RIP-Related Settings
Register 192.168.100.0/24 and 192.168.200.0/24 as the management objects using the network command.
Also, advertises AS1’s OSPF network as a default route.

    !
    router rip
     network 192.168.100.0/24
     network 192.168.200.0/24
     default-information originate
    !

OSPF-Related Settings
Register 172.18.1.0/24 connected to vlan1 as Area 2 using the network command.
Register Area 2 as NSSA using the area command.
Advertise the route information obtained via RIP and the interface route information on the RIP side to the OSPF network.
Aggregate the route information for 192.168.100.0/24 and 192.168.200.0/24 obtained from RIP into 192.168.0.0/16 and advertise it to Area 2.
Prevent OSPF Hello messages from being sent from interfaces running RIP.

    !
    vlan database
     vlan 2 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface vlan1
     ip address 172.18.1.2/24
    !
    interface vlan2
     ip address 192.168.100.1/24
    !
    router ospf
     ospf router-id 172.18.1.2
     network 172.18.1.0 255.255.255.0 area 2
     area 2 nssa
     redistribute rip
     redistribute connected
     summary-address 192.168.0.0/16
     passive-interface vlan2
    !

## 6. SWX (6) Setting Example

SWX (6) is the ASBR (Autonomous System Boarder Router) for the standard area (Area 1) and AS3.
Assume that RIP runs as a routing protocol other than OSPF within AS3, and that networks 10.0.0.0/24 and 10.0.1.0/24 exist.

RIP-Related Settings
Register 10.0.0.0/24 and 10.0.1.0/24 as the management objects using the network command.
Also, advertises AS1’s OSPF network as a default route.

    !
    router rip
     network 10.0.0.0/24
     network 10.0.1.0/24
     default-information originate
    !

OSPF-Related Settings
Register 172.17.1.0/24 and 172.17.2.0/24 connected to vlan1 as Area 1 using the network command.
Advertise the route information obtained via RIP and the interface route information on the RIP side to the OSPF network.
Aggregate the route information for 10.0.0.0/24 and 10.0.1.0/24 obtained from RIP into 10.0.0.0/16 and advertise it to Area 1.
Prevent OSPF Hello messages from being sent from interfaces running RIP.

    !
    vlan database
     vlan 2 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface vlan1
     ip address 172.17.1.2/24
    !
    interface vlan2
     ip address 10.0.0.1/24
    !
    router ospf
     ospf router-id 172.17.1.2
     network 172.17.1.0 255.255.255.0 area 1
     network 172.17.2.0 255.255.255.0 area 1
     redistribute rip
     redistribute connected
     summary-address 10.0.0.0/16
     passive-interface vlan2
    !

## 7. SWX (7) Setting Example

SWX (7) is the ABR (Area Boarder Router) for the standard areas (Areas 1 and 4).
Register 172.17.1.0/24 and 172.17.2.0/24 connected to vlan1 as Area 1 using the network command.
Register 172.20.1.0/24 connected to vlan2 as area 4 using the network command.
To virtually make Area 4 adjacent to Area 0, create a virtual link using the area command.
Aggregate the two networks in Area 1 into 172.17.0.0/16 and advertise it to Area 0.

    !
    vlan database
     vlan 2 state enable
    !
    interface port1.1
     switchport
     switchport mode access
    !
    interface port1.2
     switchport
     switchport mode access
     switchport access vlan 2
    !
    interface vlan1
     ip address 172.17.1.3/24
    !
    interface vlan2
     ip address 172.20.1.1/24
    !
    router ospf
     ospf router-id 172.20.1.1
     network 172.17.1.0 255.255.255.0 area 1
     network 172.17.2.0 255.255.255.0 area 1
     network 172.20.1.0 255.255.255.0 area 4
     area 1 virtual-link 172.17.1.1
     area 1 range 172.17.0.0/16
    !

Search result
No more search results.
There are no topics that match your search query.