Overview
The Open Shortest Path First (OSPF) protocol is a link-state Interior Gateway Protocol (IGP) developed by the Internet Engineering Task Force (IETF). OSPF Version 2 defined in RFC 2328 is designed for IPv4.
Prior to the emergence of OSPF, the Routing Information Protocol (RIP) was the most widely used IGP. RIP is a distance-vector routing protocol. Due to RIP's slow convergence, routing loops, and poor scalability, OSPF is now the most widely accepted and used IGP.
OSPF is a link-state routing protocol featuring:
l Multicast sending and receiving to reduce load on routers that are not running OSPF.
l Classless Inter-Domain Routing (CIDR).
l Load balancing among equal-cost routes.
l Packet encryption.
OSPF supports the following network types. This example describes the interconnection on a broadcast network, and subsequent examples will describe the interconnection on other three network types.
l Broadcast network.
l Point-to-point (P2P) network.
l Non-Broadcast Multi-Access (NBMA) network.
l Point to Multipoint (P2MP) network.
Precautions
l An AR router and a Cisco router communicate using the standard OSPF protocol.
l Table lists the matching product versions.
Matching product versions
Vendor |
Product |
Version |
Huawei |
AR router |
V200R006C10SPC300 and later versions. |
Cisco |
C29XX series routers |
Version 15.5(3)M. |
Networking Requirements
This example verifies OSPF interconnection between an AR router and a Cisco device in a broadcast scenario. In Figure 1-40, RouterA is directly connected to a Cisco device, and OSPF is configure on the two devices. RouterB is connected to RouterA to simulate a client to test whether RouterA and the Cisco device can communicate using OSPF.
OSPF interconnection between the AR router and Cisco device
Data Plan
Data plan for interconnection between the AR router and Cisco device
Item |
Parameter |
IP address of RouterA GE0/0/0 |
10.1.1.1/24 |
IP address of RouterA GE4/0/0 |
14.1.1.1/24 |
IP address of Cisco GE0/1 |
14.1.1.10/24 |
IP address of RouterB GE0/0/0 |
10.1.1.2/24 |
Configuration Process
Configuring RouterA
Configuration Roadmap
1. Configure IP addresses for interfaces of RouterA.
2. Configure OSPF routes.
Procedure
Configure IP addresses for GE0/0/0 and GE4/0/0 of RouterA. By default, the network type of Ethernet interfaces is broadcast. Therefore, the OSPF network type does not need to be configured here.
<Huawei>system-view
[Huawei]sysname RouterA
[RouterA]interface GigabitEthernet0/0/0
[RouterA-GigabitEthernet0/0/0]ip address 10.1.1.1 255.255.255.0
[RouterA-GigabitEthernet0/0/0]quit
[RouterA]interface GigabitEthernet4/0/0
[RouterA-GigabitEthernet4/0/0]ip address 14.1.1.1 255.255.255.0
[RouterA-GigabitEthernet4/0/0]quit
Configure OSPF routes.
[RouterA]ospf 1 router-id 10.1.1.1
[RouterA-ospf-1]area 0.0.0.0
[RouterA-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0]network 14.1.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0]quit
[RouterA-ospf-1]quit
----End
Configuring the Cisco Router
Configuration Roadmap
1. Configure IP addresses for interfaces of the Cisco router.
2. Configure OSPF routes.
Procedure
Configure an IP address for GE0/1 of the Cisco router. By default, the network type of Ethernet interfaces is broadcast. Therefore, the OSPF network type does not need to be configured here.
server>enable
server#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.End with CNTL/Z.
server(config)#interface gigabitEthernet 0/1
server(config-if)#ip address 14.1.1.10 255.255.255.0
server(config-if)#exit
Configure an OSPF route.
server(config)#router ospf 1
server(config-router)#network 14.1.1.0 0.0.0.255 area 0
server(config-router)#router-id 14.1.1.10
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
server(config-router)#exit
----End
Configuring RouterB
Configuration Roadmap
1. Configure IP addresses for interfaces of RouterB.
2. Configure OSPF routes.
Procedure
Configure an IP address for GE0/0/0 of Router B. By default, the network type of Ethernet interfaces is broadcast. Therefore, the OSPF network type does not need to be configured here.
<Huawei>system-view
[Huawei]sysname RouterB
[RouterB]interface GigabitEthernet 0/0/0
[RouterB-GigabitEthernet0/0/0]ip address 10.1.1.2 255.255.255.0
[RouterB-GigabitEthernet0/0/0]quit
Configure an OSPF route.
[RouterB]ospf 1 router-id 10.1.1.2
[RouterB-ospf-1]area 0.0.0.0
[RouterB-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0]quit
----End
Verification
1. Check the OSPF status of RouterA.
[RouterA]display ospf peer brief
OSPF Process 1 with Router ID 10.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet4/0/0 14.1.1.10 Full
0.0.0.0 GigabitEthernet0/0/0 10.1.1.2 Full
----------------------------------------------------------------------------
Total Peer(s): 2
[RouterA]
2. Check the routes of RouterA.
[RouterA]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet
0/0/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
14.1.1.0/24 Direct 0 0 D 14.1.1.1 GigabitEthernet
4/0/0
14.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
14.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
20.1.1.0/24 Direct 0 0 D 20.1.1.1 GigabitEthernet
0/0/2
20.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
20.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
100.100.100.100/32 Static 60 0 RD 14.1.1.2 GigabitEthernet
4/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[RouterA]
3. Check the OSPF status of RouterB.
[RouterB]display ospf peer brief
OSPF Process 1 with Router ID 10.1.1.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 10.1.1.1 Full
----------------------------------------------------------------------------
Total Peer(s): 1
[RouterB]
4. Check the routes of RouterB.
[RouterB]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet
0/0/0
10.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
14.1.1.0/24 OSPF 10 2 D 10.1.1.1 GigabitEthernet
0/0/0
100.100.100.100/32 O_ASE 150 1 D 10.1.1.1 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[RouterB]
5. Check the routes of the Cisco device.
server>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
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.1.1.0/24 [110/2] via 14.1.1.1, 00:00:01, GigabitEthernet0/1
C 10.9.0.0/24 is directly connected, Loopback1
server>
Exception Handling
If the AR router and Cisco device cannot establish an OSPF neighbor relationship, perform the following operations to rectify this fault:
Check whether the physical status and protocol status of interfaces on both ends are Up and stable, whether packets are lost on the interfaces, and whether the two devices can ping each other with large packets.
If the physical status of the interfaces is not Up or unstable (interfaces flap for example), check the physical link and link layer protocol and ensure that the physical status and protocol status of the interfaces are Up and the interfaces have no error packet statistics.
Check whether router IDs of OSPF processes on both ends are consistent.
If the router IDs are consistent, run the ospf [process-id] router-id router-id command in the system view to change them to be different. After changing the router IDs, you must run the reset ospf [process-id] process command in the user view to make the configured router ID take effect.
Check whether the two devices have the same OSPF area ID.
If the two devices have different OSPF area IDs, run the area area-id command in the OSPF view to change their OSPF area IDs to be the same.
Check whether OSPF interfaces on both ends have the same network type.
If the network types of the two OSPF interfaces are different, run the ospf network-type { broadcast | nbma | p2mp | p2p } command in the OSPF interface view to change their network types to be the same.
Check whether OSPF interfaces on both ends have the same IP address mask.
If the two OSPF interfaces have different IP address masks, run the ip address ip-address{mask | mask-length } command in the OSPF interface view to change their IP address masks to be the same.
----End