Introduction: Open Shortest Path First (OSPF) is a widely used dynamic routing protocol that enhances network scalability and efficiency.

Prerequisites: To proceed with OSPF configuration on Juniper switches, ensure the following:

  1. Access to the Juniper switch’s CLI (console, SSH, or Telnet).
  2. Basic understanding of networking concepts and the Juniper CLI.

Step 1: Enter Configuration Mode

Access the Juniper switch’s CLI and enter the operational mode by logging in with appropriate credentials. Then enter the configuration mode:

>login: [username]

> Password: [password]
> cli
> configure

Step 2: Configure OSPF

Enter OSPF configuration mode using the following command:

# set protocols ospf area [area-id]

Replace [area-id] with the desired OSPF area ID. For example, to configure OSPF in area 0.0.0.0:

# set protocols ospf area 0.0.0.0

Step 3: OSPF Authentication

To enable authentication for OSPF, use the following commands:

# set protocols ospf area [area-id] authentication [authentication-type]
# set protocols ospf area [area-id] authentication-key [authentication-key-value]

Replace [area-id] with the OSPF area ID and [authentication-type] with one of the following:

  • simple: Simple text authentication
  • md5: MD5 authentication

Example: Enabling MD5 authentication in area 0.0.0.0 with key “securekey123”:

# set protocols ospf area 0.0.0.0 authentication md5
# set protocols ospf area 0.0.0.0 authentication-key securekey123

Step 4: Default Route Configuration

To configure a default route in OSPF, use the following command:

# set routing-options static route 0.0.0.0/0 next-hop [next-hop-address]

Replace [next-hop-address] with the appropriate next-hop IP address. For example, setting the default route with the next hop of 192.168.1.1:

# set routing-options static route 0.0.0.0/0 next-hop 192.168.1.1

Step 5: Stub Area Configuration

To configure a stub area in OSPF, use the following command:

# set protocols ospf area [area-id] stub

Replace [area-id] with the OSPF area ID. For example, configuring area 0.0.0.1 as a stub area:

# set protocols ospf area 0.0.0.1 stub

Step 6: Passive Interface

Configuration To configure a passive interface in OSPF, use the following command:

# set interfaces [interface-name] passive

Replace [interface-name] with the name of the interface you want to configure as passive. For example, configuring ge-0/0/1 interface as a passive interface:

# set interfaces ge-0/0/1 passive

Step 7: Route Filter Configuration

To configure route filters in OSPF, use the following command:

# set policy-options policy-statement [filter-name] from [filter-criteria]
# set policy-options policy-statement [filter-name] then [filter-actions]
# set protocols ospf export [filter-name]

Replace [filter-name] with a descriptive name for the filter, [filter-criteria] with the criteria for route matching, and [filter-actions] with the actions to perform on matched routes. For example, configuring a route filter to allow only specific routes:

# set policy-options policy-statement myfilter from protocol direct
# set policy-options policy-statement myfilter then accept
# set protocols ospf export myfilter

Step 8: OSPF Cost Configuration

To configure OSPF cost for an interface, use the following command:

# set interfaces [interface-name] unit [unit-number] family inet address [ip-address]/[prefix-length]
# set interfaces [interface-name] unit [unit-number] family inet ospf interface-cost [cost-value]

Replace [interface-name] with the name of the interface, [unit-number] with the appropriate unit number, [ip-address] with the IP address, [prefix-length] with the subnet mask, and [cost-value] with the desired cost. For example, setting the OSPF cost for ge-0/0/1 unit 0 to 100:

# set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.1/24
# set interfaces ge-0/0/1 unit 0 family inet ospf interface-cost 100

Step 9: Commit Configuration

Save and apply the OSPF configuration to the Juniper switch:

# commit