📜 ⬆️ ⬇️

Configuring OSPF on Cisco and HUAWEI Hardware

In the last article we looked at the main points of setting up HUAWEI network equipment and stopped at static routing. In today's topic, we’ll talk about dynamic OSPF routing in conjunction with Cisco routers. Welcome under cat.


Theory


So, in our super network there are 4 routers: two HUAWEI and two Cisco. Router R2 will be ASBR, R3 - ABR.


')
Let me remind you that in OSPF routers are divided into several types:



Area 0 - backbone zone, area 1 - dead end zone (stub).



So let's get down to setting it up.

Initial setting:


First, we need to create a vlan interface, assign it an appropriate ip address and allow traffic to pass through the physical interface, thus achieving ip connectivity between devices.

After that, enable the OSPF process on the routers:

Cisco:

R1(config)#router ospf 1 R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 R1(config-router)#network 1.1.1.1 0.0.0.0 area 0 R1(config-router)#router R1(config-router)#router-id 1.1.1.1 

HUAWEI:

 [R2]ospf 1 router-id 2.2.2.2 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255 [R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [R2-ospf-1-area-0.0.0.0] 

Naturally, when configuring, you need to change the values ​​of the router-id and advertised networks for different zones. Thus, the initial OSPF configuration will look like this:
R1 [Cisco]:
 router ospf 1 router-id 1.1.1.1 log-adjacency-changes redistribute static network 1.1.1.1 0.0.0.0 area 0 network 172.16.1.0 0.0.0.255 area 0 ! 

R2 [HUAWEI]:
 ospf 1 router-id 2.2.2.2 area 0.0.0.0 network 172.16.1.0 0.0.0.255 network 2.2.2.2 0.0.0.0 # 

R3 [HUAWEI]:
 ospf 1 router-id 3.3.3.3 area 0.0.0.0 network 3.3.3.0 0.0.0.3 network 172.16.1.0 0.0.0.255 area 0.0.0.1 network 172.16.2.0 0.0.0.3 # 

R4: [Cisco]
 router ospf 1 log-adjacency-changes area 1 stub network 4.4.4.4 0.0.0.0 area 1 network 172.16.2.0 0.0.0.3 area 1 ! 

Router R4 is ABR, so it describes several zones. For now, we will not convert zone 1 to the stub state. Let's see what we got:
 Switch#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/BDR 00:00:39 172.16.1.2 Vlan100 3.3.3.3 1 FULL/DR 00:00:31 172.16.1.3 Vlan100 Switch# 

DR, BDR, DROTHER


We see that R2 and R3 routers have chosen BDR and DR, respectively. Let me remind you what this means. Since knowing the whole theory of OSPF is not the goal of our narrative, we will describe these concepts briefly.

  1. DR, designated router (dedicated router) - a router that controls the messaging process in the OSPF network.
  2. BDR, backup designated router (backup dedicated router) - a router that replaces the DR in case of removal of the latter.


BDR and DR are selected based on the priority of the router, but by default, the priorities of all devices are 1. In this case, the selection process follows the router ID, which we observe. But there is one BUT. If DR and BDR are already selected, no re-election takes place. The principle applies: who first got up and sneakers. Check it out. To do this, exclude from the process the router R2.
 [R2]ospf 1 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]undo network 172.16.1.0 0.0.0.255 [R2-ospf-1-area-0.0.0.0] 

Now R1 has become BDR, while R3 remains DR:
 R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/DR 00:00:33 172.16.1.3 Vlan100 R1# 

 [R3]display ospf peer OSPF Process 1 with Router ID 3.3.3.3 Neighbors Area 0.0.0.0 interface 172.16.1.3(Vlanif100)'s neighbors Router ID: 1.1.1.1 Address: 172.16.1.1 State: Full Mode:Nbr is Slave Priority: 1 !!!!!DR: 172.16.1.3 BDR: 172.16.1.1!!!!! MTU: 1500 Dead timer due in 35 sec Retrans timer interval: 4 Neighbor is up for 00:35:59 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.1 interface 172.16.2.1(Vlanif101)'s neighbors Router ID: 4.4.4.4 Address: 172.16.2.2 State: Full Mode:Nbr is Master Priority: 1 DR: 172.16.2.2 BDR: 172.16.2.1 MTU: 1500 Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:56:48 Authentication Sequence: [ 0 ] [R3] 

Now we will again include in the OSPF process on the R2 router the network 172.16.1.0/24.
 [R2]ospf 1 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255 [R2-ospf-1-area-0.0.0.0] 

Now let's see the state of the routers:
 R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/DROTHER 00:00:36 172.16.1.2 Vlan100 3.3.3.3 1 FULL/DR 00:00:39 172.16.1.3 Vlan100 R1# 

The second router is in the DROTHER state, i.e. it is neither a DR nor a BDR. Let it be so.

Interzonal route exchange


Now let's see what we have in the routing tables.
 R1#show ip route Codes: 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, 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 Gateway of last resort is not set 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/1] via 172.16.1.2, 00:05:59, Vlan100 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/1] via 172.16.1.3, 00:05:59, Vlan100 4.0.0.0/32 is subnetted, 1 subnets O IA 4.4.4.4 [110/3] via 172.16.1.3, 00:05:59, Vlan100 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks C 172.16.1.0/24 is directly connected, Vlan100 O IA 172.16.2.0/30 [110/2] via 172.16.1.3, 00:05:59, Vlan100 R1# 

Flags IA mean that the route came from another OSPF zone.

The same on HUAWEI.
 [R2]disp ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 OSPF 10 2 D 172.16.1.1 Vlanif100 2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0 3.3.3.3/32 OSPF 10 1 D 172.16.1.3 Vlanif100 4.4.4.4/32 OSPF 10 3 D 172.16.1.3 Vlanif100 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 172.16.1.0/24 Direct 0 0 D 172.16.1.2 Vlanif100 172.16.1.2/32 Direct 0 0 D 127.0.0.1 Vlanif100 172.16.2.0/30 OSPF 10 2 D 172.16.1.3 Vlanif100 [R2] 

In the global routing table it is clearly not visible that the route 4.4.4.4/32 came from another zone. Let's look in more detail routes under the OSPF protocol.
 [R2]dis ospf routing OSPF Process 1 with Router ID 2.2.2.2 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 2.2.2.2/32 0 Stub 2.2.2.2 2.2.2.2 0.0.0.0 172.16.1.0/24 1 Transit 172.16.1.2 2.2.2.2 0.0.0.0 1.1.1.1/32 2 Stub 172.16.1.1 1.1.1.1 0.0.0.0 3.3.3.3/32 1 Stub 172.16.1.3 3.3.3.3 0.0.0.0 4.4.4.4/32 3 Inter-area 172.16.1.3 3.3.3.3 0.0.0.0 172.16.2.0/30 2 Inter-area 172.16.1.3 3.3.3.3 0.0.0.0 Total Nets: 6 Intra Area: 4 Inter Area: 2 ASE: 0 NSSA: 0 [R2] 

Here we see that routes 4.4.4.4/32 and 172.16.2.0/30 came from another zone (Inter-area).

Redistributing routes


Complicate the situation. Recall that R2 is part-time an autonomous system border router, i.e., it may potentially have other routers behind it. Let's add a couple of static routes to paradise, i.e., wherever they don't return from, forgive me Google's DNS.
 [R2]ip route-static 8.8.8.8 32 NULL0 [R2]ip route-static 8.8.4.4 32 NULL0 

And add the redistribution of static routes:
 [R2]ospf 1 [R2-ospf-1]import-route static 

T. o. follows the configuration of the OSPF section on R2:
 [R2-ospf-1]di th # ospf 1 router-id 2.2.2.2 import-route static area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 172.16.1.0 0.0.0.255 # return [R2-ospf-1] 

Let's look at the routing tables.
 R1#show ip route Codes: 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, 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 Gateway of last resort is not set 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/1] via 172.16.1.2, 00:01:49, Vlan100 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/1] via 172.16.1.3, 00:01:49, Vlan100 4.0.0.0/32 is subnetted, 1 subnets O IA 4.4.4.4 [110/3] via 172.16.1.3, 00:01:49, Vlan100 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks C 172.16.1.0/24 is directly connected, Vlan100 O IA 172.16.2.0/30 [110/2] via 172.16.1.3, 00:01:50, Vlan100 8.0.0.0/32 is subnetted, 2 subnets O E2 8.8.8.8 [110/1] via 172.16.1.2, 00:01:50, Vlan100 O E2 8.8.4.4 [110/1] via 172.16.1.2, 00:01:52, Vlan100 9.0.0.0/32 is subnetted, 1 subnets O E2 9.9.9.9 [110/1] via 172.16.1.2, 00:01:52, Vlan100 R1# 

The E flag means that routes were imported from another routing protocol.

The same on HUAWEI:
 [R3]disp ospf routing OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 3.3.3.3/32 0 Stub 3.3.3.3 3.3.3.3 0.0.0.0 172.16.1.0/24 1 Transit 172.16.1.3 3.3.3.3 0.0.0.0 172.16.2.0/30 1 Transit 172.16.2.1 3.3.3.3 0.0.0.1 1.1.1.1/32 2 Stub 172.16.1.1 1.1.1.1 0.0.0.0 2.2.2.2/32 1 Stub 172.16.1.2 2.2.2.2 0.0.0.0 4.4.4.4/32 2 Stub 172.16.2.2 4.4.4.4 0.0.0.1 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 8.8.4.4/32 1 Type2 1 172.16.1.2 2.2.2.2 8.8.8.8/32 1 Type2 1 172.16.1.2 2.2.2.2 Total Nets: 8 Intra Area: 6 Inter Area: 0 ASE: 2 NSSA: 0 [R3] 

Stub zones setup


We proceed to the final stage - setting up the deadlock zone area 1. First, let's see which routes came to the unfairly forgotten R4 router.
 R4#show ip route Codes: 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, 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 Gateway of last resort is not set 1.0.0.0/32 is subnetted, 1 subnets O IA 1.1.1.1 [110/3] via 172.16.2.1, 00:02:18, Vlan101 2.0.0.0/32 is subnetted, 1 subnets S 2.2.2.2 [1/0] via 172.16.2.1 3.0.0.0/32 is subnetted, 1 subnets O IA 3.3.3.3 [110/1] via 172.16.2.1, 00:02:18, Vlan101 4.0.0.0/32 is subnetted, 1 subnets C 4.4.4.4 is directly connected, Loopback0 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks O IA 172.16.1.0/24 [110/2] via 172.16.2.1, 00:02:18, Vlan101 C 172.16.2.0/30 is directly connected, Vlan101 8.0.0.0/32 is subnetted, 2 subnets O E2 8.8.8.8 [110/1] via 172.16.2.1, 00:02:19, Vlan101 O E2 8.8.4.4 [110/1] via 172.16.2.1, 00:02:21, Vlan101 C 192.168.254.0/24 is directly connected, Vlan96 R4# 

We see that absolutely all the routes have come. Translate zone 1 to a dead end.
 [R3]ospf 1 [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.1]stub [R3-ospf-1-area-0.0.0.1] 

 R4(config)#router ospf 1 R4(config-router)#area 1 stub R4(config-router)# 

We look at the routing table:
 R4#show ip route Codes: 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, 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 Gateway of last resort is 172.16.2.1 to network 0.0.0.0 1.0.0.0/32 is subnetted, 1 subnets O IA 1.1.1.1 [110/3] via 172.16.2.1, 00:01:54, Vlan101 2.0.0.0/32 is subnetted, 1 subnets O IA 2.2.2.2 [110/2] via 172.16.2.1, 00:00:04, Vlan101 3.0.0.0/32 is subnetted, 1 subnets O IA 3.3.3.3 [110/1] via 172.16.2.1, 00:01:54, Vlan101 4.0.0.0/32 is subnetted, 1 subnets C 4.4.4.4 is directly connected, Loopback0 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks O IA 172.16.1.0/24 [110/2] via 172.16.2.1, 00:01:54, Vlan101 C 172.16.2.0/30 is directly connected, Vlan101 C 192.168.254.0/24 is directly connected, Vlan96 O*IA 0.0.0.0/0 [110/2] via 172.16.2.1, 00:01:54, Vlan101 R4# 

We see that all the routes have arrived, except for routes from other autonomous systems. For all other addresses, the packets will be routed along the newly arrived default route.

Translate zone 1 into an absolutely dead-end. This can only be done on the ABR router.
 [R3]ospf 1 [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.1]stub no-summary [R3-ospf-1-area-0.0.0.1] 

Let's look at the routing table:
 R4#show ip route Codes: 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, 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 Gateway of last resort is 172.16.2.1 to network 0.0.0.0 4.0.0.0/32 is subnetted, 1 subnets C 4.4.4.4 is directly connected, Loopback0 172.16.0.0/30 is subnetted, 1 subnets C 172.16.2.0 is directly connected, Vlan101 C 192.168.254.0/24 is directly connected, Vlan96 O*IA 0.0.0.0/0 [110/2] via 172.16.2.1, 00:00:03, Vlan101 R4# 

We see that now all packets, except for directly connected networks will be routed by default.

That's all. Thanks for attention.

List of used sources


1. OSPF xgu.ru - xgu.ru/wiki/OSPF
2. K. Package, D. Tyr: Creating Cisco Scalable Networks
3. HedEx Lite - HUAWEI hardware documentation.

Source: https://habr.com/ru/post/153865/


All Articles