OSPFv2 is designed for IPv4 networks. OSPFv3 is specifically developed for IPv6 networks and is built on top of the Internet Protocol version 6. OSPFv2 uses IPv4 unicast addressing to exchange routing information between routers. It relies on IPv4 addresses to identify network interfaces and establish OSPF adjacencies. OSPFv3, in contrast, uses IPv6 link-local addresses for neighbor discovery and communication. It also supports IPv6 unicast addressing for exchanging routing information.
Another difference is the way OSPFv2 and OSPFv3 handle the Routing Information Base (RIB). OSPFv2 uses the Routing Information Base (RIB) to store and manage IPv4 routing information. It maintains separate RIBs for different address families, such as IPv4 unicast and multicast. OSPFv3, on the other hand, employs a single RIB that can handle both IPv6 unicast and multicast routing information. OSPFv3 supports some advanced authentication like IPsec.
So basically, in the latest version of OSPF, we do not need to configure OSPFv2 for IPv4 and OSPFv3 for IPv6 separately. OSPFv3 can support IPv4 and IPv6 simultaneously.
One thing to remember in the case of ospfv3 is that the Router-Id should always be an IPv4 Address. So generally, if do not configure Router-ID manually, the first priority is given to the Highest loopback IP, then the Highest physical IP but the IPv4 address is not present in a topology, OSPF configuration shows the following error
OSPFv2 is configured on the subnet but OSPFv3 is always configured on the interface
For example: –
OSPFv2 looks like: –
R1(config)#router ospf {PROCESS ID}
R1(config-router)#network (IP ADDRESS} {WILDCARD MASK} {AREA}
But OSPFv3 looks like this: –
R1(config)#interface {INTERFACE NO.}
R1(config-if)#ospfv3 {PROCESS ID} ipv4 {AREA}
Let’s configure OSPFv3:
R1(config)#router ospfv3 1
%OSPFv3: IPv6 routing not enabled
# We need to enable IPV6 routing
R1(config)#ipv6 unicast-routing
R1(config)#interface fa1/0
R1(config-if)#ospfv3 1 ipv4 area 0
% OSPFv3: IPV6 is not enabled on this interface
# Since OSPFv3 is configured on the interfaces, we need to enable it on the interface as well
R1(config-if)#ipv6 enable
R1(config-if)#ospfv3 1 ipv4 area 0
R2
R2(config)#ipv6 unicast-routing
R2(config)#interface fa2/0
R2(config-if)#ipv6 enable
R2(config-if)#ospfv3 1 ipv4 area 0
When both the interface is configured, OSPF adjacency is established
Let us on check the results: –
R1#show ospfv3 neighbor
OSPFv3 1 address-family ipv4 (router-id 172.16.1.1)
Neighbor ID Pri State Dead Time Interface ID Interface
172.16.1.2 1 FULL/BDR 00:00:38 7 FastEthernet1/0
R1#show ospfv3 database
OSPFv3 1 address-family ipv4 (router-id 172.16.1.1)
Router Link States (Area 0)
ADV Router Age Seq# Fragment ID Link count Bits
172.16.1.1 77 0x80000002 0 1 None
172.16.1.2 73 0x80000002 0 1 None
Net Link States (Area 0)
ADV Router Age Seq# Link ID Rtr count
172.16.1.1 77 0x80000001 3 2
Link (Type-8) Link States (Area 0)
ADV Router Age Seq# Link ID Interface
172.16.1.1 193 0x80000001 3 Fa1/0
172.16.1.2 78 0x80000001 7 Fa1/0
Intra Area Prefix Link States (Area 0)
ADV Router Age Seq# Link ID Ref-lstype Ref-LSID
172.16.1.1 77 0x80000001 3072 0x2002 3
R1#show ipv6 route ospf
IPv6 Routing Table – default – 1 entries
Codes: C – Connected, L – Local, S – Static, U – Per-user Static route
B – BGP, R – RIP, H – NHRP, I1 – ISIS L1
I2 – ISIS L2, IA – ISIS interarea, IS – ISIS summary, D – EIGRP
EX – EIGRP external, ND – ND Default, NDp – ND Prefix, DCE – Destination
NDr – Redirect, O – OSPF Intra, OI – OSPF Inter, OE1 – OSPF ext 1
OE2 – OSPF ext 2, ON1 – OSPF NSSA ext 1, ON2 – OSPF NSSA ext 2, l – LISP
R1#show 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
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
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.1.0/24 is directly connected, FastEthernet1/0
L 172.16.1.1/32 is directly connected, FastEthernet1/0
conf t
hostname R1
ipv6 unicast-routing
router ospfv3 1
address-family ipv4
router-id 1.1.1.1
int e0/0
ospfv3 1 ipv4 area 0
conf t
hostname R2
ipv6 unicast-routing
router ospfv3 1
address-family ipv4
router-id 1.1.1.2
int e0/0
ospfv3 1 ipv4 area 0