---
title: OSPF Configuration
slug: routing/ospf-configuration
createdAt: 2025-12-04T04:03:15.514Z
---

## <font color="#1d50a2">OSPFv2 Configuration</font>

### <font color="#1d50a2">show ip ospf</font>

**\[Command]**
**show ip ospf \[vrf *NAME*|all] \[json]**

**\[Purpose]**
Display OSPF details

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf vrf all json
```

### <font color="#1d50a2">show ip ospf interface</font>

**\[Command]**
**show ip ospf \[vrf *NAME*|all] interface \[ethernet *interface\_name*|vlan *vlan\_id*|link-aggregation *lag\_id*]**

**\[Purpose]**
Show state and configuration of OSPF the specified interface, or all interfaces if no interface is given.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interface\_name*                          | Ethernet interface name (0..54)              |
| *vlan\_id*                                 | VLAN id (1..4094)                            |
| *lag\_id*                                  | Link-aggregation interface number            |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf vrf 1 interface vlan 20
OSPF Instance: 2
VRF Name: 1
Vlan20 is up
ifindex 113, MTU 9216 bytes, BW 10 Mbit <UP,BROADCAST,RUNNING,ALLMULTI,MULTICAST>
Internet Address 20.1.1.1/24, Broadcast 20.1.1.255, Area 3.1.1.1
MTU mismatch detection: enabled
Router ID 2.2.2.1, Network Type BROADCAST, Cost: 10000
Transmit Delay is 1 sec, State Backup, Priority 1
Designated Router (ID) 2.2.2.2 Interface Address 20.1.1.2/24
Backup Designated Router (ID) 2.2.2.1, Interface Address 20.1.1.1
Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 3.869s
Neighbor Count is 1, Adjacent neighbor count is 1
```

### <font color="#1d50a2">show ip ospf neighbor</font>

**\[Command]**
**show ip ospf \[vrf *NAME*|all] neighbor \[ethernet *interface\_name*|vlan *vlan\_id*|link-aggregation *lag\_id*|*A.B.C.D*]\[detail]\[all]\[json]**

**\[Purpose]**
Display lsa information of LSDB. Json o/p of this command covers base route information i.e all LSAs except opaque lsa info

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interface\_name*                          | Ethernet interface name (0..54)              |
| *vlan\_id*                                 | VLAN id (1..4094)                            |
| *lag\_id*                                  | Link-aggregation interface number            |
| *A.B.C.D*                                  | IP address                                   |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf vrf all neighbor
OSPF Instance: 2
VRF Name: 1
Neighbor ID Pri State Up Time Dead Time Address Interface RXmtL RqstL DBsmL
2.2.2.2 1 Full/DR 14m07s 32.466s 20.1.1.2 Vlan20:20.1.1.1 0 0 0
```

### <font color="#1d50a2">show ip ospf database \{max-age|self-originate\}</font>

**\[Command]**
**show ip ospf \[vrf \{*NAME*|all}] database max-age \{max-age|self-originate}**

**\[Purpose]**
Show the OSPF database summary.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *NAME*                                     | VRF name                                     |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf vrf all database max-age
```

### <font color="#1d50a2">show ip ospf database \{opaque-link|opaque-area\}</font>

**\[Command]**
**show ip ospf \[vrf \{*NAME*|all}] database \{opaque-link|opaque-area|} \[*A.B.C.D*]\[adv-router *A.B.C.D*]\[self-originate]**

**\[Purpose]**
Show opaque LSA from the database.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *NAME*                                     | VRF name                                     |
| *A.B.C.D*                                  | IP address                                   |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf database opaque-link
```

### <font color="#1d50a2">show ip ospf route \[json\]</font>

**\[Command]**
**show ip ospf \[vrf *NAME*|all] route \[json]**

**\[Purpose]**
Show the OSPF routing table, as determined by the most recent SPF calculation..

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf vrf all route
OSPF Instance: 2
VRF Name: 1
============ OSPF network routing table ============
N 20.1.1.0/24 [10000] area: 3.1.1.1
directly attached to Vlan20
============ OSPF router routing table =============
============ OSPF external routing table ===========
```

### <font color="#1d50a2">show ip ospf router-info</font>

**\[Command]**
**show ip ospf router-info \[pce]**

**\[Purpose]**
Show router capabilities flag

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ip ospf router-info pce
```

### <font color="#1d50a2">router ospf \[*vrf name*\]</font>

**\[Command]**
**router ospf \[vrf *NAME*]**
**no router ospf**

**\[Purpose]**
Enable or disable the OSPF process

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *NAME*                                     | VRF name                                     |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)#
```

### <font color="#1d50a2">ospf router-id *A.B.C.D*</font>

**\[Command]**
**ospf router-id *A.B.C.D***
**no ospf router-id *A.B.C.D***

**\[Purpose]**
This sets the router-ID of the OSPF process.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D*                                  | OSPF router-id in IP address format          |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# ospf router-id 1.1.1.1
```

### <font color="#1d50a2">ospf rfc1583 compatibility</font>

**\[Command]**
**ospf rfc1583compatibility**
**no ospf rfc1583compatibility**

**\[Purpose]**
RFC 2328, the successor to RFC 1583, suggests according to section G.2 (changes) in section 16.4 a change to the path preference algorithm that prevents possible routing loops that were possible in the old version of OSPFv2. More specifically it demands that inter-area paths and intra-area backbone path are now of equal preference but still both preferred to external paths.

**\[View]**
OSPF view

**\[Notes]**
This command disables OPSF rfc1583compatibility.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# ospf rfc1583compatibility
```

### <font color="#1d50a2">network A.B.C.D/M area \{*A.B.C.D|area\_id*\}</font>

**\[Command]**
**network *A.B.C.D/M* area \{*A.B.C.D*|*area\_id*}**
**no network *A.B.C.D/M* area \{*A.B.C.D*|*area\_id*}**

**\[Purpose]**
This command specifies the OSPF enabled interface(s). 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D/M*                                | network address                              |
| *A.B.C.D*                                  | OSPF router-id                               |
| *area\_id*                                 | area\_id                                     |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# network 1.1.1.1/24 area 11
```

### <font color="#1d50a2">area \{A.B.C.D|area\_id\} range *A.B.C.D/M*</font>

**\[Command]**
**area \{*A.B.C.D*|*area\_id*} range *A.B.C.D/M* \[advertise \[cost *metric*]]**
**no area \{*A.B.C.D*|*area\_id*} range *A.B.C.D/M* \[advertise \[cost *metric*]]**

**\[Purpose]**
Summarize intra area paths from specified area into one Type-3 summary-LSA announced to other areas.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>   |
| ------------------------------------------ | ---------------------------------------------- |
| *A.B.C.D/M*                                | network address                                |
| *A.B.C.D*                                  | OSPF router-id                                 |
| *area\_id*                                 | area\_id                                       |
| *metric*                                   | advertised metric for this range (0..16777215) |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# area 1.1.1.1 range 1.1.1.1/32 advertise cost 100
```

### <font color="#1d50a2">area \{A.B.C.D|area\_id\} range *A.B.C.D/M* \{substitute A.B.C.D/M|*cost metric*\}</font>

**\[Command]**
**area \{*A.B.C.D*|*area\_id*} range *A.B.C.D/M* \{substitute A.B.C.D/M|cost *metric*}**
**no area \{*A.B.C.D*|*area\_id*} range *A.B.C.D/M* \{substitute A.B.C.D/M|cost *metric*}**

**\[Purpose]**
Substitute summarized prefix with another prefix

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>   |
| ------------------------------------------ | ---------------------------------------------- |
| *A.B.C.D/M*                                | network address                                |
| *area\_id*                                 | area\_id                                       |
| *metric*                                   | advertised metric for this range (0..16777215) |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# area 1.1.1.1 range 1.1.1.1/32 substitute 1.1.1.1/32 cost 100
```

### <font color="#1d50a2">area \{A.B.C.D|area\_id\} \{stub|nssa\} \[no-summary\]</font>

**\[Command]**
**area \{*A.B.C.D*|*area\_id*} \{stub|nssa} \[no-summary]**
**no area \{*A.B.C.D*|*area\_id*} \{stub|nssa} \[no-summary]**

**\[Purpose]**
Prevents an OSPF ABR from injecting inter-area summaries into the specified stub area

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D*                                  | OSPF router-id                               |
| *area\_id*                                 | area\_id                                     |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# area 1.1.1.1 stub no-summary
```

### <font color="#1d50a2">ip ospf area \{*A.B.C.D|area\_id*\}</font>

**\[Command]**
**ip ospf area \{*A.B.C.D*|*area\_id*} \[*a.b.c.d*]**
**no ip ospf area \{*A.B.C.D*|*area\_id*} \[*a.b.c.d*]**

**\[Purpose]**
Enable OSPF on the interface, optionally restricted to just the IP address given by ADDR, putting it in the AREA area.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D*                                  | OSPF router-id                               |
| *area\_id*                                 | area\_id                                     |
| *a.b.c.d*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf area 1.1.1.1 2.2.2.2
```

### <font color="#1d50a2">ip ospf authentication-key *KEY*</font>

**\[Command]**
**ip ospf authentication-key *KEY* \[*A.B.C.D*]**
**no ip ospf authentication-key *KEY* \[*A.B.C.D*]**

**\[Purpose]**
Set OSPF authentication key to a simple password. After setting AUTH\_KEY, all OSPF packets are authenticated. AUTH\_KEY has length up to 8 chars.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *KEY*                                      | The OSPF password (key)                      |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf authentication-key test123 1.1.1.1
```

### <font color="#1d50a2">ip ospf authentication</font>

**\[Command]**
**ip ospf authentication \[message-digest] \[*A.B.C.D*]**
**no ip ospf authentication \[message-digest] \[*A.B.C.D*]**

**\[Purpose]**
Specify that MD5 HMAC authentication must be used on this interface

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf authentication message-digest 1.1.1.1
```

### <font color="#1d50a2">ip ospf message-digest-key KEY\_ID md5 *MD5*</font>

**\[Command]**
**ip ospf message-digest-key *KEY\_ID* md5 *MD5* \[*A.B.C.D*]**
**no ip ospf message-digest-key *KEY\_ID* md5 *MD5* \[*A.B.C.D*]**

**\[Purpose]**
Set OSPF authentication key to a cryptographic password. The cryptographic algorithm is MD5.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *KEY\_ID*                                  | Key ID (1..255)                              |
| *MD5*                                      | Use MD5 algorithm                            |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf message-digest-key 2 md5 s 1.1.1.1
```

### <font color="#1d50a2">ip ospf cost COST \[*A.B.C.D*\]</font>

**\[Command]**
**ip ospf cost *COST* \[*A.B.C.D*]**
**no ip ospf cost *COST* \[*A.B.C.D*]**

**\[Purpose]**
Set link cost for the specified interface. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *COST*                                     | Cost (1..65535)                              |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf cost 12
```

### <font color="#1d50a2">ip ospf dead-interval \{interval|minimal hello-multiplier *number*\}</font>

**\[Command]**
**ip ospf dead-interval \{*interval*|minimal hello-multiplier *number*} \[*A.B.C.D*]**
**no ip ospf dead-interval \{*interval*|minimal hello-multiplier *number*}\[*A.B.C.D*]**

**\[Purpose]**
Set interface’s router dead interval. Default value is 40. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |
| *number*                                   | Number of Hellos to send each second (1..10) |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf dead-interval 2 1.1.1.1
```

### <font color="#1d50a2">ip ospf hello-interval *interval*</font>

**\[Command]**
**ip ospf hello-interval *interval* \[*A.B.C.D*]**
**no ip ospf hello-interval *interval* \[*A.B.C.D*]**

**\[Purpose]**
Set interface’s hello interval. Default 10. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf hello-interval 2 1.1.1.1
```

### <font color="#1d50a2">ip ospf network \{broadcast|non-broadcast|point-to-multipoint|point-to-point\}</font>

**\[Command]**
**ip ospf network \{broadcast|non-broadcast|point-to-multipoint|point-to-point}**
**no ip ospf network \{broadcast|non-broadcast|point-to-multipoint|point-to-point}**

**\[Purpose]**
Set explicitly network type for specified interface.

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf network broadcast
```

### <font color="#1d50a2">ip ospf priority *priority*</font>

**\[Command]**
**ip ospf priority *priority* \[*A.B.C.D*]**
**no ip ospf priority *priority* \[*A.B.C.D*]**

**\[Purpose]**
Set router priority integer value.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *priority*                                 | Priority (0..255)                            |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf priority 12
```

### <font color="#1d50a2">ip ospf retransmit-interval *interval*</font>

**\[Command]**
**ip ospf retransmit-interval *interval* \[*A.B.C.D*]**
**no ip ospf retransmit-interval *interval* \[*A.B.C.D*]**

**\[Purpose]**
Set number of seconds for RxmtInterval timer value

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf retransmit-interval 2
```

### <font color="#1d50a2">ip ospf transmit-delay *interval*</font>

**\[Command]**
**ip ospf transmit-delay *interval* \[*A.B.C.D*]**
**no ip ospf transmit-delay *interval* \[*A.B.C.D*]**

**\[Purpose]**
Set number of seconds for InfTransDelay value.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf retransmit-interval 2
```

### <font color="#1d50a2">ip ospf mtu-ignore</font>

**\[Command]**
**ip ospf mtu-ignore**
**no ip ospf mtu-ignore**

**\[Purpose]**
Ignore MTU when establish OSPF

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf mtu-ignore
```

### <font color="#1d50a2">ip ospf passive</font>

**\[Command]**
**ip ospf passive**
**no ip ospf passive**

**\[Purpose]**
Configuring OSPF passive interfaces

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf passive
```

### <font color="#1d50a2">redistribute \{babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table\}</font>

**\[Command]**
**redistribute \{babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[metric-type *metric\_type*] \[metric *metric*] \[route-map *route\_map*]**
**no redistribute \{babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[metric-type *metric\_type*] \[metric *metric*] \[route-map *route\_map*]**

**\[Purpose]**
Redistribute routes of the specified protocol or kind into OSPF, with the metric type and metric set if specified, filtering the routes using the given route-map if specified. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *metric\_type*                             | Set OSPF External Type 1/2 metrics (1..2)    |
| *metric*                                   | OSPF default metric (0..16777214)            |
| *route-map*                                | Pointer to route-map entries                 |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# redistribute static metric-type 1 metric 2 route-map test
```

### <font color="#1d50a2">default-information originate</font>

**\[Command]**
**default-information originate \[always] \[metric-type *metric\_type*]\[metric *metric*]\[route-map *route\_map*]**
**no default-information originate \[always] \[metric-type *metric\_type*]\[metric *metric*]\[route-map *route\_map*]**

**\[Purpose]**
Originate an AS-External (type-5) LSA describing a default route into all external-routing capable areas, of the specified metric and metric type. If the ‘always’ keyword is given then the default is always advertised, even when there is no default present in the routing table.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *metric\_type*                             | Set OSPF External Type 1/2 metrics (1..2)    |
| *metric*                                   | OSPF default metric (0..16777214)            |
| *route-map*                                | Pointer to route-map entries                 |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# default-information originate always
```

### <font color="#1d50a2">distribute-list route-map *String* in</font>

**\[Command]**
**distribute-list route-map *String* in**

**\[Purpose]**
Apply the route-map filter to filter the routes that need to be learned

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# distribute-list route-map test in
```

### <font color="#1d50a2">default-metric *metric*</font>

**\[Command]**
**default-metric *metric***
**no default-metric *metric***

**\[Purpose]**
Set default metric 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *metric*                                   | OSPF default metric (0..16777214)            |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# default-metric 2
```

### <font color="#1d50a2">distance \[ospf \{intra-area|inter-area|external\}\] *distance*</font>

**\[Command]**
**distance \[ospf \{intra-area|inter-area|external}] *distance***
**no distance \[ospf \{intra-area|inter-area|external}] *distance***

**\[Purpose]**
Set OSPF distance

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *distance*                                 | Distance for external routes (1..255)        |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf
sonic(config-router)# distance ospf external 2
```

## <font color="#1d50a2">OSPFv3 Configuration</font>

### <font color="#1d50a2">show ipv6 ospf6</font>

**\[Command]**
**show ipv6 ospf6**

**\[Purpose]**
Display OSPFv3 details

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6
```

### <font color="#1d50a2">show ipv6 ospf6 database</font>

**\[Command]**
**show ipv6 ospf6 database \[detail|dump|internal]**
**how ipv6 ospf6 database \[router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix]\[detail|dump|internal]**

**\[Purpose]**
This command shows LSAs present in the LSDB. 

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 database detail
```

### <font color="#1d50a2">show ipv6 ospf6 database adv-router *A.B.C.D* linkstate-id *A.B.C.D*</font>

**\[Command]**
**show ipv6 ospf6 database adv-router *A.B.C.D* linkstate-id *A.B.C.D***

**\[Purpose]**
The LSAs additinally can also be filtered with the linkstate-id and advertising-router fields

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D*                                  | IP address                                   |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 database network adv-router 1.1.1.1 linkstate-id 1.1.1.1
```

### <font color="#1d50a2">show ipv6 ospf6 database self-originated</font>

**\[Command]**
**show ipv6 ospf6 database self-originated**

**\[Purpose]**
This command is used to filter the LSAs which are originated by the present router.

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 database self-originated
```

### <font color="#1d50a2">show ipv6 ospf6 interface \[ethernet interface\_name|vlan vlan\_id|link-aggregation *lag\_id*\]</font>

**\[Command]**
**show ipv6 ospf6 interface \[ethernet *interface\_name*|vlan *vlan\_id*|link-aggregation *lag\_id*]**

**\[Purpose]**
To see OSPF interface configuration like costs.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interface\_name*                          | Ethernet interface name (0..54)              |
| *vlan\_id*                                 | VLAN id (1..4094)                            |
| *lag-id*                                   | Link-aggregation interface number            |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 interface ethernet 1
```

### <font color="#1d50a2">show ipv6 ospf6 neighbor</font>

**\[Command]**
**show ipv6 ospf6 neighbor**

**\[Purpose]**
Show state and chosen (backup) DR of neighbor.

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 neighbor
```

### <font color="#1d50a2">show ipv6 ospf6 interface traffic</font>

**\[Command]**
**show ipv6 ospf6 interface traffic**

**\[Purpose]**
Show counts of different packets that have been received and transmitted by the interfaces

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 interface traffic
```

### <font color="#1d50a2">show ipv6 route ospf6</font>

**\[Command]**
**show ipv6 route ospf6**

**\[Purpose]**
This command shows internal routing table

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 route ospf6
```

### <font color="#1d50a2">show ipv6 ospf6 redistribute</font>

**\[Command]**
**show ipv6 ospf6 redistribute**

**\[Purpose]**
Show the routes which are redistributed by the router.

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 redistribute
```

### <font color="#1d50a2">show ipv6 ospf6 route X\:X\:\:X\:X/M match \[detail\]</font>

**\[Command]**
**show ipv6 ospf6 route *X\:X\::X***:&#x58;***/M* match \[detail]**

**\[Purpose]**
The additional match option will match the given address to the destination of the routes, and return the result accordingly. 

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 route 1::1/64 match detail
```

### <font color="#1d50a2">show ipv6 ospf6 interface \[ethernet interface\_name|vlan vlan\_id|link-aggregation lag\_id\] prefix \[detail|X\:X\:\:X\:X|X\:X\:\:X\:X/M \[match|detail\]\]</font>

**\[Command]**
**show ipv6 ospf6 interface \[ethernet *interface\_name*|vlan *vlan\_id*|link- aggregation *lag\_id*] prefix \[detail|*X\:X\::X***:&#x58;***|X\:X\::X***:&#x58;***/M* \[match|detail]]**

**\[Purpose]**
This command shows the prefixes present in the interface routing table. Interface name can also be given. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interface\_name*                          | Ethernet interface name (0..54)              |
| *vlan\_id*                                 | VLAN id (1..4094)                            |
| *lag-id*                                   | Link-aggregation interface number            |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show ipv6 ospf6 interface ethernet 1 prefix 1::1/64 match
```

### <font color="#1d50a2">ospf6 router-id *A.B.C.D*</font>

**\[Command]**
**ospf6 router-id *A.B.C.D***

**\[Purpose]**
This sets the router-ID of the OSPF6 process..

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *A.B.C.D*                                  | OSPF6 router-id in IP address format         |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf6
sonic(config-router)# ospf6 router-id 1.1.1.1
```

### <font color="#1d50a2">timers throttle spf delay\_time init\_hold\_time *max\_hold\_time*</font>

**\[Command]**
**timers throttle spf *delay\_time* *init\_hold\_time* *max\_hold\_time***
**no timers throttle spf *delay\_time* *init\_hold\_time* *max\_hold\_time***

**\[Purpose]**
This command sets the initial delay, the initial-holdtime and the maximum-holdtime. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *delay\_time*                              | time (msec) (0..600000)                      |
| *init\_hold\_time*                         | inital time (msec) (0..600000)               |
| *max\_hold\_time*                          | maxtime (msec) (0..600000)                   |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf6
sonic(config-router)# timers throttle spf 1 2 3
```

### <font color="#1d50a2">auto-cost reference-bandwidth *bandwidth*</font>

**\[Command]**
**auto-cost reference-bandwidth *bandwidth***
**no auto-cost reference-bandwidth *bandwidth***

**\[Purpose]**
This command configures the auto-cost reference broadband for OSPFv3. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>                      |
| ------------------------------------------ | ----------------------------------------------------------------- |
| *bandwidth*                                | The reference bandwidth in terms of Mbits per second (1..4294967) |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf6
sonic(config-router)# auto-cost reference-bandwidth 2
```

### <font color="#1d50a2">area \{A.B.C.D|area\_id\} range *X\:X\:\:X*\:X*/M*</font>

**\[Command]**
**area \{*A.B.C.D*|*area\_id*} range *X\:X\::X***:&#x58;***/M* \[advertise|not-advertise |cost *metric*]**
**no area \{*A.B.C.D*|*area\_id*} range *X\:X\::X***:&#x58;***/M* \[advertise|not-advertise |cost *metric*]**

**\[Purpose]**
Summarize a group of internal subnets into a single Inter-Area-Prefix LSA. This command can only be used at the area boundary (ABR router)

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>   |
| ------------------------------------------ | ---------------------------------------------- |
| *X\:X\::X*:&#x58;*/M*                      | IPv6 prefix                                    |
| *A.B.C.D*                                  | OSPF router-id                                 |
| *metric*                                   | advertised metric for this range (0..16777215) |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf6
sonic(config-router)# area 1.1.1.1 range 1::1/64 advertise
```

### <font color="#1d50a2">ipv6 ospf6 cost *COST*</font>

**\[Command]**
**ipv6 ospf6 cost *COST***
**no ipv6 ospf6 cost *COST***

**\[Purpose]**
Set link cost for the specified interface. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *COST*                                     | Cost (1..65535)                              |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 cost 12
```

### <font color="#1d50a2">ipv6 ospf6 hello-interval *interval*</font>

**\[Command]**
**ipv6 ospf6 hello-interval *interval***
**no ipv6 ospf6 hello-interval *interval***

**\[Purpose]**
Sets interface’s hello interval. Default value is 10

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |
| *A.B.C.D*                                  | Address of interface                         |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip ospf hello-interval 2 1.1.1.1
```

### <font color="#1d50a2">ipv6 ospf6 dead-interval *interval*</font>

**\[Command]**
**ipv6 ospf6 dead-interval *interval***
**no ipv6 ospf6 dead-interval *interval***

**\[Purpose]**
Set interface’s router dead Interval. Default value is 40. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 dead-interval 2
```

### <font color="#1d50a2">ipv6 ospf6 transmit-delay *interval*</font>

**\[Command]**
**ipv6 ospf6 transmit-delay *interval***
**no ipv6 ospf6 transmit-delay *interval***

**\[Purpose]**
Set number of seconds for infTransDelay value.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 retransmit-interval 2
```

### <font color="#1d50a2">ipv6 ospf6 priority *priority*</font>

**\[Command]**
**ipv6 ospf6 priority *priority***
**no ipv6 ospf6 priority *priority***

**\[Purpose]**
Set router priority integer value.

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *priority*                                 | Priority (0..255)                            |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 priority 12
```

### <font color="#1d50a2">ipv6 ospf6 retransmit-interval *interval*</font>

**\[Command]**
**ipv6 ospf6 retransmit-interval *interval***
**no ipv6 ospf6 retransmit-interval *interval***

**\[Purpose]**
Set number of seconds for rxmtInterval timer value

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *interval*                                 | Seconds (1..65535)                           |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 retransmit-interval 2
```

### <font color="#1d50a2">ipv6 ospf6 network \{broadcast|point-to-point\}</font>

**\[Command]**
**ipv6 ospf6 network \{broadcast|point-to-point}**
**no ipv6 ospf6 network \{broadcast|point-to-point}**

**\[Purpose]**
Set explicitly network type for specified interface

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 network broadcast
```

### <font color="#1d50a2">ipv6 ospf6 mtu-ignore</font>

**\[Command]**
**ipv6 ospf6 mtu-ignore**
**no ipv6 ospf6 mtu-ignore**

**\[Purpose]**
Ignore MTU when establish OSPFv3.

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 ospf6 mtu-ignore
```

### <font color="#1d50a2">redistribute \{babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table\}</font>

**\[Command]**
**redistribute \{babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[route-map *route\_map*]**
**no redistribute \{babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[route-map *route\_map*]**

**\[Purpose]**
Redistribute routes of the specified protocol or kind into OSPFv3, with the metric type and metric set if specified, filtering the routes using the given route-map if specified. 

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *route-map*                                | Pointer to route-map entries                 |

**\[View]**
OSPF view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router ospf6
sonic(config-router)# redistribute static route-map test
```

