Pages

Tuesday, 15 October 2024

OSPF Using CPT

OSPF (Open Shortest Path First) is a common networking protocol used for routing within an autonomous system and is widely used due to its speed and scalability.

Topology Setup:
Let’s assume you have a basic topology with 3 routers connected to each other:
Router1
Router2
Router3
Each router will have an interface connected to its neighbor. 
The process involves:
  1. Assigning IP addresses to interfaces.
  2. Enabling OSPF and assigning networks to OSPF areas.

Step-by-Step Instructions
1. Setup the Topology
Drag and drop 3 routers onto the Packet Tracer workspace. Use appropriate cables to connect the routers (choose cross-over for routers if needed).Add PCs if you want to test connectivity, but this is optional for basic OSPF setup.

2. Enable OSPF on Each Router
After configuring the IP addresses, you will now enable OSPF on each router and assign the networks to an OSPF area.

Router1 OSPF Configuration:
Router# en
Router# configure terminal
Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 20.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 30.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 40.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 50.0.0.0. 0.255.255.255 area 0
Router(config-router)# exit




Router2 OSPF Configuration:
Router# en
Router# configure terminal
Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 20.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 30.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 40.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 50.0.0.0. 0.255.255.255 area 0
Router(config-router)# exit


Router3 OSPF Configuration:
Router# en
Router# configure terminal
Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 20.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 30.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 40.0.0.0. 0.255.255.255 area 0
Router(config-router)# network 50.0.0.0. 0.255.255.255 area 0
Router(config-router)# exit


4. Verify OSPF Configuration
To verify routing table entries:
Router# show ip route


To verify OSPF neighbors:
Router# show ip ospf neighbor


This should show you routes learned through OSPF, marked with an "O" for OSPF.

5. Test Connectivity
You can now use Ping from one router to another to check the connectivity through the OSPF network.
Router# ping 192.168.3.1
If OSPF is correctly configured, you should be able to ping between routers across different networks.


Notes:
OSPF works by building a link-state database and uses the Dijkstra algorithm to calculate the shortest path. This is why it quickly adapts to network changes.
You should ensure that all routers are in the same OSPF area (e.g., area 0), which is referred to as the backbone area.

Wildcard Mask Basics:
A wildcard mask is used in OSPF (Open Shortest Path First) and other routing protocols (like EIGRP) to define which bits of an IP address should be matched and which bits can vary. It’s essentially the inverse of a subnet mask.

A subnet mask uses binary 1s to represent network bits and 0s for host bits.
A wildcard mask is the opposite: it uses binary 0s to indicate which bits must match and 1s to indicate which bits can vary.

Key Concepts:
0 in the wildcard mask means "must match" (fixed bit).
1 in the wildcard mask means "can be anything" (wild bit).
Example: Wildcard Mask Calculation
For example, consider the subnet mask 255.255.255.0 (a /24 subnet):

Subnet Mask (Binary) Wildcard Mask (Binary)
11111111.11111111.11111111.00000000 00000000.00000000.00000000.11111111
The wildcard mask corresponding to 255.255.255.0 would be: 0.0.0.255

This wildcard mask tells the router that:
The first three octets must match exactly (because of the 0s),
The last octet can vary (because of the 255, which is all 1s).
Wildcard Mask Usage in OSPF
When configuring OSPF, you use the wildcard mask in the network command to specify which parts of the IP address should be considered for matching within OSPF areas.

Example in OSPF Configuration:
If you want to configure OSPF on the 192.168.1.0/24 network, you would use:
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
This command tells OSPF:

Match the first three octets (i.e., 192.168.1),
Allow any host address in the last octet (due to the 0.0.0.255 wildcard).
Another Example:
For the 10.10.0.0/16 network (subnet mask 255.255.0.0), the corresponding wildcard mask would be 0.0.255.255, meaning:
Router(config-router)# network 10.10.0.0 0.0.255.255 area 0
This command allows any host address in the last two octets (10.10.x.x), but the first two octets must match 10.10.

Summary of Common Subnet Masks and Corresponding Wildcard Masks:
Subnet Mask     Wildcard Mask
255.255.255.0     0.0.0.255
255.255.0.0     0.0.255.255
255.0.0.0             0.255.255.255
255.255.255.128   0.0.0.127
255.255.255.192   0.0.0.63
Formula to Calculate Wildcard Mask:
You can calculate the wildcard mask manually by subtracting each octet of the subnet mask from 255:
Wildcard Mask = 255.255.255.255 - Subnet Mask
For example:
Subnet Mask: 255.255.255.0
Wildcard Mask: 255.255.255.255 - 255.255.255.0 = 0.0.0.255

No comments:

Post a Comment

Peer-to-Peer Networks

  Peer-to-Peer (P2P) networks are a decentralized type of network architecture where each device (or node) on the network can act as both a...