# OSPF Configuration Guide

This document provides basic guidelines for configuring OSPF.

- Enable OSPF

- Specify the Router ID

- Select the Interface to Use OSPF

- Specify the Area Type

- Route information advertising, aggregation, and filtering

  - OSPF Area Route Information Settings

  - External Route Information Settings

- Use Virtual Links

- Use OSPF Authentication

- Check OSPF Status

## 1. Enable OSPF

To use OSPF, enter the following command in global configuration mode:
Entering this enables the OSPF routing process and switches to OSPF configuration mode (OSPF mode).

For OSPFv2

    Yamaha(config)# router ospf [PROCESS_ID]

For OSPFv3

    Yamaha(config)# router ipv6 ospf [PROCESS_ID]

## 2. Specify the Router ID

Specify the router ID of this product. A router ID is an identification number that uniquely identifies each OSPF router within a network, and must be specified so that it is unique among multiple routers.

    Yamaha(config-router)# router-id X.X.X.X

There are several ways to specify the OSPF router ID, but one is determined by the following priorities:

1. The router-id command setting in OSPF mode.
   However, in OSPFv2 mode, the same setting can be made using the ospf router-id command.

2. The setting value of the router-id command in global configuration mode

3. The largest IP address configured on the VLAN interface

To prevent an unintended IP address from being used as the router ID, we recommend explicitly specifying the router ID.

## 3. Select the Interface to Use OSPF

When selecting the interface to use OSPF, use the network command in OSPF mode.
The command to assign an interface with an IP address in the 192.168.100.0/24　range to the backbone area is as follows:

    Yamaha(config-router)# network 192.168.100.0 0.0.0.255 area 0

By using the network command, you can assign multiple interfaces to an OSPF area with a single command setting.
However, note that OSPF may be enabled unintentionally, such as when an interface is added later.

## 4. Specify the Area Type

To specify the type of area defined by the OSPF protocol, use the area command.

- Assign interfaces with IP addresses within the range of 192.168.100.0/24 to Area 1 (standard area)

      Yamaha(config-router)# network 192.168.100.0 0.0.0.255 area 1

- Assign interfaces with IP addresses within the range of 192.168.100.0/24 to Area 1 (stub area)

      Yamaha(config-router)# network 192.168.100.0 0.0.0.255 area 1
      Yamaha(config-router)# area 1 stub

- Assign interfaces with IP addresses within the range of 192.168.100.0/24 to Area 1 (totally stub area)

      Yamaha(config-router)# network 192.168.100.0 0.0.0.255 area 1
      Yamaha(config-router)# area 1 stub no-summary

- Assign interfaces with IP addresses within the range of 192.168.100.0/24 to Area 1 (NSSA).

      Yamaha(config-router)# network 192.168.100.0 0.0.0.255 area 1
      Yamaha(config-router)# area 1 nssa

- Assign interfaces with IP addresses in the range of 192.168.100.0/24 to Area 1 (complete NSSA area)

      Yamaha(config-router)# network 192.168.100.0 0.0.0.255 area 1
      Yamaha(config-router)# area 1 nssa no-summary

If an area is to be a stub area, stub area configuration is required on all OSPF routers within that area.
If an area is to be an NSSA, NSSA configuration is required on all OSPF routers within that area.

## 5. Route Information Advertising, Aggregation, and Filtering

When importing external route information handled by static route settings or RIP into OSPF, or when exchanging route information within an OSPF area, you can restrict advertisements, aggregate route information, and filter route information. The diagram below is a conceptual diagram of route information manipulation when belonging to a standard area, NSSA, or stub area as an ABR (Area Boarder Router) and ASBR (Autonomous System Boarder Router). Use the underlined commands to manipulate route information.

### 5.1. OSPF Area Route Information Settings

Aggregate 192.168.1.0/24, 192.168.2.0/24, and 192.168.200.0/24, which are notified from area A.A.A.A and held as OSPF area route information into 192.168.0.0/16 and advertise it to other areas.

    Yamaha(config-router)# area A.A.A.A range 192.168.0.0/16

Of the 192.168.1.0/24, 192.168.2.0/24, and 192.168.200.0/24 routes notified from area A.A.A.A and held as OSPF area route information, only 192.168.2.0/24 is not advertised to other areas.

    Yamaha(config-router)# area A.A.A.A range 192.168.2.0/24 not-advertise

Of the 192.168.1.0/24, 192.168.2.0/24, and 192.168.200.0/24 routes notified from area A.A.A.A and held as OSPF area route information, only 192.168.2.0/24 is not advertised to other areas.

    Yamaha(config)# access-list 1 deny 192.168.2.0 0.0.0.255
    Yamaha(config)# access-list 1 permit any
    Yamaha(config)# router ospf
    Yamaha(config-router)# area A.A.A.A filter-list access 1 in

Route information for 192.168.2.0/24 is not advertised to the stub area C.C.C.C.

    Yamaha(config)# access-list 1 deny 192.168.2.0 0.0.0.255
    Yamaha(config)# access-list 1 permit any
    Yamaha(config)# router ospf
    Yamaha(config-router)# area C.C.C.C filter-list access 1 out

Of the 192.168.1.0/24, 192.168.2.0/24, and 192.168.200.0/24 routes held as OSPF area route information, only 192.168.2.0/24 is not registered in the RIB.

    Yamaha(config)# access-list 1 deny 192.168.2.0 0.0.0.255
    Yamaha(config)# access-list 1 permit any
    Yamaha(config)# router ospf
    Yamaha(config-router)# distribute-list 1 in

### 5.2. External Route Information Settings

Advertise external route information learned via RIP to the OSPF area.

    Yamaha(config-router)# redistribute rip

Aggregate external route information 172.16.1.0/24, 172.16.2.0/24, and 172.16.200.0/24 into 172.16.0.0/16 and advertise it to the OSPF area.

    Yamaha(config-router)# summary-address 172.16.0.0/16

Of the external route information 172.16.1.0/24, 172.16.2.0/24, and 172.16.200.0/24, only 172.16.2.0/24 is not advertised to the OSPF area.

    Yamaha(config-router)# summary-address 172.16.2.0/24 not-advertise

Of the external route information learned by RIP, only 203.0.113.0/24 is not included in the OSPF routing table.

    Yamaha(config)# access-list 1 deny 203.0.113.0 0.0.0.255
    Yamaha(config)# access-list 1 permit any
    Yamaha(config)# router ospf
    Yamaha(config-router)# distribute-list 1 out rip

## 6. Use Virtual Links

This is an example of connecting Standard Area 2 to an OSPF network consisting of a backbone area and Standard Area 1 via a virtual link.
Let the router ID for SWX (1) 172.16.1.1 and the router ID for SWX (2) 172.16.2.1.
Let the backbone area network 172.16.1.0/24, the Standard Area 1 network 172.16.2.0/24, and the Standard Area 2 network 172.16.3.0/24.

Settings for SWX (1)

    Yamaha(config-router)# network 172.16.3.0 255.255.255.0 area 2
    Yamaha(config-router)# area 1 virtual-link 172.16.2.1

Settings for SWX (2)

    Yamaha(config-router)# network 172.16.1.0 255.255.255.0 area 0
    Yamaha(config-router)# network 172.16.2.0 255.255.255.0 area 1
    Yamaha(config-router)# area 1 virtual-link 172.16.1.1

## 7. Use OSPF Authentication

OSPF allows packet authentication.
Using OSPF authentication prevents unintended routers from becoming OSPF neighbors.
If you use OSPF authentication, you must configure the same authentication settings on all devices that exchange OSPF packets through interfaces with OSPF authentication enabled.

Simple Password Authentication Settings
Use simple password authentication (authentication key: yamaha) on the vlan1 interface in the backbone area.

    !
    router ospf
     area 0 authentication
    !
    interface vlan1
     ip ospf authentication-key yamaha
    !

MD5 Digest Authentication Configuration
Use MD5 digest authentication (authentication key: 1a2b3c4d5e6f7890) on the vlan1 interface in the backbone area.

    !
    router ospf
     area 0 authentication message-digest
    !
    interface vlan1
     ip ospf message-digest-key 1 md5 1a2b3c4d5e6f7890
    !

## 8. Check OSPF Status

Display information about the OSPF database.

    Yamaha# show ip ospf database

Display information about interfaces where OSPF is running.

    Yamaha# show ip ospf interface

Display information about the VLAN1 interface where OSPF is running

    Yamaha# show ip ospf interface vlan1

Display OSPF neighbor information.

    Yamaha# show ip ospf neighbor

Display virtual link information.

    Yamaha# show ip ospf virtual-links

Display the route information maintained by the OSPF process.
When multiple routes exist for a single destination, the optimal route is selected based on the metric value and registered in the RIB.

    Yamaha# show ip ospf route

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