Skip to content

Commit

Permalink
feat(docs): Open Shortest Path First Version 2
Browse files Browse the repository at this point in the history
Signed-off-by: Royal Simpson Pinto <[email protected]>
  • Loading branch information
royalpinto007 committed Jun 2, 2024
1 parent d843e54 commit 0a708a0
Show file tree
Hide file tree
Showing 2 changed files with 296 additions and 0 deletions.
Binary file added Images/ImagesForNetworkConfiguration/OSPFv2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
296 changes: 296 additions & 0 deletions NetworkConfigurations/RoutingAndForwarding/OSPFv2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
---
title: Open Shortest Path First Version 2
grand_parent: Network Configuration
parent: Routing and Forwarding
nav_order: 3
layout: default
---

# Open Shortest Path First Version 2 (OSPFv2)

OSPFv2 is a widely used interior gateway protocol (IGP) for routing Internet Protocol (IP) packets within a single routing domain, which can be an autonomous system. It uses a link-state routing algorithm and provides efficient and scalable routing in large and complex network topologies. For more information, please refer- [OSPFv2](https://datatracker.ietf.org/doc/html/rfc2328).

This document provides detailed instructions for installing and configuring OSPFv2 on DENT devices using FRR (Free Range Routing).

## Installation of FRR

To install FRR (Free Range Routing) with OSPF support on DENT Devices, follow the steps below:

### Installation using APT:

```
curl -s https://deb.frrouting.org/frr/keys.gpg | sudo tee /usr/share/keyrings/frrouting.gpg > /dev/null
FRRVER="frr-stable"
echo deb '[signed-by=/usr/share/keyrings/frrouting.gpg]' https://deb.frrouting.org/frr \
$(lsb_release -s -c) $FRRVER | sudo tee -a /etc/apt/sources.list.d/frr.list
sudo apt update && sudo apt install frr frr-pythontools
```

Note: Ensure that `apt-transport-https` and `curl` are installed before proceeding with the installation.

### Installation using Snapcraft (Alternative Method):

```
sudo apt update
sudo apt install snapd
sudo snap install core
sudo snap install frr
```

### Start and Enable FRR Service:

```
sudo systemctl start frr
sudo systemctl enable frr
```

Output-

```
Synchronizing state of frr.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable frr
```

## Example Configuration

### Enable OSPFd:

Edit the FRR daemon configuration file on both the devices:

```
sudo nano /etc/frr/daemons
```

Ensure the following configuration:

```
zebra=yes
bgpd=no
ospfd=yes
ospf6d=no
ripd=no
ripngd=no
```

<p align="center">
<img src="../../Images/ImagesForNetworkConfiguration/OSPFv2.png" alt="OSPFv2">
</p>

### Assign IP Addresses:

On Device 1 (dent3.2-1):

```
ip addr add 192.168.1.3/24 dev enp0s4
ip link set dev enp0s4 up
```

On Device 2 (dent3.2-2):

```
ip addr add 192.168.1.2/24 dev enp0s4
ip link set dev enp0s4 up
```

### Configure OSPF:

Edit the FRR configuration file on both the devices:

```
sudo nano /etc/frr/frr.conf
```

Add the following configuration to the file:

```
! Enable OSPF routing process
router ospf
! Configure OSPF on the enp0s4 interface
interface enp0s4
ip ospf area 0
```

**Note:** The configuration may vary depending on user requirements.

### Restart FRR:

```
sudo systemctl restart frr
```

### Interacting with OSPF:

To access the interactive OSPF shell:

```
sudo vtysh
```

Output-

```
Hello, this is FRRouting (version 8.5).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
```

After accessing the `vtysh` shell, you can execute OSPF-specific commands such as `show ip ospf`, `show ip ospf neighbor`, and `show ip route` to inspect OSPF configurations and neighbor relationships.

- `show ip ospf`: Displays the current status and configuration details of the OSPF routing process.
- `show ip ospf neighbor`: Lists the OSPF neighbor relationships and their statuses.
- `show ip route`: Shows the current routing table and all the IP routes known to the device.

For more information on these and other available commands, please refer to [OSPFv2 FRR](https://docs.frrouting.org/en/latest/ospfd.html).

**Device 1 (dent3.2-1) Output:**

```
localhost# show ip ospf
OSPF Routing Process, Router ID: 192.168.122.239
Supports only single TOS (TOS0) routes
This implementation conforms to RFC2328
RFC1583Compatibility flag is disabled
OpaqueCapability flag is disabled
Initial SPF scheduling delay 0 millisec(s)
Minimum hold time between consecutive SPFs 50 millisec(s)
Maximum hold time between consecutive SPFs 5000 millisec(s)
Hold time multiplier is currently 1
SPF algorithm last executed 24m06s ago
Last SPF duration 18 usecs
SPF timer is inactive
LSA minimum interval 5000 msecs
LSA minimum arrival 1000 msecs
Write Multiplier set to 20
Refresh timer 10 secs
Maximum multiple paths(ECMP) supported 256
Administrative distance 110
Number of external LSA 0. Checksum Sum 0x00000000
Number of opaque AS LSA 0. Checksum Sum 0x00000000
Number of areas attached to this router: 1
Area ID: 0.0.0.0 (Backbone)
Number of interfaces in this area: Total: 1, Active: 1
Number of fully adjacent neighbors in this area: 1
Area has no authentication
SPF algorithm executed 3 times
Number of LSA 3
Number of router LSA 2. Checksum Sum 0x00016820
Number of network LSA 1. Checksum Sum 0x00000c16
Number of summary LSA 0. Checksum Sum 0x00000000
Number of ASBR summary LSA 0. Checksum Sum 0x00000000
Number of NSSA LSA 0. Checksum Sum 0x00000000
Number of opaque link LSA 0. Checksum Sum 0x00000000
Number of opaque area LSA 0. Checksum Sum 0x00000000
```

```
localhost# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
K>* 0.0.0.0/0 [0/0] via 192.168.122.1, ma1, 00:27:17
O 192.168.1.0/24 [110/100] is directly connected, enp0s4, weight 1, 00:27:17
C>* 192.168.1.0/24 is directly connected, enp0s4, 00:27:17
C>* 192.168.122.0/24 is directly connected, ma1, 00:27:17
```

```
localhost# show ip ospf neighbor
Neighbor ID Pri State Up Time Dead Time Address Interface RXmtL RqstL DBsmL
192.168.122.24 1 Full/DR 28m50s 39.104s 192.168.1.2 enp0s4:192.168.1.3 0 0 0
```

**Device 2 (dent3.2-2) Output:**

```
localhost# show ip ospf
OSPF Routing Process, Router ID: 192.168.122.24
Supports only single TOS (TOS0) routes
This implementation conforms to RFC2328
RFC1583Compatibility flag is disabled
OpaqueCapability flag is disabled
Initial SPF scheduling delay 0 millisec(s)
Minimum hold time between consecutive SPFs 50 millisec(s)
Maximum hold time between consecutive SPFs 5000 millisec(s)
Hold time multiplier is currently 1
SPF algorithm last executed 25m45s ago
Last SPF duration 40 usecs
SPF timer is inactive
LSA minimum interval 5000 msecs
LSA minimum arrival 1000 msecs
Write Multiplier set to 20
Refresh timer 10 secs
Maximum multiple paths(ECMP) supported 256
Administrative distance 110
Number of external LSA 0. Checksum Sum 0x00000000
Number of opaque AS LSA 0. Checksum Sum 0x00000000
Number of areas attached to this router: 1
Area ID: 0.0.0.0 (Backbone)
Number of interfaces in this area: Total: 1, Active: 1
Number of fully adjacent neighbors in this area: 1
Area has no authentication
SPF algorithm executed 3 times
Number of LSA 3
Number of router LSA 2. Checksum Sum 0x00016820
Number of network LSA 1. Checksum Sum 0x00000c16
Number of summary LSA 0. Checksum Sum 0x00000000
Number of ASBR summary LSA 0. Checksum Sum 0x00000000
Number of NSSA LSA 0. Checksum Sum 0x00000000
Number of opaque link LSA 0. Checksum Sum 0x00000000
Number of opaque area LSA 0. Checksum Sum 0x00000000
```

```
localhost# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
K>* 0.0.0.0/0 [0/0] via 192.168.122.1, ma1, 00:30:12
O 192.168.1.0/24 [110/100] is directly connected, enp0s4, weight 1, 00:30:12
C>* 192.168.1.0/24 is directly connected, enp0s4, 00:30:12
C>* 192.168.122.0/24 is directly connected, ma1, 00:30:12
```

```
localhost# show ip ospf neighbor
Neighbor ID Pri State Up Time Dead Time Address Interface RXmtL RqstL DBsmL
192.168.122.239 1 Full/Backup 28m01s 30.286s 192.168.1.3 enp0s4:192.168.1.2 0 0 0
```

**Connectivity Verification:**

```
dent3.2-1# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=3.15 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=9.17 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=3.83 ms
64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=11.8 ms
```

```
dent3.2-2# ping 192.168.1.3
PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data.
64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=3.34 ms
64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=11.5 ms
64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=8.71 ms
64 bytes from 192.168.1.3: icmp_seq=4 ttl=64 time=4.64 ms
```

By following these steps, you will have successfully installed and configured OSPFv2 on your DENT devices using FRR. This setup ensures efficient and scalable routing within your network. Adjust configurations as needed based on specific requirements. For further customization, refer to [OSPFv2 FRR](https://docs.frrouting.org/en/latest/ospfd.html) documentation.

0 comments on commit 0a708a0

Please sign in to comment.