# Implementing Multiple OSPF Areas

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

In this guide, we will configure multiple OSPF areas using Cisco routers in a practical scenario. You will learn how to:

* Configure OSPF in a multi-area environment.
* Define Area Border Routers (ABRs).
* Verify OSPF neighbor relationships and route advertisements.

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

Imagine a company with three branches, each connected through an OSPF network:

* <mark style="color:red;">**Area 0 (Backbone Area)**</mark>: The core of the network, connecting all areas.
* <mark style="color:red;">**Area 1 (Branch 1)**</mark>: A separate area for one branch.
* <mark style="color:red;">**Area 2 (Branch 2)**</mark>: Another separate area for another branch.

Each branch should communicate through <mark style="color:red;">**Area 0**</mark>.

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

We will use **five routers (R1, R2, R3, R4, R5)** in this topology:

<figure><img src="https://2804731566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLOszSitBb46QATDLUtW4%2Fuploads%2FwZy5T6uyErDjoQP39AfY%2F0486-ospf-topology.png?alt=media&#x26;token=8c0559d0-f1b5-44be-bf61-22409140c85a" alt=""><figcaption><p>Topology</p></figcaption></figure>

* **R1** is in **Area 0 (Backbone)**.
* **R2** is an **ABR (Area Border Router)**, connecting **Area 0 and Area 1**.
* **R3** is another **ABR**, connecting **Area 0 and Area 2**.
* **R4** belongs to **Area 1**.
* **R5** belongs to **Area 2**.

### **🛠️&#x20;**<mark style="color:blue;">**Step 2: IP Addressing Scheme**</mark>

Assign IP addresses as follows:

| Device | Interface | IP Address     | Area   |
| ------ | --------- | -------------- | ------ |
| R1     | s3/0      | 192.168.0.1/30 | Area 0 |
| R2     | s3/0      | 192.168.0.2/30 | Area 0 |
| R2     | s3/1      | 192.168.1.1/30 | Area 1 |
| R4     | s3/1      | 192.168.1.2/30 | Area 1 |
| R1     | s3/1      | 192.168.2.1/30 | Area 0 |
| R3     | s3/1      | 192.168.2.2/30 | Area 0 |
| R3     | s3/2      | 192.168.3.1/30 | Area 2 |
| R5     | s3/2      | 192.168.3.2/30 | Area 2 |

### <mark style="color:blue;">**⚙️ Step 3: Basic Configuring Each Router**</mark>

#### **📝 R1**&#x20;

```
R1#configure terminal
R1(config)#interface serial 3/0
R1(config-if)#ip address 192.168.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface serial 3/1
R1(config-if)#ip address 192.168.2.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#do wr mem
```

#### **📝 R2**

```
R2#configure terminal
R2(config)#interface serial 3/0
R2(config-if)#ip address 192.168.0.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface serial 3/1
R2(config-if)#ip address 192.168.1.1 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#do wr mem
```

#### **📝 R3**

```
R3#configure terminal
R3(config)#interface serial 3/1
R3(config-if)#ip address 192.168.2.2 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface serial 3/2
R3(config-if)#ip address 192.168.3.1 255.255.255.252
R3(config-if)#no shutdown                                                                                        changed state to up
R3(config-if)#do wr mem
```

#### **📝 R4**

```
R4#configure terminal
R4(config)#interface serial 3/1
R4(config-if)#ip address 192.168.1.2 255.255.255.252
R4(config-if)#no shutdown
R4(config-if)#do wr mem
```

#### **📝 R5**

```
R5#configure terminal
R5(config)#interface serial 3/2
R5(config-if)#ip address 192.168.3.2 255.255.255.252
R5(config-if)#no shutdown
R5(config-if)#do wr mem
```

### **⚙️&#x20;**<mark style="color:blue;">**Step 4: Configuring OSPF on Each Router**</mark>

Now, configure OSPF on each router.

📝 **R1 (Backbone Router in Area 0)**

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

📝 **R2 (ABR: Area 0 & Area 1)**

```
R2(config)#router ospf 1
R2(config-router)#network 192.168.0.0 0.0.0.3 area 0
R2(config-router)#network 192.168.1.0 0.0.0.3 area 1
```

📝 **R3 (ABR: Area 0 & Area 2)**

```
R3(config)#router ospf 1
R3(config-router)#network 192.168.2.0 0.0.0.3 area 0
R3(config-router)#network 192.168.3.0 0.0.0.3 area 2
```

📝 **R4 (Area 1 Router)**

```
R4(config)#router ospf 1
R4(config-router)#network 192.168.1.0 0.0.0.3 area 1
```

#### **📝** R5 (Area 2 Router)

```
R5(config)#router ospf 1
R5(config-router)#network 192.168.3.0 0.0.0.3 area 2
```

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

Now, let's check if OSPF is working properly.

#### **🔎 Verify OSPF Neighbor Relationships**

On **R1**:

```
R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.3.1       0   FULL/  -        00:00:39    192.168.2.2     Serial3/1
192.168.1.1       0   FULL/  -        00:00:33    192.168.0.2     Serial3/0
```

Output should show R2 and R3 as neighbors.

On **R2**:

```
R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.2.1       0   FULL/  -        00:00:39    192.168.0.1     Serial3/0
192.168.1.2       0   FULL/  -        00:00:37    192.168.1.2     Serial3/1
```

Should list R1 and R4.

On **R3**:

```
/R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.2.1       0   FULL/  -        00:00:33    192.168.2.1     Serial3/1
192.168.3.2       0   FULL/  -        00:00:38    192.168.3.2     Serial3/2
```

Should list R1 and R5.

#### **🔎 Verify OSPF Routing Table**

Check the routing table on **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.1.0/30 is subnetted, 1 subnets
O IA     192.168.1.0 [110/128] via 192.168.0.2, 00:07:53, Serial3/0
      192.168.3.0/30 is subnetted, 1 subnets
O IA     192.168.3.0 [110/128] via 192.168.2.2, 00:06:32, Serial3/1
```

It should display routes learned from Area 1 and Area 2.

### **🛠️&#x20;**<mark style="color:blue;">**Step 6: Testing Connectivity**</mark>

Use <mark style="color:red;">**ping**</mark> to ensure connectivity between different areas.

```
R4#ping 192.168.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/21/44 ms
R4#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/27/48 ms
R4#ping 192.168.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/66/96 ms
R4#
```

### **📌&#x20;**<mark style="color:blue;">**Key Takeaways**</mark>

* **OSPF Area 0 (Backbone Area) is mandatory** and connects all areas.
* **Area Border Routers (ABRs) are needed to connect different areas**.
* **Use `show ip ospf neighbor` to verify neighbor relationships**.
* **Use `show ip route ospf` to verify routes learned via OSPF**.
* **Testing with `ping` and `traceroute` ensures correct connectivity**.

### **🛠️&#x20;**<mark style="color:blue;">**Bonus: OSPF LSA Types in Multi-Area OSPF**</mark>

* **Type 1 (Router LSA)**: Sent by every router within an area.
* **Type 2 (Network LSA)**: Sent by DR (Designated Router).
* **Type 3 (Summary LSA)**: Sent by ABRs to summarize routes between areas.
* **Type 4 (ASBR Summary LSA)**: Used when an ASBR exists.
* **Type 5 (External LSA)**: Used for external routes (e.g., redistribution).

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

`OSPF`, `multiple areas`, `Area 0`, `ABR`, `backbone area`, `OSPF configuration`, `router`, `network`, `routing table`, `neighbor relationships`, `OSPF routing`, `area border router`, `LSR`, `LSA types`, `OSPF neighbor`, `OSPF area types`, `OSPF area boundary`, `area 1`, `area 2`, `OSPF design`, `IP address configuration`, `سیسکو`
