Single Area OSPF Configuration Example [Packet Tracer]
Contents
Topology:
Configurations of each node:
Router1:
R1#sh run
Building configuration...
Current configuration : 731 bytes
!
version 15.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 10.1.1.1 0.0.0.0 area 0
network 1.1.1.1 0.0.0.0 area 0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
Router 2 Configuration:
R2#sh run
Building configuration...
Current configuration : 778 bytes
!
version 15.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/0/1
ip address 10.1.2.1 255.255.255.0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 10.1.1.0 0.0.0.255 area 0
network 10.1.2.0 0.0.0.255 area 0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
Router 3 Configuration:
R3#sh run
Building configuration...
Current configuration : 776 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R3
!
!
ip cef
no ipv6 cef
!
license udi pid CISCO1941/K9 sn FTX15242C77
!
spanning-tree mode pvst
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
ip ospf 1 area 0
!
interface GigabitEthernet0/0
ip address 10.1.3.1 255.255.255.0
ip ospf 1 area 0
duplex auto
speed auto
!
interface GigabitEthernet0/1
ip address 10.1.2.2 255.255.255.0
ip ospf 1 area 0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
Router 4 Configuration:
R4#sh run
Building configuration...
Current configuration : 752 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R4
!
ip cef
no ipv6 cef
!
license udi pid CISCO1941/K9 sn FTX152462Z0
!
!
spanning-tree mode pvst
!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/0
ip address 10.1.3.2 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
Verification:
R1#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:38 10.1.1.2 GigabitEthernet0/0/0
R2#sh ip ospf neighbor
---------------------------
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:33 10.1.1.1 GigabitEthernet0/0/0
3.3.3.3 1 FULL/DR 00:00:33 10.1.2.2 GigabitEthernet0/0/1
R2#
-------------------------
R3#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
4.4.4.4 1 FULL/DR 00:00:32 10.1.3.2 GigabitEthernet0/0
2.2.2.2 1 FULL/BDR 00:00:32 10.1.2.1 GigabitEthernet0/1
R3#
-------------------------
R4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/BDR 00:00:34 10.1.3.1 GigabitEthernet0/0
After configuring Single Area OSPF in the 4 routers, we can check that R1 know about the other network advertised through OSPF, and its the same with all the nodes:
R1#sh ip route
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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2/32 [110/2] via 10.1.1.2, 00:14:07, GigabitEthernet0/0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3/32 [110/3] via 10.1.1.2, 00:14:07, GigabitEthernet0/0/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4/32 [110/4] via 10.1.1.2, 00:14:07, GigabitEthernet0/0/0
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.1.1.0/24 is directly connected, GigabitEthernet0/0/0
L 10.1.1.1/32 is directly connected, GigabitEthernet0/0/0
O 10.1.2.0/24 [110/2] via 10.1.1.2, 00:14:07, GigabitEthernet0/0/0
O 10.1.3.0/24 [110/3] via 10.1.1.2, 00:14:07, GigabitEthernet0/0/0
R1#