HCIP-IERS deploys enterprise-level routing and switching network_BGP protocol features and configuration_IBGP and EBGP

Table of contents

Chapter 3 BGP Protocol Features and Configuration

Experiment 3-1 IBGP and EBGP

learning purpose

Topology

Scenes

Learning tasks

Step 1. Basic configuration and IP addressing

Step 2. Configure intra-area IGP

Step 3. Establish an IBGP peer

Step 4. Configure EBGP peers

Step 5. Use the Network command to publish routing information

Additional Experiments: Think and Verify

final device configuration


 

Chapter 3 BGP Protocol Features and Configuration

Experiment 3-1 IBGP and EBGP

learning purpose

Master the configuration method of BGP in the area

Master the configuration method of multi-area BGP

·Observe BGP neighbor table and database

Master the configuration method of BGP update source

Master the configuration method of EBGP multi-hop

·Observe the change of the next hop of the route in IBGP and EBGP

Master the configuration of the next hop in IBGP

Master the configuration method of BGP Network command

Topology

 

Figure 3-1 IBGP and EBGP

Scenes

You are the company's network administrator. The company's network uses the BGP protocol as a routing protocol. The company's network consists of multiple autonomous systems, and different branches use different AS numbers. Now you need to complete the construction of the company network. The company headquarters uses OSPF as the IGP, and the different branches of the company use private BGP AS numbers. After completing the network construction, you also need to observe the transmission of BGP routing information.

Learning tasks

Step 1. Basic configuration and IP addressing

Configure IP addresses and masks for all routers. The masks of the loopback 1 interfaces of R4 and R5 are 24 bits, simulating a user network.

<R1>system-view

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

[R1]interface Serial 1/0/0

[R1-Serial1/0/0]ip address 10.0.12.1 24

[R1-Serial1/0/0]quit

[R1]interface Serial 3/0/0

[R1-Serial3/0/0]ip address 10.0.14.1 24

[R1-Serial3/0/0]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 10.0.1.1 32

[R1-LoopBack0]quit

<R2>system-view

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

[R2]interface Serial 1/0/0

[R2-Serial1/0/0]ip address 10.0.12.2 24

[R2-Serial1/0/0]quit

[R2]interface Serial 2/0/0

[R2-Serial2/0/0]ip address 10.0.23.2 24

[R2-Serial2/0/0]quit

[R2]interface LoopBack 0

[R2-LoopBack0]ip address 10.0.2.2 32

<R3>system-view

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

[R3]interface Serial 2/0/0

[R3-Serial2/0/0]ip address 10.0.23.3 24

[R3-Serial2/0/0]quit

[R3]interface Serial 3/0/0

[R3-Serial3/0/0]ip address 10.0.35.3 24

[R3-Serial3/0/0]quit

[R3]interface LoopBack 0

[R3-LoopBack0]ip address 10.0.3.3 32

<R4>system-view

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

[R4]interface Serial 1/0/0

[R4-Serial1/0/0]ip address 10.0.14.4 24

[R4-Serial1/0/0]quit

[R3]interface LoopBack 0

[R4-LoopBack0]ip address 10.0.4.4 32

<R5>system-view

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

[R5]interface Serial 1/0/0

[R5-Serial1/0/0]ip address 10.0.35.5 24

[R5-Serial1/0/0]quit

[R3]interface LoopBack 0

[R5-LoopBack0]ip address 10.0.5.5 32

Test the connectivity of each direct link.

<R1>ping -c 1 10.0.12.2

  PING 10.0.12.2: 56  data bytes, press CTRL_C to break

    Reply from 10.0.12.2: bytes=56 Sequence=1 ttl=255 time=34 ms

  --- 10.0.12.2 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

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

<R1>ping -c 1 10.0.14.4

  PING 10.0.14.4: 56  data bytes, press CTRL_C to break

    Reply from 10.0.14.4: bytes=56 Sequence=1 ttl=255 time=40 ms

  --- 10.0.14.4 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

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

<R3>ping -c 1  10.0.23.2

  PING 10.0.23.2: 56  data bytes, press CTRL_C to break

    Reply from 10.0.23.2: bytes=56 Sequence=1 ttl=255 time=33 ms

  --- 10.0.23.2 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

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

<R3>ping -c 1 10.0.35.5

  PING 10.0.35.5: 56  data bytes, press CTRL_C to break

    Reply from 10.0.35.5: bytes=56 Sequence=1 ttl=255 time=35 ms

  --- 10.0.35.5 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

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

It shows that the direct connection connectivity is normal.

Step 2. Configure intra-area IGP

Use OSPF as the IGP in AS 64512, and advertise the network segment connected to Loopback 0 into OSPF. The network segment connected to S1/0/0 of R1 runs OSPF.

[R1]router id 10.0.1.1

[R1]ospf 1

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 10.0.12.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]quit

[R1-ospf-1]quit

The network segment connected to S1/0/0 and S2/0/0 of R2 runs OSPF.

[R2]router id 10.0.2.2

[R2]ospf 1

[R2-ospf-1]area 0

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

[R2-ospf-1-area-0.0.0.0]network 10.0.23.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]quit

[R2-ospf-1]quit

The network segment connected to S2/0/0 of R3 runs OSPF.

[R3]router id 10.0.3.3

[R3]ospf 1

[R3-ospf-1]area 0

[R3-ospf-1-area-0.0.0.0]network 10.0.23.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]quit

[R3-ospf-1]quit

Note that when using the network command, use 0.0.0.0 for the wildcard mask.

After the configuration is complete, check whether the OSPF neighbor relationship is established.

[R2]display ospf peer

          OSPF Process 1 with Router ID 10.0.2.2

                 Neighbors

 Area 0.0.0.0 interface 10.0.12.2(Serial1/0/0)'s neighbors

 Router ID: 10.0.1.1         Address: 10.0.12.1       

   State: Full  Mode:Nbr is  Slave  Priority: 1

   DR: None   BDR: None   MTU: 0    

   Dead timer due in 37  sec

   Retrans timer interval: 5

   Neighbor is up for 00:01:05     

   Authentication Sequence: [ 0 ]

                 Neighbors

 Area 0.0.0.0 interface 10.0.23.2(Serial2/0/0)'s neighbors

 Router ID: 10.0.3.3         Address: 10.0.23.3       

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: None   BDR: None   MTU: 0    

   Dead timer due in 33  sec

   Retrans timer interval: 5

   Neighbor is up for 00:00:19     

   Authentication Sequence: [ 0 ]

View the routing tables of all routers. Check whether the route of the network segment of the loopback interface of the peer device is learned.

[R1]display ip routing-table

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

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

Routing Tables: Public

         Destinations : 15       Routes : 15       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.1/32 Direct 0    0            D   127.0.0.1       LoopBack0

10.0.2.2/32 OSPF  10   1562 D   10.0.12.2       Serial1/0/0

       10.0.3.3/32 OSPF 10 3124D 10.0.12.2 Serial1/0/0

      10.0.12.0/24 Direct  0    0 D   10.0.12.1       Serial1/0/0

      10.0.12.1/32 Direct  0    0 D   127.0.0.1       Serial1/0/0

      10.0.12.2/32 Direct  0    0 D   10.0.12.2       Serial1/0/0

    10.0.12.255/32 Direct  0    0 D   127.0.0.1       Serial1/0/0

      10.0.14.0/24 Direct  0    0 D   10.0.14.1       Serial3/0/0

      10.0.14.1/32 Direct  0    0 D   127.0.0.1       Serial3/0/0

      10.0.14.4/32 Direct  0    0 D   10.0.14.4       Serial3/0/0

    10.0.14.255/32 Direct  0    0 D   127.0.0.1       Serial3/0/0

      10.0.23.0/24 OSPF  10   3124 D   10.0.12.2       Serial1/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/3 Direct 0 0 D 127.0.0.1 InLoopBack0

[R2]display ip routing-table

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

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

Routing Tables: Public

         Destinations : 15       Routes : 15       

Destination/Mask     Proto   Pre  Cost      Flags NextHop         Interface

10.0.1.1/32   OSPF     10   1562        D   10.0.12.1       Serial1/0/0

10.0.2.2/32 Direct  0    0           D   127.0.0.1       LoopBack0

10.0.3.3/32   OSPF     10   1562        D   10.0.23.3       Serial2/0/0

10.0.12.0/24 Direct  0    0           D   10.0.12.2       Serial1/0/0

10.0.12.1/32 Direct  0    0           D   10.0.12.1       Serial1/0/0

10.0.12.2/32 Direct  0    0           D   127.0.0.1       Serial1/0/0

10.0.12.255/32 Direct    0    0           D   127.0.0.1       Serial1/0/0

10.0.23.0/24 Direct    0    0           D   10.0.23.2       Serial2/0/0

10.0.23.2/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

10.0.23.3/32 Direct  0    0           D   10.0.23.3       Serial2/0/0

10.0.23.255/32 Direct  0    0           D   127.0.0.1       Serial2/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

[R3]display ip routing-table

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

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

Routing Tables: Public

         Destinations : 16       Routes : 16       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.1/32 OSPF  10   3124        D   10.0.23.2       Serial2/0/0

       10.0.2.2/32 OSPF  10   1562        D   10.0.23.2       Serial2/0/0

       10.0.3.3/32 Direct  0    0           D   127.0.0.1       LoopBack0

      10.0.12.0/24 OSPF  10   3124     D   10.0.23.2       Serial2/0/0

      10.0.23.0/24 Direct  0    0           D   10.0.23.3       Serial2/0/0

      10.0.23.2/32 Direct  0    0           D   10.0.23.2       Serial2/0/0

      10.0.23.3/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

    10.0.23.255/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

      10.0.35.0/24 Direct  0    0           D   10.0.35.3       Serial3/0/0

      10.0.35.3/32 Direct  0    0           D   127.0.0.1       Serial3/0/0

      10.0.35.5/32 Direct  0    0           D   10.0.35.5       Serial3/0/0

    10.0.35.255/32 Direct  0    0           D   127.0.0.1       Serial3/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 routing tables of R1, R2, and R3, it can be seen that each router can learn the route of the network segment connected to the loopback 0 interface of the other two routers.

Step 3. Establish an IBGP peer

Configure IBGP full interconnection on R1, R2, and R3. Use the Loopback0 address as the update source.

[R1]bgp 64512

[R1-bgp]peer 10.0.2.2 as-number 64512

[R1-bgp]peer 10.0.2.2 connect-interface LoopBack 0

[R1-bgp]peer 10.0.3.3 as-number 64512

[R1-bgp]peer 10.0.3.3 connect-interface LoopBack 0

[R1-bgp]quit

[R2]bgp 64512

[R2-bgp]peer 10.0.1.1 as-number 64512

[R2-bgp]peer 10.0.1.1 connect-interface loopback 0

[R2-bgp]peer 10.0.3.3 as-number 64512

[R2-bgp]peer 10.0.3.3 connect-interface LoopBack 0

[R2-bgp]quit

[R3]bgp 64512

[R3-bgp]peer 10.0.1.1 as-number 64512

[R3-bgp]peer 10.0.1.1 connect-interface loopback 0

[R3-bgp]peer 10.0.2.2 as-number 64512

[R3-bgp]peer 10.0.2.2 connect-interface LoopBack 0

[R3-bgp]quit

Run the display tcp status command to view the connection status of the TCP port.

[R2]display tcp status

TCPCB    Tid/Soid Local Add:port        Foreign Add:port    VPNID   State

37a32f14 76 /1     0.0.0.0:80            0.0.0.0:0             23553   Listening

37a33b34 239/2 0.0.0.0:179 10.0.1.1:0 0 Listening

39052914 239/6    0.0.0.0:179           10.0.3.3:0            0        Listening

37a3321c 76 /3     0.0.0.0:443           0.0.0.0:0             23553    Listening

39052c1c 239/11   10.0.2.2:179          10.0.3.3:54086       0        Established

3905260c 239/5    10.0.2.2:61635        10.0.1.1:179         0        Established

From the entries, we can see that the Local Add is 10.0.2.2 (that is, the Loopback0 interface address of R2), and the port number is 179 (the TCP port number of the BGP protocol). The status with 10.0.3.3 and 10.0.1.1 is Established, indicating that the TCP connections between R2, R1 and R3 have been established.

Use display bgp peer to view the status of the BGP neighbor relationship of each router.

[R1]display bgp peer

 BGP local router ID : 10.0.1.1

 Local AS number : 64512

 Total number of peers : 2                Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down     State  PrefRcv

  10.0.2.2        4       64512      273      277     0 02:15:53 Established       0

  10.0.3.3        4       64512      276      276     0 02:15:53 Established       0

[R2]display bgp peer

 BGP local router ID : 10.0.2.2

 Local AS number : 64512

 Total number of peers : 2                Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down   State    PrefRcv

  10.0.1.1        4       64512       38       38     0 00:18:02 Established       0

  10.0.3.3        4       64512     1000     1000     0 16:38:38 Established       0

[R3]display bgp peer

 BGP local router ID : 10.0.3.3

 Local AS number : 64512

 Total number of peers : 2                Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down     State  PrefRcv

  10.0.1.1        4       64512       39       39     0 00:18:35 Established       0

  10.0.2.2        4       64512     1001     1001     0 16:39:11 Established       0

It can be seen that the BGP neighbor relationship between the three routers is in the Established state, indicating that the neighbor relationship has been established.

Use the timer under the BGP process on R1 to modify the keep-alive time of BGP to 30 seconds and the hold time to 90 seconds. Check whether there is a problem with the establishment of the peer relationship between R1 and R2, and use the display bgp peer verbose command to check the negotiation interval after the establishment.

[R1-bgp] bgp 64512

[R1-bgp] timer keepalive 30 hold 90

Warning: Changing the parameter in this command resets the peer session. Continue?[Y/N]:y

[R1-bgp]quit

Note: Modifying this parameter will cause bgp neighbors to restart.

[R2]display bgp peer verbose

        BGP Peer is 10.0.1.1,  remote AS 64512  

        Type: IBGP link

        BGP version 4, Remote router ID 10.0.1.1

        Update-group ID: 1  

        BGP current state: Established, Up for 00h07m19s

        BGP current event: KATimerExpired

        BGP last state: OpenConfirm

        BGP Peer Up count: 2

        Received total routes: 0

        Received active routes total: 0

        Advertised total routes: 0

        Port:  Local - 50117    Remote - 179

        Configured: Connect-retry Time: 32 sec

        Configured: Active Hold Time: 180 sec   Keepalive Time:60 sec

        Received  : Active Hold Time: 90 sec

        Negotiated: Active Hold Time: 90 sec    Keepalive Time:30 sec

        Peer optional capabilities:

        Peer supports bgp multi-protocol extension

        Peer supports bgp route refresh capability

        Peer supports bgp 4-byte-as capability

        Address family IPv4 Unicast: advertised and received

 Received: Total 16 messages

                 Update messages                0

                 Open messages                  1

                 KeepAlive messages             15

                 Notification messages          0

                 Refresh messages               0

 Sent: Total 16 messages

                 Update messages                0

                 Open messages                  1

                 KeepAlive messages             15

                 Notification messages          0

                 Refresh messages               0

 Authentication type configured: None

 Last keepalive received: 2011/12/07 08:33:52    

 Minimum route advertisement interval is 15 seconds

 Optional capabilities:

 Route refresh capability has been enabled

 4-byte-as capability has been enabled

 Connect-interface has been configured

 Peer Preferred Value: 0

 Routing policy configured:

 No routing policy is configured

        BGP Peer is 10.0.3.3,  remote AS 64512  

        Type: IBGP link

        BGP version 4, Remote router ID 10.0.3.3

        Update-group ID: 1  

        BGP current state: Established, Up for 16h28m14s

        BGP current event: RecvKeepalive

        BGP last state: OpenConfirm

        BGP Peer Up count: 1

        Received total routes: 0

        Received active routes total: 0

        Advertised total routes: 0

        Port:  Local - 179      Remote - 49663

        Configured: Connect-retry Time: 32 sec

        Configured: Active Hold Time: 180 sec   Keepalive Time:60 sec

        Received  : Active Hold Time: 180 sec

        Negotiated: Active Hold Time: 180 sec   Keepalive Time:60 sec

        Peer optional capabilities:

        Peer supports bgp multi-protocol extension

        Peer supports bgp route refresh capability

        Peer supports bgp 4-byte-as capability

        Address family IPv4 Unicast: advertised and received

 Received: Total 990 messages

                 Update messages                0

                 Open messages                  1

                 KeepAlive messages             989

                 Notification messages          0

                 Refresh messages               0

 Sent: Total 990 messages

                 Update messages                0

                 Open messages                  1

                 KeepAlive messages             989

                 Notification messages          0

                 Refresh messages               0

 Authentication type configured: None

 Last keepalive received: 2011/12/07 08:34:17    

 Minimum route advertisement interval is 15 seconds

 Optional capabilities:

 Route refresh capability has been enabled

 4-byte-as capability has been enabled

 Connect-interface has been configured

 Peer Preferred Value: 0

 Routing policy configured:

 No routing policy is configured

You can see that the default configuration parameters Active Hold Time on R2 are 180s and Keepalive Time is 60s.

After the parameter of R1 is modified, the Active Hold Time of R2 receiving the data packet is 90s. The negotiated parameters are parameters with small values, so the negotiation result between R2 and R1 is that the Active Hold Time is 90s, the keepalive Time is 30s, and the parameters of R3 are still the default parameters.

R2 is the same as R3, so the configuration parameters of the negotiation result are consistent with the negotiation parameters, the Active Hold Time is 180s, and the Keepalive Time is 60s.

Step 4. Configure EBGP peers

Configure BGP on R4, set the local AS number to 64513, and establish an EBGP peer relationship with R1. When establishing a peer relationship, specify the update source as the address of the loopback 0 interface and specify ebgp-max-hop as 2. Add a 32-bit static route to the address of the peer Loopback 0 interface so that it can establish a peer relationship normally.

[R1]ip route-static 10.0.4.4 32 10.0.14.4

[R4]ip route-static 10.0.1.1 32 10.0.14.1

[R1]bgp 64512

[R1-bgp]peer 10.0.4.4 as-number 64513

[R1-bgp]peer 10.0.4.4 ebgp-max-hop 2

[R1-bgp]peer 10.0.4.4 connect-interface LoopBack0

[R1-bgp]quit

[R4]router id 10.0.4.4

[R4]bgp 64513

[R4-bgp]peer 10.0.1.1 as-number 64512

[R4-bgp]peer 10.0.1.1 ebgp-max-hop 2

[R4-bgp]peer 10.0.1.1 connect-interface LoopBack0

[R4-bgp] says

After the peer relationship is established, run the display bgp peer command to check the status of the peer relationship.

[R4]display bgp peer

 BGP local router ID : 10.0.4.4

 Local AS number : 64513

 Total number of peers : 1                Peers in established state : 1

Peer         V        AS  MsgRcvd   MsgSent     OutQ    Up/Down  State PrefRcv

10.0.1.1      4       64512      4        5     0 00:01:18    Established       0

Run the debug ging  ip packet verbose command on R4 to view the TTL value of keepalive packets.

<R4>terminal monitor

<R4>terminal debugging

<R4>debugging ip packet

<R4>

Oct 31 2016 17:22:44.900.2+00:00 R4 IP/7/debug_case:

Receiving, interface = Serial1/0/0, version = 4, headlen = 20, tos = 192,

pktlen = 40, pktid = 429, offset = 0, ttl = 2, protocol = 6,

checksum = 40287, s = 10.0.1.1, d = 10.0.4.4

prompt: IP Process By Board Begin!

   

45 c0 00 28 01 ad 00 00 02 06 9d 5f 0a 00 01 01

0a 00 04 04

Oct 31 2016 17:22:44.900.3+00:00 R4 IP/7/debug_case:

Receiving, interface = Serial1/0/0, version = 4, headlen = 20, tos = 192,

pktlen = 40, pktid = 429, offset = 0, ttl = 2, protocol = 6,

checksum = 40287, s = 10.0.1.1, d = 10.0.4.4

prompt: Before search fib per flow in IP Forward.

You can see that the TTL in the received packets is 2.

An EBGP peer relationship is also established between R3 and R5. The connection is established directly using the physical interface address.

[R3]bgp 64512

[R3-bgp]peer 10.0.35.5 as-number 64514

[R3-bgp]quit

[R5]router id 10.0.5.5

[R5]bgp 64514

[R5-bgp]peer 10.0.35.3 as-number 64512

[R5-bgp]quit

[R5]display bgp peer  

BGP local router ID : 10.0.5.5

 Local AS number : 64514

 Total number of peers : 1                Peers in established state : 1

  Peer            V         AS       MsgRcvd  MsgSent  OutQ  Up/Down  State PrefRcv

  10.0.35.3       4       64512        2        3     0 00:00:46 Established       0

Step 5. Use the Network command to publish routing information

Configure Loopback1 on R4 with the address 10.1.4.4/24. Use the network command to advertise the network segment into BGP.

[R4]interface LoopBack 1

[R4-LoopBack1]ip address 10.1.4.4 24

[R4-LoopBack1]quit

[R4]bgp 64513

[R4-bgp]network 10.1.4.4 24

[R4-bgp] says

In the global routing tables on R1 and R3, check whether the route exists.

Check the BGP routing table on R3 to analyze the next hop information of the route.

[R1]display ip routing-table

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

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

Routing Tables: Public

         Destinations : 18       Routes : 18       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.1/32 Direct  0    0           D   127.0.0.1       LoopBack0

       10.0.2.2/32 OSPF  10   1562        D   10.0.12.2       Serial1/0/0

       10.0.3.3/32 OSPF  10   3124        D   10.0.12.2       Serial1/0/0

       10.0.4.4/32 Static  60   0          RD   10.0.14.4       Serial3/0/0

      10.0.12.0/24 Direct  0    0           D   10.0.12.1       Serial1/0/0

      10.0.12.1/32 Direct  0    0           D   127.0.0.1       Serial1/0/0

      10.0.12.2/32 Direct  0    0           D   10.0.12.2       Serial1/0/0

    10.0.12.255/32 Direct  0    0           D   127.0.0.1       Serial1/0/0

      10.0.14.0/24 Direct  0    0           D   10.0.14.1       Serial3/0/0

      10.0.14.1/32 Direct  0    0           D   127.0.0.1       Serial3/0/0

      10.0.14.4/32 Direct  0    0           D   10.0.14.4       Serial3/0/0

    10.0.14.255/32 Direct  0    0           D   127.0.0.1       Serial3/0/0

      10.0.23.0/24 OSPF  10   3124        D   10.0.12.2       Serial1/0/0

       10.1.4.0/24 EBGP  255  0          RD   10.0.4.4        Serial3/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/3 Direct 0 0 D 127.0.0.1 InLoopBack0

You can see that the EBGP route of 10.1.4.0/24 has been learned on R1.

Check on R3 whether there is a route to network 10.1.4.0/24.

[R3]display ip routing-table

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

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

Routing Tables: Public

         Destinations : 16       Routes : 16       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.1/32 OSPF  10   3124        D   10.0.23.2       Serial2/0/0

       10.0.2.2/32 OSPF   0   1562        D   10.0.23.2       Serial2/0/0

       10.0.3.3/32 Direct  0    0           D   127.0.0.1       LoopBack0

      10.0.12.0/24 OSPF  10   3124        D   10.0.23.2       Serial2/0/0

      10.0.23.0/24 Direct  0    0           D   10.0.23.3       Serial2/0/0

      10.0.23.2/32 Direct  0    0           D   10.0.23.2       Serial2/0/0

      10.0.23.3/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

    10.0.23.255/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

      10.0.35.0/24 Direct  0    0           D   10.0.35.3       Serial3/0/0

      10.0.35.3/32 Direct  0    0           D   127.0.0.1       Serial3/0/0

      10.0.35.5/32 Direct  0    0           D   10.0.35.5       Serial3/0/0

    10.0.35.255/32 Direct  0    0           D   127.0.0.1       Serial3/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/3 Direct 0 0 D 127.0.0.1 InLoopBack0

There is no bgp route for 10.1.4.4 on R3.

Check the BGP table of R3.

[R3]display bgp routing-table

 BGP Local router ID is 10.0.3.3

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

 Total Number of Routes: 1

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

   i  10.1.4.0/24        10.0.4.4        0          100        0      64513i

It can be seen in the BGP routing table of R3, but this BGP route does not have an * mark, indicating that this route is not preferred. Because the NextHop of this route is 10.0.4.4, and there is no route to address 10.0.4.4 on R3. According to the BGP route selection principle, when the next hop of the BGP route is unreachable, the route is ignored.

Configure next-hop-local on R1 , and check the routing table on R3 again.

[R1]bgp 64512

[R1-bgp]peer 10.0.3.3  next-hop-local

[R1-bgp]peer 10.0.2.2  next-hop-local

[R1-bgp]quit

[R3]display bgp routing-table

 BGP Local router ID is 10.0.3.3

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

 Total Number of Routes: 1

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.4.0/24        10.0.1.1        0          100        0      64513i

It can be seen that the next hop of the BGP route 10.1.4.0/24 is 10.0.1.1, and there are signs * and > at the same time, indicating that this route is correct and optimal.

Check the routing table of R3.

[R3]display ip routing-table

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

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

Routing Tables: Public

         Destinations : 17       Routes : 17       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.1/32 OSPF    10   3124        D   10.0.23.2       Serial2/0/0

       10.0.2.2/32 OSPF    10   1562        D   10.0.23.2       Serial2/0/0

       10.0.3.3/32 Direct    0    0           D   127.0.0.1       LoopBack0

      10.0.12.0/24 OSPF  10   3124        D   10.0.23.2       Serial2/0/0

      10.0.23.0/24 Direct  0    0           D   10.0.23.3       Serial2/0/0

      10.0.23.2/32 Direct  0    0           D   10.0.23.2       Serial2/0/0

      10.0.23.3/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

    10.0.23.255/32 Direct  0    0           D   127.0.0.1       Serial2/0/0

      10.0.35.0/24 Direct  0    0           D   10.0.35.3       Serial3/0/0

      10.0.35.3/32 Direct  0    0           D   127.0.0.1       Serial3/0/0

      10.0.35.5/32 Direct  0    0           D   10.0.35.5       Serial3/0/0

    10.0.35.255/32 Direct  0    0           D   127.0.0.1       Serial3/0/0

       10.1.4.0/24 IBGP   255  0          RD   10.0.1.1        Serial2/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/3 Direct 0 0 D 127.0.0.1 InLoopBack0

The route 10.1.4.0/24 appears in the routing table.

Create Loopback1 on R5 with the address 10.1.5.5/24, advertise it into BGP, and configure next-hop-local on R3 .

[R5]interface LoopBack 1

[R5-LoopBack1]ip address 10.1.5.5 24

[R5-LoopBack1]quit

[R5]bgp 64514

[R5-bgp]network 10.1.5.0 24

[R3]bgp 64512

[R3-bgp]peer 10.0.1.1 next-hop-local

[R3-bgp]peer 10.0.2.2 next-hop-local

Check whether R4 has learned the route to the network connected to loopback 1 of R5. Analyze the output of display bgp routing-table .

[R4]display bgp routing-table

 BGP Local router ID is 10.0.4.4

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

 Total Number of Routes: 2

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.1.4.0/24        0.0.0.0         0                     0      i

 *>   10.1.5.0/24        10.0.1.1                              0      64512 64514i

Use ping with the source address on R5 to test the connectivity to the Loopback1 address of R4.

[R5]ping -c 1 -a  10.1.5.5 10.1.4.4

  PING 10.1.4.4: 56  data bytes, press CTRL_C to break

    Reply from 10.1.4.4: bytes=56 Sequence=1 ttl=252 time=125 ms

  --- 10.1.4.4 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

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

Additional Experiments : Think and Verify

Under what circumstances is it appropriate to use physical addresses to directly establish EBGP neighbor relationships?

Why is the default TTL value of packets sent to EBGP neighbors 1? What is the default value for running peer group_name  ebgp-max-hop  [ hop-count ] ?

final device configuration

[R1]display current-configuration

[V200R007C00SPC600]

#

 sysname R1

#

 router id 10.0.1.1

#

interface Serial1/0/0

 link-protocol ppp

 ip address 10.0.12.1 255.255.255.0

#

interface Serial3/0/0

 link-protocol ppp

 ip address 10.0.14.1 255.255.255.0

#

interface LoopBack0

 ip address 10.0.1.1 255.255.255.255

#

bgp 64512

 timer keepalive 30 hold 90

 peer 10.0.2.2 as-number 64512

 peer 10.0.2.2 connect-interface LoopBack0

 peer 10.0.3.3 as-number 64512

 peer 10.0.3.3 connect-interface LoopBack0

 peer 10.0.4.4 as-number 64513

 peer 10.0.4.4 ebgp-max-hop 2

 peer 10.0.4.4 connect-interface LoopBack0

 #

 ipv4-family unicast

  undo synchronization

  peer 10.0.2.2 enable

  peer 10.0.2.2 next-hop-local            

  peer 10.0.3.3 enable

  peer 10.0.3.3 next-hop-local

  peer 10.0.4.4 enable

#

ospf 1

 area 0.0.0.0

  network 10.0.12.0 0.0.0.255

  network 10.0.1.1 0.0.0.0

#

 ip route-static 10.0.4.4 255.255.255.255 10.0.14.4

return

[R2]display current-configuration

[V200R007C00SPC600]

#

 sysname R2

#

 router id 10.0.2.2

#

interface Serial1/0/0

 link-protocol ppp

 ip address 10.0.12.2 255.255.255.0

#

interface Serial2/0/0

 link-protocol ppp

 ip address 10.0.23.2 255.255.255.0

#

interface LoopBack0

 ip address 10.0.2.2 255.255.255.255

#

bgp 64512

 peer 10.0.1.1 as-number 64512

 peer 10.0.1.1 connect-interface LoopBack0

 peer 10.0.3.3 as-number 64512

 peer 10.0.3.3 connect-interface LoopBack0

 #

 ipv4-family unicast

  undo synchronization

  peer 10.0.1.1 enable

  peer 10.0.3.3 enable

#

ospf 1

 area 0.0.0.0

  network 10.0.12.0 0.0.0.255

  network 10.0.23.0 0.0.0.255

  network 10.0.2.2 0.0.0.0

return

[R3]display current-configuration

[V200R007C00SPC600]

#

 sysname R3

#

 router id 10.0.3.3

#

interface Serial2/0/0

 link-protocol ppp

 ip address 10.0.23.3 255.255.255.0

#

interface Serial3/0/0

 link-protocol ppp

 ip address 10.0.35.3 255.255.255.0

#

interface LoopBack0

 ip address 10.0.3.3 255.255.255.255

#

bgp 64512

 peer 10.0.1.1 as-number 64512

 peer 10.0.1.1 connect-interface LoopBack0

 peer 10.0.2.2 as-number 64512

 peer 10.0.2.2 connect-interface LoopBack0

 peer 10.0.35.5 as-number 64514

 #

 ipv4-family unicast

  undo synchronization

  peer 10.0.1.1 enable

  peer 10.0.1.1 next-hop-local

  peer 10.0.2.2 enable

  peer 10.0.2.2 next-hop-local            

  peer 10.0.35.5 enable

#

ospf 1

 area 0.0.0.0

  network 10.0.23.0 0.0.0.255

  network 10.0.3.3 0.0.0.0

return

[R4]display current-configuration

[V200R007C00SPC600]

#

 sysname R4

#

 router id 10.0.4.4

#

interface Serial1/0/0

 link-protocol ppp

 ip address 10.0.14.4 255.255.255.0

#

interface LoopBack0

 ip address 10.0.4.4 255.255.255.255

#

interface LoopBack1

 ip address 10.1.4.4 255.255.255.0

#

bgp 64513

 peer 10.0.1.1 as-number 64512

 peer 10.0.1.1 ebgp-max-hop 2

 peer 10.0.1.1 connect-interface LoopBack0

 #

 ipv4-family unicast

  undo synchronization

  network 10.0.4.0 255.255.255.0

  network 10.1.4.0 255.255.255.0

  peer 10.0.1.1 enable

#                                         

 ip route-static 10.0.1.1 255.255.255.255 10.0.14.1

return

[R5]display current-configuration

[V200R007C00SPC600]

#

 sysname R5

#

 router id 10.0.5.5

#

interface Serial1/0/0

 link-protocol ppp

 ip address 10.0.35.5 255.255.255.0

#

interface LoopBack0

 ip address 10.0.5.5 255.255.255.255

#

interface LoopBack1

 ip address 10.1.5.5 255.255.255.0

#

bgp 64514

 peer 10.0.35.3 as-number 64512

 #

 ipv4-family unicast

  undo synchronization

  network 10.1.5.0 255.255.255.0

  peer 10.0.35.3 enable

return

Guess you like

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