Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

OSPF Configuration for Switches

OSPF is an interior gateway protocol (IGP) that routes packets within a single autonomous system (AS). OSPF uses link-state information to make routing decisions, making route calculations using the shortest-path-first (SPF) algorithm (also referred to as the Dijkstra algorithm). Each router running OSPF floods link-state advertisements throughout the AS or area that contain information about that router’s attached interfaces and routing metrics. Each router uses the information in these link-state advertisements to calculate the least cost path to each network and create a routing table for the protocol.

Junos OS supports OSPF version 2 (OSPFv2) and OSPF version 3 (OSPFv3), including virtual links, stub areas, and for OSPFv2, authentication. Junos OS does not support type-of-service (ToS) routing.

Example: Configure Basic OSPF in two EX Devices

To configure OSPF in a switch (configure these steps in both the switches):

  1. Navigate to the switch by clicking Switches > Switch Name.
    The switch details page appears.
  2. Configure network by following the steps below
    1. Navigate to the NETWORKS tile, and click Add Network.
      The New Network window appears.
    2. Enter a network name (for example vlan20), VLAN ID, and subnet.
    3. Click the check mark at the upper right of the New Network window to save the configuration.
  3. Create a port profile by following the steps below:
    1. On the PORT PROFILES window, click Add Profile.
      The New Port Profile window appears.
    2. Enter the profile details. In this example, name this profile as vlan20portprofile. In the port profile, you must include the network (vlan20) that you created in the previous step.
    3. Click the check mark at the upper right of the New Port Profile window to save the configuration.
  4. Attach the port profile to the port that is connected to the other switch. To do that:
    1. On the PORT CONFIGURATION tile, click Add Port Configuration.
      The New Port Configuration window appears.
    2. Enter the configuration details. Remember to specify the relevant interface in the Port ID field and include the vlan20portprofile in the Configuration Profile field.
    3. Click the check mark at the upper right of the New Port Configuration window to save the configuration.
  5. Add an IP address to the network which you created earlier (vlan20). To do that:
    1. On the IP CONFIGURATION tile, click Add IP Configuration.
      The New IP Configuration window appears.
    2. Select Static as address type.
    3. Specify an IP address and subnet mask. In this case, let's use 20.1.1.1/24 on one switch and 20.1.1.2/24 on the other switch.
    4. From the Network (VLAN) drop-down list, select the network (vlan20) that you configured earlier.
    5. Click the check mark at the upper right of the New IP Configuration window to save the configuration.
  6. On the OSPF tile, configure an OSPF area by following the steps below:
    1. Click Add Area.

      The New Area window appears.

    2. Specify the following details:
      • Area—Enter the area number (Range: 0 to 255).

      • Type—Specify an area type from the drop-down list.

      • Include Loopback—Select this check box if you want to include the loopback interface in the OSPF area.

    3. Click Add OSPF Network.

      The Add OSPF Network window appears.

    4. Specify the network and the additional details as listed below:
      • Network (VLAN)—From the drop-down list, select the network (vlan20) that you defined earlier.

      • Interface Type—Select an interface type. The following options are available: broadcast, p2p, and p2mp.

      • Authentication Type—Choose an authentication type from the following options: md5,password, and none. If you choose none, ensure that you select that option in both the switches.

      • Key—(Applicable if the Authentication Type chosen is md5). Specify a key for md5 authentication. These should be the same in both the devices.

      • Value—(Applicable if the Authentication Type chosen is md5). Specify a value for the specified md5 key. These should be the same in both the devices.

      • Password—(Applicable if the Authentication Type chosen is password). The password should be the same in both the switches for the OSPF neighborship to be up.

      • Metric—Specify the cost of an OSPF interface.

      • BFD Interval—Specify the interval at which the device exchanges BFD packets with its peer. Range: 1 through 255000 (in milliseconds).

      • Enable Timers—This option allows you to configure Hello Interval and Dead Interval.

      • Hello Interval—(Applicable if Enable Times is selected) Specifies the length of time, in seconds, before the routing device sends a hello packet out of an interface. By default, the routing device sends hello packets every 10 seconds.

      • Dead Interval—(Applicable if Enable Times is selected) Specifies the length of time, in seconds, that the routing device waits before declaring that a neighboring routing device is unavailable. By default, the routing device waits 40 seconds (four times the hello interval).

      • Passive—Select this check box to advertise the direct interface addresses on an interface without actually running OSPF on that interface. A passive interface is one for which the address information is advertised as an internal route in OSPF, but on which the protocol does not run.

    5. Click the check mark on the upper right of the Add OSPF Network window to save the OSPF Network information.
      You are returned to the New Area window.
    6. Click the check mark on the upper right of the New Area window to save the OSPF Area information.
  7. Select the Enabled check box under the OSPF Configuration section on the OSPF tile.
  8. On the Routing tile, enter the router ID.
  9. Click Save on the upper right of the switch details page to save the configuration on the switch.
Carry out the above steps on both the switches to establish the OSPF neighborship between them.

CLI Commands

When Interface Type is p2p and Authentication Type is md5:

When Interface Type is p2p and Authentication Type is none:

When Interface Type is p2p and Authentication Type is password:

When Interface Type is p2mp and Authentication Type is md5:

When Interface Type is p2mp and Authentication Type is none:

When Interface Type is p2mp and Authentication Type is password:

OSPF Events

The following image shows examples of OSPF events:

Configure OSPF at the Organization Level

To configure OSPF at the organization template level:

  1. Click Organization > Switch Templates.
  2. Open the organization template you want to modify.
  3. Navigate to the OSPF tile and click Add Area.
  4. Follow the steps listed in Example: Configure Basic OSPF in two EX Devices.

Configure OSPF at the Site Level

To configure OSPF at the site template level:

  1. Click Site > Switch Configuration.
  2. Open the site template you want to modify.
  3. Navigate to the OSPF tile and click Add Area.
  4. Follow the steps listed in Example: Configure Basic OSPF in two EX Devices.