HCIP-IERS deploys enterprise-level routing and switching network_OSPF protocol features and configuration_OSPF single area

Table of contents

Chapter 1 OSPF Protocol Features and Configuration

Experiment 1-1 OSPF Single Area

learning purpose

Topology

Scenes

Learning tasks

Step 1. Basic configuration and IP addressing

Step 2. Configure OSPF for a single area

Step 3. Observe the process of establishing the adjacency relationship of the router on the Ethernet

Step 4. Configure the network type of the Loopback interface in OSPF

Step 5. Modify the OSPF cost value of the interface

Step 6. Configure OSPF Silent-interface

Additional Experiments: Think and Verify

final device configuration


 

Chapter 1 OSPF Protocol Features and Configuration

Experiment  1-1  OSPF Single Area

learning purpose

Master the configuration method of single-area OSPF

Master the configuration method of OSPF area authentication

· Understand the process of OSPF establishing neighbor relationships in multi-access networks

Understand the form of OSPF mask distribution for the network connected to the Loopback interface

Master the method of modifying the cost value of OSPF interface

Master the configuration method of Silent-interface in OSPF

Master the method of using Display to view various states of OSPF

Master the method of using the Debug command to view the OSPF adjacency relationship and troubleshoot

Topology

 

Figure 1-1 OSPF single area

Scenes

You are the company's network administrator. Now there are three ARG3 routers in the company's network, which are connected to each other through Ethernet. On a broadcast multi-access network like Ethernet, there may be security risks, so you choose to use OSPF area authentication to avoid malicious routing attacks. In the process of deploying the network, there is a network connectivity problem. You use the display and debug commands to troubleshoot.

Learning tasks

Step 1. Basic configuration and IP addressing

Configure IP addresses and masks for R1, R2, and R3. During configuration, the configuration mask of the loopback interface is 24 bits, which is simulated as a separate network segment. After the configuration is complete, test the connectivity of the direct link.

<R1>system-view

Enter system view, return user view with Ctrl+Z.

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 10.0.123.1 24

[R1-GigabitEthernet0/0/0]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 10.0.1.1 24

[R1-LoopBack0]quit

<R2>system-view

Enter system view, return user view with Ctrl+Z.

[R2]interface GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]ip address 10.0.123.2 24

[R2-GigabitEthernet0/0/0]quit

[R2]interface LoopBack 0

[R2-LoopBack0]ip address 10.0.2.2 24

[R2-LoopBack0]quit

<R3>system-view

Enter system view, return user view with Ctrl+Z.

[R3]interface GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]ip address 10.0.123.3 24

[R3-GigabitEthernet0/0/0]quit

[R3]interface LoopBack 0

[R3-LoopBack0]ip address 10.0.3.3 24

[R3-LoopBack0]quit

After configuring the addresses of the interfaces, verify the connectivity between the routers.

[R1]ping -c 1 10.0.123.2

  PING 10.0.123.2: 56  data bytes, press CTRL_C to break

    Reply from 10.0.123.2: bytes=56 Sequence=1 ttl=255 time=2 ms

  --- 10.0.123.2 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 2/2/2 ms

[R1]ping -c 1 10.0.123.3

  PING 10.0.123.3: 56  data bytes, press CTRL_C to break

    Reply from 10.0.123.3: bytes=56 Sequence=1 ttl=255 time=2 ms

  --- 10.0.123.3 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 2/2/2 ms

[R2]ping -c 1 10.0.123.3

  PING 10.0.123.3: 56  data bytes, press CTRL_C to break

    Reply from 10.0.123.3: bytes=56 Sequence=1 ttl=255 time=2 ms

  --- 10.0.123.3 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 2/2/2 ms

Step 2. Configure OSPF for a single area

Configure single-area OSPF. All routers belonging to area 0 are configured to use OSPF process 1. At the same time, configure regional authentication and use the password "huawei". In the zone, Huawei devices support authentication using plaintext or MD5 values. Here, we only use plaintext for authentication.

Note that when using the network command, use 0.0.0.0 for the wildcard mask. To ensure the stability of the Router ID of the router, we use the router-id parameter to statically specify the Router ID of the router when starting the OSPF process .

[R1]ospf 1 router-id 10.0.1.1

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 10.0.123.1 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 10.0.1.1 0.0.0.0

[R1-ospf-1-area-0.0.0.0]authentication-mode simple plain huawei

[R1-ospf-1-area-0.0.0.0]quit

[R1-ospf-1]quit

[R2]ospf 1 router-id 10.0.2.2

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]network 10.0.123.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0]authentication-mode simple plain huawei

[R2-ospf-1-area-0.0.0.0]quit

[R2-ospf-1]quit

[R3]ospf 1 router-id 10.0.3.3

[R3-ospf-1]area 0

[R3-ospf-1-area-0.0.0.0]network 10.0.123.3 0.0.0.0

[R3-ospf-1-area-0.0.0.0]network 10.0.3.3 0.0.0.0

[R3-ospf-1-area-0.0.0.0]authentication-mode simple plain huawei

[R3-ospf-1-area-0.0.0.0]quit

[R3-ospf-1]quit

After the configuration is complete, check the routing table of the device and test the connectivity of the entire network. We start by looking at the routing table on R1.

 [R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

       10.0.2.2/32 OSPF  10   1       D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.3/32 OSPF  10   1       D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

From the output, we can see that R1 has learned two routes from OSPF, 10.0.2.2/32 and 10.0.3.3/32, and the next hops are 10.0.123.2 and 10.0.123.3 respectively. Then check the connectivity of the loopback addresses from R1 to R2 and R3 respectively.

[R1]ping -c 1 10.0.2.2

  PING 10.0.2.2: 56  data bytes, press CTRL_C to break

    Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=3 ms

  --- 10.0.2.2 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 3/3/3 ms

[R1]ping -c 1 10.0.3.3

  PING 10.0.3.3: 56  data bytes, press CTRL_C to break

    Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=255 time=2 ms

  --- 10.0.3.3 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 2/2/2 ms

Run the display ospf brief command to view basic OSPF information running on the router.

[R1]display ospf brief

         OSPF Process 1 with Router ID 10.0.1.1

                 OSPF Protocol Information

 RouterID: 10.0.1.1         Border Router:

 Multi-VPN-Instance is not enabled

 Global DS-TE Mode: Non-Standard IETF Mode

 Graceful-restart capability: disabled

 Helper support capability  : not configured

 Applications Supported: MPLS Traffic-Engineering

 Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms

 Default ASE parameters: Metric: 1 Tag: 1 Type: 2

 Route Preference: 10

 ASE Route Preference: 150

 SPF Computation Count: 9     

 RFC 1583 Compatible

 Retransmission limitation is disabled

 Area Count: 1   Nssa Area Count: 0

 ExChange/Loading Neighbors: 0

 Process total up interface count: 2

 Process valid up interface count: 1

 Area: 0.0.0.0          (MPLS TE not enabled)

 Authtype: Simple   Area flag: Normal

 SPF scheduled Count: 9     

 ExChange/Loading Neighbors: 0

 Router ID conflict state: Normal

 Area interface up count: 2

 Interface: 10.0.1.1 (LoopBack0)

 Cost: 0       State: P-2-P     Type: P2P       MTU: 1500  

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

 Interface: 10.0.123.1 (GigabitEthernet0/0/0)

 Cost: 1       State: DR        Type: Broadcast    MTU: 1500  

 Priority: 1

 Designated Router: 10.0.123.1

 Backup Designated Router: 10.0.123.2

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

From the above output, we can see that plaintext authentication (Authtype: Simple) is enabled in area 0, and two interfaces participate in the operation of OSPF: GigabitEthernet0/0/0 and LoopBack0. Among them, GigabitEthernet0/0/0 is a broadcast network (Broadcast), the cost (Cost) is 1, the priority (Priority) is 1, R1's own role is DR, and the BDR (10.0.123.2) on this network is listed later. The network type of another interface LoopBack0 running OSPF is P2P.

Run the display ospf peer brief command to check the establishment of the OSPF neighbor relationship of the router.

[R1]display ospf peer brief

         OSPF Process 1 with Router ID 10.0.1.1

                  Peer Statistic Information

 ----------------------------------------------------------------------------

 Area Id          Interface                        Neighbor id      State    

 0.0.0.0          GigabitEthernet0/0/0             10.0.2.2         Full        

 0.0.0.0          GigabitEthernet0/0/0             10.0.3.3         Full        

 ----------------------------------------------------------------------------

 Total Peer(s):     2

From the above output, we can see that in area 0.0.0.0, R1 has two neighbors, the router IDs of the neighbors are 10.0.2.2 and 10.0.3.3 respectively, and the status between them is Full.

Run the display ospf lsdb command to check the OSPF database information of the router.

[R1]display ospf lsdb

         OSPF Process 1 with Router ID 10.0.1.1

                 Link State Database

                         Area: 0.0.0.0

 Type    LinkState ID AdvRouter         Age  Len    Sequence   Metric

 Router 10.0.3.3 10.0.3.3          1569  48    80000005       0

 Router 10.0.2.2 10.0.2.2          1568  48    80000006       0

 Router 10.0.1.1 10.0.1.1          1567  48    80000008       0

 Network 10.0.123.110.0.1.1          1567  36    80000004       0

Here we can see a total of 4 LSAs. The first 3 are Type 1 LSAs, generated by R1, R2, and R3 respectively. We can use AdvRouter to determine which router generated the LSA. The fourth is the second type of LSA, which is generated by the DR of a network segment. Here, R1 is the DR of the network segment 10.0.123.0/24, so we can see that the AdvRouter of this LSA is 10.0.1.1.

[R1]display ospf lsdb router self-originate

         OSPF Process 1 with Router ID 10.0.1.1

                         Area: 0.0.0.0

                 Link State Database

  Type : Router

  Ls id      : 10.0.1.1

  Adv rtr : 10.0.1.1  

  Ls age : 430

  Len : 48

  Options :  E  

  seq# : 80000009

  chksum : 0x8188

  Link count: 2

   * Link ID: 10.0.1.1     

     Data   : 255.255.255.255

     Link Type: StubNet      

     Metric : 0

     Priority : Medium

   * Link ID : 10.0.123.1   

     Data : 10.0.123.1   

     Link Type: TransNet     

     Metric : 1

The above output is the detailed information of the Router LSA generated by R1. We can see that this LSA describes a total of 2 networks. The first network is the network segment where the loopback interface is located, and the link type is StubNet. Link ID and Data are the IP address and mask of the Stub network segment respectively. The second network is the Internet segment of the three routers, the link type is TransNet, you can see that the Link ID is the port address of DR 10.0.123.1, and the Data is the IP address of the local port on the network segment 10.0.123.1; 

[R1]display ospf lsdb network self-originate

         OSPF Process 1 with Router ID 10.0.1.1

                         Area: 0.0.0.0

                 Link State Database

  Type : Network

  Ls id : 10.0.123.1

  Adv rtr : 10.0.1.1  

  Ls age : 1662

  Len : 36

  Options :  E  

  seq# : 80000005

  chksum: 0x3d58

  Net mask : 255.255.255.0

  Priority : Low

     Attached Router    10.0.1.1

     Attached Router    10.0.2.2

     Attached Router    10.0.3.3

The above output is the detailed information of the Network LSA generated by R1. We can see that the second type of LSA describes the neighbor information of the network segment where the DR is located.

Step 3. Observe the process of establishing the adjacency relationship of the router on the Ethernet

First check the DR and BDR elections in the OSPF neighbor relationship on the 10.0.123.0/24 network segment, and analyze why this is the case? And whether the results are the same when everyone is doing this experiment?

We first check the DR and BDR elections in the OSPF neighbor relationship on the 10.0.123.0/24 network segment. From the output below, we can know that the interface IP of the DR on this network segment is 10.0.123.1, and the interface IP of the BDR is 10.0.123.2.

[R1]display ospf peer

         OSPF Process 1 with Router ID 10.0.1.1

                 Neighbors

 Area 0.0.0.0 interface 10.0.123.1(GigabitEthernet0/0/0)'s neighbors

 Router ID: 10.0.2.2         Address: 10.0.123.2      

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 10.0.123.1 BDR: 10 .0.123 .2   PERSON: 0    

   Dead timer due in 40  sec

   Retrans timer interval: 5

   Neighbor is up for 01:03:35     

   Authentication Sequence: [ 0 ]

 Router ID: 10.0.3.3         Address: 10.0.123.3      

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 10.0.123.1 BDR: 10.0.123.2 PERSON: 0    

   Dead timer due in 33  sec

   Retrans timer interval: 5

   Neighbor is up for 01:02:27     

   Authentication Sequence: [ 0 ]

It is possible that the output of the experimental results of each person is different. Because in OSPF, the election of DR is not preemptive, that is, when there is a DR or BDR in the network, a new router entering the network cannot preempt the role of DR or BDR. In this network, the router that starts the OSPF process or accesses the network first becomes the DR on the network segment, and other routers become the BDR or DROther.

When DR fails, BDR will take over the position of DR. In the experiment, we can observe the change of DR role by resetting the OSPF process. Here, we reset the OSPF process of R1.

<R1>reset ospf process

Warning: The OSPF process will be reset. Continue? [Y/N]:y

[R1]display ospf peer

         OSPF Process 1 with Router ID 10.0.1.1

                 Neighbors

 Area 0.0.0.0 interface 10.0.123.1(GigabitEthernet0/0/0)'s neighbors

 Router ID: 10.0.2.2         Address: 10.0.123.2      

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 10.0.123.2   BDR: 10.0.123.3   PERSON: 0    

   Dead timer due in 34  sec

   Retrans timer interval: 0

   Neighbor is up for 00:00:19     

   Authentication Sequence: [ 0 ]

 Router ID: 10.0.3.3         Address: 10.0.123.3      

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 10.0.123.2 BDR: 10.0.123.3 PERSON: 0    

   Dead timer due in 39  sec

   Retrans timer interval: 5

   Neighbor is up for 00:00:19     

   Authentication Sequence: [ 0 ]

After resetting the OSPF process of R1, the original BDR 10.0.123.2 on the network becomes the new DR, and the original DROother 10.0.123.3 becomes the new BDR.

Next, we shut down the G0/0/0 interfaces of R1, R2, and R3, and use the command debugging ospf 1 event to check the specific process of OSPF adjacency establishment. Then try to open the G0/0/0 interfaces of R1, R2 and R3 at the same time. Observe the change process of the neighbor state and the process of DR and BDR election on the broadcast multi-access network.

<R1>debugging ospf 1 event

<R1>terminal debugging

[R1]interface  GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]shut

[R1-GigabitEthernet0/0/0]undo shut

<R2>debugging ospf 1 event

<R2>terminal debugging

[R2]interface  GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]shut

[R2-GigabitEthernet0/0/0]undo shut

<R3>debugging ospf 1 event

<R3>terminal debugging

[R3]interface  GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]shutdown

[R3-GigabitEthernet0/0/0]undo shutdown

Perform the same operation on R2 and R3, and check the debug information of R3. Since the default interface priority of all routers is 1, the Router ID of the router will be referred to during the DR election. Among the three routers, the Router ID of R3 is the largest, so R3 becomes the DR on this network segment.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:54:59.220.1+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802c Line: 1326 Level: 0x20

  OSPF 1: Intf 10.0.123.3 Rcv InterfaceUp State Down -> Waiting.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:54:59.230.1+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802c Line: 1440 Level: 0x20

  OSPF 1 Send Hello Interface Up on 10.0.123.3

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:08.550.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1200 Level: 0x20

  OSPF 1: Nbr 10.0.123.1 Rcv HelloReceived State Down -> Init.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:09.530.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1200 Level: 0x20

  OSPF 1: Nbr 10.0.123.2 Rcv HelloReceived State Down -> Init.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:18.540.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1796 Level: 0x20

  OSPF 1: Nbr 10.0.123.1 Rcv 2WayReceived State Init -> 2Way.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:19.570.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1796 Level: 0x20

  OSPF 1: Nbr 10.0.123.2 Rcv 2WayReceived State Init -> 2Way.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.370.1+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1796 Level: 0x20

  OSPF 1: Nbr 10.0.123.1 Rcv AdjOk? State 2Way -> ExStart.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.370.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1796 Level: 0x20

  OSPF 1: Nbr 10.0.123.2 Rcv AdjOk? State 2Way -> ExStart.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.370.3+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802c Line: 2127 Level: 0x20

  OSPF 1 Send Hello Interface State Changed on 10.0.123.3

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.370.4+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802c Line: 2138 Level: 0x20

  OSPF 1: Intf 10.0.123.3 Rcv WaitTimer State Waiting -> DR.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.390.1+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1909 Level: 0x20

  OSPF 1: Nbr 10.0.123.1 Rcv NegotiationDone State ExStart -> Exchange.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.390.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 1909 Level: 0x20

  OSPF 1: Nbr 10.0.123.2 Rcv NegotiationDone State ExStart -> Exchange.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.400.1+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 2021 Level: 0x20

  OSPF 1: Nbr 10.0.123.1 Rcv ExchangeDone State Exchange -> Loading.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.400.2+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 2423 Level: 0x20

  OSPF 1: Nbr 10.0.123.1 Rcv LoadingDone State Loading -> Full.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.400.3+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 2021 Level: 0x20

  OSPF 1: Nbr 10.0.123.2 Rcv ExchangeDone State Exchange -> Loading.

[R3-GigabitEthernet0/0/0]

Oct 12 2016 11:55:39.400.4+00:00 R3 RM/6/RMDEBUG:

 FileID: 0xd017802d Line: 2423 Level: 0x20

  OSPF 1: Nbr 10.0.123.2 Rcv LoadingDone State Loading -> Full.

<R1>undo debugging all

<R2>undo debugging all

<R3>undo debugging all

When the interface is just opened, the interface status changes from Down to Waiting. At this time, the router starts to exchange Hello data packets. After waiting for about 40 seconds, the interface of R3 changes from Waiting to DR.

Step 4. Configure the network type of the Loopback interface in OSPF

Observe the routing table of R1, focusing on these two routes: 10.0.2.2/32 and 10.0.3.3/32.

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

       10.0.2.2/32 OSPF  10   1       D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.3/32 OSPF  10   1       D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

When configuring the loopback interface addresses of R2 and R3, the mask used is 24 bits. Why is the route with a 32-bit mask displayed in the routing table here?

Run the display ospf interface LoopBack 0 verbose command to check the status of OSPF running on the Loopback 0 interface.

[R1]display ospf interface LoopBack 0 verbose

         OSPF Process 1 with Router ID 10.0.1.1

                 Interfaces

 Interface: 10.0.1.1 (LoopBack0)

 Cost: 0       State: P-2-P     Type: P2P       MTU: 1500  

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

  IO Statistics

             Type        Input     Output

            Hello 0          0

   DB Description 0          0

   Link-State Req 0          0

Link-State Update 0          0

   Link-State Ack 0          0

 ALLSPF GROUP

 OpaqueId: 0   PrevState: Down

It can be seen that for the loopback interface, OSPF knows that the network segment can only have one IP address, so the subnet mask of the advertised route is 32 bits.

Change the network type of the Loopback0 interface on R2 to Broadcast. When OSPF advertises the network information of this interface, it will use a 24-bit mask to advertise.

[R2]interface LoopBack 0

[R2-LoopBack0]ospf network-type broadcast

At this time, we see that the routing subnet mask of the Loopback 0 address advertised by R2 is 24 bits.

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

       10.0.2.2/24 OSPF  10   1       D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.3/32 OSPF  10   1       D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

Run the display ospf interface LoopBack 0 verbose command to check the running status of the Loopback interface. You can see that the network type of the interface is Broadcast.

[R2]display ospf interface LoopBack 0 verbose

         OSPF Process 1 with Router ID 10.0.2.2

                 Interfaces

 Interface: 10.0.2.2 (LoopBack0)

 Cost: 0       State: DR        Type: Broadcast    MTU: 1500  

 Priority: 1

 Designated Router: 10.0.2.2

 Backup Designated Router: 0.0.0.0

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

  IO Statistics

             Type        Input     Output

            Hello 0          0

   DB Description 0          0

   Link-State Req 0          0

Link-State Update 0          0

   Link-State Ack 0          0

 ALLSPF GROUP

 ALLDR GROUP

 OpaqueId: 0   PrevState: Waiting

Step 5. Modify the OSPF cost value of the interface

First check the cost value of the route from R1 to the Loopback0 interface of R3 on R1. We can see that the cost value of the route to 10.0.3.3/32 is 1.

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

       10.0.2.2/24 OSPF  10   1       D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.3/32 OSPF  10   1       D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

Change the cost of the G0/0/0 interface on R1 to 20, and modify the cost of the G0/0/0 interface on R3 to 10.

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ospf cost 20

[R1-GigabitEthernet0/0/0]quit

[R3]interface GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]ospf cost 10

[R3-GigabitEthernet0/0/0]quit

Check the cost value of the route from R1 to the Loopback0 interface of R3 again, and you can see that the cost value of the route to 10.0.3.3/32 is 20.

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

       10.0.2.2/24 OSPF  10   20      D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.3/32 OSPF  10   20       D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

Looking at the cost value of 10.0.1.1/32 on R3, you can see that the value is 10.

[R3]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre  Cost   Flags NextHop         Interface

       10.0.1.1/32 OSPF    10   10 D   10.0.123.1     GigabitEthernet0/0/0

       10.0.2.0/24 OSPF    10   10 D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.0/24 Direct  0    0 D   10.0.3.3        LoopBack0

       10.0.3.3/32 Direct  0    0 D   127.0.0.1       LoopBack0

     10.0.3.255/32 Direct     0    0 D   127.0.0.1       LoopBack0

     10.0.123.0/24 Direct  0    0 D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.3/32 Direct  0    0 D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0 D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

Step 6. Configure OSPF Silent-interface

Configure the G0/0/0 interface of R1 as a silent-interface.

[R1]ospf 1

[R1-ospf-1]silent-interface GigabitEthernet 0/0/0

[R1-ospf-1]quit

Check the neighbor relationship establishment and routing table learning status of R1. It can be found that the routing entries learned from OSPF in the routing table disappear.

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0

View the neighbor list of R1, and you can see that the neighbor relationship between R1, R2, and R3 also disappears. After an interface is set as a Silent-interface in RIP, the interface will no longer send RIP updates. However, in OSPF, routers need to establish neighbor relationships before exchanging routing information. When an interface is set as Silent-interface, the interface will no longer receive or send Hello packets. As a result, the interface cannot form neighbor relationships with other routers.

 [R1]display ospf interface GigabitEthernet 0/0/0

         OSPF Process 1 with Router ID 10.0.1.1

                 Interfaces

 Interface: 10.0.123.1 (GigabitEthernet0/0/0)

 Cost: 20      State: DR        Type: Broadcast    MTU: 1500  

 Priority: 1

 Designated Router: 10.0.123.1

 Backup Designated Router: 0.0.0.0

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

 Silent interface, No hellos

Restore the G0/0/0 interface of R1 to the default state, and configure the Loopback0 interface of the three routers as Silent-interface.

[R1]ospf 1

[R1-ospf-1]undo silent-interface GigabitEthernet0/0/0

[R1-ospf-1]silent-interface LoopBack 0

[R1-ospf-1]quit

[R2]ospf 1

[R2-ospf-1]silent-interface LoopBack 0

[R1-ospf-1]quit

[R3]ospf 1

[R3-ospf-1]silent-interface LoopBack 0

[R1-ospf-1]quit

Check the routing table of R1. It can be seen that setting the loopback to Silent-interface does not affect the advertisement of the interface route.

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12       

Destination/Mask    Proto  Pre Cost    Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0      D   10.0.1.1        LoopBack0

       10.0.1.1/32 Direct  0    0      D   127.0.0.1       LoopBack0

     10.0.1.255/32 Direct  0    0      D   127.0.0.1       LoopBack0

       10.0.2.0/24 OSPF  10   20      D   10.0.123.2     GigabitEthernet0/0/0

       10.0.3.3/32 OSPF  10   20       D   10.0.123.3     GigabitEthernet0/0/0

     10.0.123.0/24 Direct  0    0      D   10.0.123.1     GigabitEthernet0/0/0

     10.0.123.1/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/0/0

   10.0.123.255/32 Direct  0    0      D   127.0.0.1      GigabitEthernet0/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/32Direct 0 0 D 127.0.0.1 InLoopBack0

Additional Experiments : Think and Verify

Why is the wildcard mask 0.0.0.0 used when configuring OSPF, and the wildcard mask 0.0.0.255 can also be used in the actual configuration? Think about the difference between these two expressions?

Analyze which types of interfaces should be configured as silent-interfaces in the actual network?

final device configuration

<R1>display current-configuration 

[V200R007C00SPC600]

#

 sysname R1

#

interface GigabitEthernet0/0/0

 ip address 10.0.123.1 255.255.255.0

 ospf cost 20

#

interface LoopBack0

 ip address 10.0.1.1 255.255.255.0

#

ospf 1 router-id 10.0.1.1

 silent-interface LoopBack0

 area 0.0.0.0

  authentication-mode simple plain huawei

  network 10.0.1.1 0.0.0.0

  network 10.0.123.1 0.0.0.0

#

return

<R2>display current-configuration

[V200R007C00SPC600]

#

 sysname R2

#

interface GigabitEthernet0/0/0

 ip address 10.0.123.2 255.255.255.0

#

interface LoopBack0

 ip address 10.0.2.2 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.2.2

 silent-interface LoopBack0

 area 0.0.0.0

  authentication-mode simple plain huawei

  network 10.0.2.2 0.0.0.0

  network 10.0.123.2 0.0.0.0

#

return

<R3>display current-configuration 

[V200R007C00SPC600]

#

 sysname R3

#

interface GigabitEthernet0/0/0

 ip address 10.0.123.3 255.255.255.0

 ospf cost 10

#

interface LoopBack0

 ip address 10.0.3.3 255.255.255.0

#

ospf 1 router-id 10.0.3.3

 silent-interface LoopBack0

 area 0.0.0.0

  authentication-mode simple plain huawei

  network 10.0.3.3 0.0.0.0

 network 10.0.123.3 0.0.0.0

#

return

Guess you like

Origin blog.csdn.net/weixin_57099902/article/details/131833018