Site is Under Maintenance
Please come back again in...
00 Days
00 Hours
00 Minutes
00 Seconds

Configuring OSPF Stub Areas Tutorial

### Configuring OSPF Stub Areas

Open Shortest Path First (OSPF) is a widely used interior gateway protocol (IGP) that allows routers to exchange routing information within an autonomous system. OSPF uses a link-state routing algorithm and supports hierarchical network design through the use of areas. One such area type is the **stub area**, which helps reduce the size of the routing table and limits the type of OSPF information exchanged.

This tutorial will provide detailed steps for configuring OSPF with stub areas, including terminal examples for each configuration step.

#### Prerequisites

- Basic knowledge of OSPF concepts.
- Access to Cisco routers or an emulator such as GNS3 or Cisco Packet Tracer.
- Routers configured with IP addresses on their interfaces.

### Step 1: Understand OSPF Area Types

OSPF supports different area types:

- **Standard Area**: Can receive all OSPF routing updates.
- **Stub Area**: Does not receive external routes (Type 5 LSAs), only default routes.
- **Totally Stubby Area**: Does not receive external routes or inter-area routes (Type 3 LSAs), only a default route.
- **Not-So-Stubby Area (NSSA)**: Similar to a stub area but allows external routes (Type 7 LSAs).

This tutorial will focus on configuring a stub area.

### Step 2: Basic OSPF Configuration

Before configuring a stub area, OSPF must be enabled on the routers involved. For this example, we will configure two routers, Router1 and Router2, which will communicate via a stub area.

#### Router1 Configuration

1. **Access Global Configuration Mode**:

   ```plaintext
   Router1> enable
   Router1# configure terminal
   ```

2. **Enable OSPF and Assign a Process ID**:

   ```plaintext
   Router1(config)# router ospf 1
   ```

3. **Configure Router ID** (Optional but recommended):

   ```plaintext
   Router1(config-router)# router-id 1.1.1.1
   ```

4. **Configure OSPF Networks**:

   Assuming the network connecting Router1 to Router2 is `10.1.1.0/24` and Router1 has a loopback interface `1.1.1.1/32`.

   ```plaintext
   Router1(config-router)# network 10.1.1.0 0.0.0.255 area 1
   Router1(config-router)# network 1.1.1.1 0.0.0.0 area 1
   ```

5. **Configure the Stub Area**:

   To configure Router1 to use a stub area, use the following command:

   ```plaintext
   Router1(config-router)# area 1 stub
   ```

6. **Exit Configuration Mode**:

   ```plaintext
   Router1(config-router)# exit
   Router1(config)# exit
   ```

#### Router2 Configuration

Repeat the same configuration steps for Router2 with appropriate adjustments.

1. **Access Global Configuration Mode**:

   ```plaintext
   Router2> enable
   Router2# configure terminal
   ```

2. **Enable OSPF and Assign a Process ID**:

   ```plaintext
   Router2(config)# router ospf 1
   ```

3. **Configure Router ID**:

   ```plaintext
   Router2(config-router)# router-id 2.2.2.2
   ```

4. **Configure OSPF Networks**:

   ```plaintext
   Router2(config-router)# network 10.1.1.0 0.0.0.255 area 1
   Router2(config-router)# network 2.2.2.2 0.0.0.0 area 1
   ```

5. **Configure the Stub Area**:

   ```plaintext
   Router2(config-router)# area 1 stub
   ```

6. **Exit Configuration Mode**:

   ```plaintext
   Router2(config-router)# exit
   Router2(config)# exit
   ```

### Step 3: Verify OSPF Configuration

After configuring OSPF on both routers, verify the configuration and the state of OSPF.

1. **Check OSPF Neighbors**:

   On both routers, check if the OSPF neighbor relationship is established:

   ```plaintext
   Router1# show ip ospf neighbor
   ```

   Output example:

   ```plaintext
   Neighbor ID     Pri   State           Dead Time   Address         Interface
   2.2.2.2          1    FULL/BDR       00:00:36    10.1.1.2       GigabitEthernet0/0
   ```

2. **Verify OSPF Routing Table**:

   Check the OSPF routing table to ensure routes are being learned correctly:

   ```plaintext
   Router1# show ip route ospf
   ```

   Output example:

   ```plaintext
   O   10.1.1.0/24 [110/20] via 10.1.1.2, 00:01:02, GigabitEthernet0/0
   ```

3. **Verify Area Configuration**:

   To confirm that the area is configured as a stub:

   ```plaintext
   Router1# show ip ospf area
   ```

   Output example:

   ```plaintext
   Area 1
   Area Type: Stub
   ```

### Step 4: Configure a Default Route for the Stub Area

In a stub area, routers do not receive external routes. To allow hosts in the stub area to reach outside networks, a default route must be configured.

1. **On Router1, Configure the Default Route**:

   ```plaintext
   Router1(config)# router ospf 1
   Router1(config-router)# area 1 stub default-cost 100
   ```

   This command sets the cost of the default route to 100.

2. **Exit Configuration Mode**:

   ```plaintext
   Router1(config-router)# exit
   Router1(config)# exit
   ```

### Step 5: Final Verification

After configuring the default route for the stub area, verify that the default route is present in the OSPF routing table.

1. **Check the OSPF Routing Table Again**:

   ```plaintext
   Router1# show ip route ospf
   ```

   Output example:

   ```plaintext
   O   0.0.0.0/0 [110/100] via 10.1.1.2, 00:02:05, GigabitEthernet0/0
   ```

### Conclusion

Configuring OSPF stub areas helps reduce routing table size and limits the propagation of routing information, improving network efficiency. By following this tutorial, you have successfully configured OSPF with a stub area on two routers, verified the configuration, and set up a default route for outside connectivity. Always remember to document your configurations and regularly monitor your OSPF settings for optimal performance.

Rate This Article

Thanks for reading: Configuring OSPF Stub Areas Tutorial, Sorry, my English is bad:)

Getting Info...

About the Author

I'm Aevon...Just a gal with an insane passion for all things cybersecurity. 17 years in the industry and still love what I'm doing.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.