# OSPF

### Base Setup

```
enable
config t
interface {interface} {interface_#}
no shutdown
ip address {ip_address} {subnet}
router ospf 1
network {network_address} {wildcard} area {area_#}
```

Example

```
enable
config t
interface GigabitEthernet 0/0
no shutdown
ip address 10.8.1.1 255.255.255.248
router ospf 1
network 10.8.1.0 0.0.0.7 area 0
```

### Add Authentication&#x20;

#### MD5:

[Documentation](https://networklessons.com/ospf/how-to-configure-ospf-md5-authentication)

```
enable 
config t 
interface {interface} {interface #} 
ip ospf message-digest-key {instance #} md5 {password}
ip ospf authentication message-digest
```

Example:

```
enable 
config t 
interface GigabitEthernet 0/0 
ip ospf message-digest-key 1 md5 testing 
ip ospf authentication message-digest
```

Verification:

```
enable
show ip ospf interface fastEthernet 0/0
```

Output:

<figure><img src="https://2527180782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcYDZrz0oE0BKGgsL9F63%2Fuploads%2Fq9KaJJz99XnHkUUOguOI%2Fimage.png?alt=media&#x26;token=36409876-5f50-49f3-9c5d-64614e944005" alt=""><figcaption><p>Verification Output</p></figcaption></figure>

#### SHA-512:

[Documentation](https://networklessons.com/cisco/ccie-routing-switching-written/ospf-hmac-sha-extended-authentication)

```
enable
config t
key chain {key_name}
key {#}
cryptographic-algorithm {algorithm}
key-string {password}
exit
interface {interface} {interface_#}
ip ospf authentication key-chain {key_name}
```

Example:

```
enable
config t
key chain R2
key 1
cryptographic-algorithm hmac-sha-512
key-string testing
exit
interface GigabitEthernet 0/1
ip ospf authentication key-chain R2
```

Verification:

```
enable
show ip ospf interface GigabitEthernet 0/1 | begin auth
```

Output:

<figure><img src="https://2527180782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcYDZrz0oE0BKGgsL9F63%2Fuploads%2FQzThNcIisofNK2HZ0PUV%2Fimage.png?alt=media&#x26;token=10392091-ab6a-4021-9746-aeb4beaecce0" alt=""><figcaption><p>Verification Output</p></figcaption></figure>
