Configuring OSPF on Cisco and HUAWEI Equipment

  • Tutorial
In the last article, we examined the main points of configuring HUAWEI network equipment and settled on static routing. In today's topic, we will focus on dynamic routing via OSPF protocol together with Cisco routers. Welcome to cat.


Theory


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



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

  • Internal router - A router whose interfaces all belong to the same zone. These routers have only one link state database.
  • Border router (area border router, ABR) - connects one or more zones to the trunk zone and acts as a gateway for inter-zone traffic. An edge router always has at least one interface in the trunk zone. For each attached zone, the router maintains a separate channel status database.
  • Backbone router — A router that always has at least one interface in its backbone. The definition is similar to an edge router, but the backbone router is not always an edge router. The internal router whose interfaces belong to the zero zone is also a trunk.
  • Autonomous system border router (ASBR) - exchanges information with routers belonging to other autonomous systems or non-OSPF routers. An autonomous system border router can reside anywhere in the autonomous system and be an internal, border, or trunk router. [1]


Area 0 - backbone zone, area 1 - stub zone.

  • Main (transit) zone (backbone (transit) area) - a zone used to connect other zones.
  • A stub area is a zone that does not accept information about routes that are external to a given autonomous system.
  • Completely stub area (totally stub area) - a zone that does not accept information about external routes and routes from other autonomous systems.


So, let's get down to setting up.

Initial setup:


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 setting up, you need to change the router-id values ​​and the advertised networks for different zones. Thus, the initial OSPF configuration would 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
!

R4 is an ABR, so it describes several zones. Until we put zone 1 into 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 routers R2 and R3 got out BDR and DR, respectively. Let me remind you what this means. Since learning the whole theory of OSPF is not the purpose of our story, we will briefly describe these concepts.

  1. DR, designated router - A router that controls the messaging process on an OSPF network.
  2. BDR, backup designated router - A router that replaces DR if the latter drops out.


The selection of BDR and DR is based on the priority of the router, but the default priorities of all devices are 1. In this case, the selection process proceeds according to the identifier of the router, which we observe. But there is one BUT. If DR and BDR are already selected, re-election does not occur. The principle applies: whoever first got up and slippers. Check it out. To do this, we exclude router R2 from the process.
[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 became BDR, R3 remained 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 the 172.16.1.0/24 network into the OSPF process on the R2 router.
[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 status 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 went into DROTHER state, i.e. it is neither DR nor BDR. May 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#

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

Same thing 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 take a closer look at the OSPF routes.
[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).

Route redistribution


We complicate the situation. Recall that the R2 router is also an autonomous system border router, i.e., there may potentially be other routers behind it. We’ll add a couple of static routes to paradise, that is, where they don’t come back from, forgive me the DNS DNS of Google.
[R2]ip route-static 8.8.8.8 32 NULL0
[R2]ip route-static 8.8.4.4 32 NULL0

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

T. about. image in the OSPF section config on router 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 see 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.

Same thing 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]

Setting Dead End Zones


We pass to the final stage - setting up the dead-end 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 routes came. We will transfer zone 1 to deadlock.
[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 routes have arrived, except for routes from other autonomous systems. Packets will be routed to all other addresses along the newly arrived default route.

We transfer zone 1 to an absolutely deadlock. 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 see 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 along the default route.

That's all. Thanks for attention.

List of sources used


1. OSPF xgu.ru - xgu.ru/wiki/OSPF
2. K. Package, D. Tyr: Creating scalable Cisco networks
3. HedEx Lite - documentation for HUAWEI equipment.

Also popular now: