# OSPF Single Area Configuration

### <mark style="color:blue;">**Introduction**</mark>

Open Shortest Path First (OSPF) is a link-state routing protocol used in medium to large networks due to its scalability and fast convergence. In this guide, we will configure <mark style="color:red;">**Single-Area OSPF**</mark> in <mark style="color:red;">**GNS3**</mark>, step by step, using a practical topology.

### <mark style="color:blue;">**Step 1: Network Topology & Scenario**</mark>

We will use <mark style="color:red;">**three routers (R1, R2, and R3)**</mark>, all belonging to <mark style="color:red;">**OSPF Area 0 (Backbone Area)**</mark>.

#### **Network Diagram**

<figure><img src="https://2804731566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLOszSitBb46QATDLUtW4%2Fuploads%2FukDTmdxW1JFryef1d6ve%2F0490-ccnp-single-area-ospf-topology.png?alt=media&#x26;token=08d84f2b-08b1-4a7d-bc98-dad769d463ea" alt=""><figcaption><p>Topology</p></figcaption></figure>

* **R1** connects to **R2** using **192.168.12.0/30**
* **R2** connects to **R3** using **192.168.23.0/30**
* All routers will participate in **OSPF Area 0**

### <mark style="color:blue;">**Step 2: Setting Up GNS3**</mark>

1. **Open GNS3** and create a new project.
2. **Drag and drop three routers (e.g., Cisco 7200 or C3725).**
3. **Connect the routers** as shown in the diagram using Ethernet links.
4. Assign IP addresses to interfaces.

### <mark style="color:blue;">**Step 3: Configuring IP Addresses**</mark>

* Router R1

```
R1#configure terminal
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.252
R1(config-if)#no shutdown
```

* Router R2

```
R2#configure terminal
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface fastEthernet 1/0
R2(config-if)#ip address 192.168.23.1 255.255.255.252
R2(config-if)#no shutdown
```

* Router R3

```
R3#configure terminal
R3(config)#interface fastEthernet 1/0
R3(config-if)#ip address 192.168.23.2 255.255.255.252
R3(config-if)#no shutdown
```

### <mark style="color:blue;">**Step 4: Configuring OSPF (Single Area 0)**</mark>

* Router R1

```
R1(config)#router ospf 1
R1(config-router)#network 192.168.12.0 0.0.0.3 area 0
```

* Router R2

```
R2(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.3 area 0
R2(config-router)#network 192.168.23.0 0.0.0.3 area 0
```

* Router R3

```
R3(config)#router ospf 1
R3(config-router)#network 192.168.23.0 0.0.0.3 area 0
```

### <mark style="color:blue;">**Step 5: Verify OSPF Configuration**</mark>

#### **Check OSPF Neighbor Relationships**

Run this command on **all routers**:

* Router R1

```
R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.1      1   FULL/DR         00:00:39    192.168.12.2    FastEthernet0/0
```

* Router R2

```
R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.2      1   FULL/BDR        00:00:30    192.168.23.2    FastEthernet1/0
192.168.12.1      1   FULL/BDR        00:00:32    192.168.12.1    FastEthernet0/0
```

* Router R3

```
R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.1      1   FULL/DR         00:00:38    192.168.23.1    FastEthernet1/0
```

#### **Check OSPF Routing Table**

Run this command on **all routers**:

* Router R1

```
R1#show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      192.168.23.0/30 is subnetted, 1 subnets
O        192.168.23.0 [110/2] via 192.168.12.2, 00:07:02, FastEthernet0/0
R1#
```

* Router R2

```
R2#show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

R2#
```

* Router R3

```
R3#show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      192.168.12.0/30 is subnetted, 1 subnets
O        192.168.12.0 [110/2] via 192.168.23.1, 00:08:09, FastEthernet1/0
R3#
```

### <mark style="color:blue;">**Step 5: Testing Connectivity**</mark>

Ping from **R1 to R3** to test end-to-end reachability:

```
R1#ping 192.168.23.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/48/80 ms
R1#
```

A successful ping means that OSPF has correctly learned and propagated routes.

### <mark style="color:blue;">Keywords</mark>

`OSPF`, `single area`, `configuration`, `GNS3`, `routing`, `Cisco`, `neighbor adjacency`, `link-state`, `area 0`, `SPF algorithm`, `LSAs`, `network topology`, `IP addressing`, `OSPF process`, `routing table`, `cost metric`, `hello packets`, `DR/BDR`, `route propagation`, `troubleshooting`, `CCNP`, `CCNA`, `سیسکو`
