[Network Engineer Configuration]-BGP routing basic configuration (eNSP)

1. Introduction to BGP routing function

   1. BGP (Border Gateway Protocol) is an exterior gateway protocol (Exterior Gateway Protocol, EGP) that communicates between routing devices of different autonomous systems. Its main function is to communicate between different autonomous systems (Autonomous Systems, AS). Exchange network reachability information, and eliminate routing loops through the protocol's own mechanism. BGP uses the TCP protocol as the transmission protocol, and guarantees the reliability of BGP transmission through the reliable transmission mechanism of the TCP protocol. Routers running the BGP protocol are called BGP Speakers, and BGP Speakers that have established a BGP session connection (BGP Session) are called peers (BGP Peers).

   2. There are two modes for establishing peers between BGP speakers: IBGP (Internal BGP) and EBGP (External BGP). IBGP refers to BGP connections established within the same AS, and EBGP refers to BGP connections established between different ASs. In short, the functions of the two are: EBGP is to complete the exchange of routing information between different ASs, and IBGP is to complete the transmission of routing information within the AS.


2. BGP application scenarios:

The BGP network is set up to realize the communication between different ASs in the network. Configuring the basic function of BGP is the most basic configuration process for building a BGP network, which mainly includes three parts:

1. Create a BGP process: Only when you create a BGP process, can you begin to configure all the features of BGP.

2. Establish a BGP peer relationship: Only when the BGP peer relationship is successfully established, can devices exchange BGP messages.

3. Import routes: The BGP protocol itself does not discover routes. Only routes imported from other protocols can generate BGP routes.


3. Experimental configuration:

  1. Topological diagram

   Note: By default, BGP will automatically select the Router ID in the system view as the Router ID of the BGP protocol. If the selected Router ID is the IP address of a physical interface, when the IP address changes, it will cause routing oscillations. To improve the stability of the network, you can manually configure the Router ID as the Loopback interface address.


5be5d7deb544fdf26094850fcae49331.webp


  2. Experimental purpose:

    To make the AS100 network (R1: 1.1.1.1) and AS200 (R4: 4.4.4.4) network reachable. BGP protocol needs to be run between all routers, EBGP connection is established between R1 and R2, R3, and IBGP full connection is established between R2, R3 and R4. In AS200, the IGP protocol is used to calculate the route (OSPF is used as the IGP protocol in this example).

  3. Configuration ideas:

     1) Set up the topology map environment and mark the planned IP address

     2) Modify the default name of the network device and configure the IP address

     3) Configure basic OSPF (do IBGP in AR2, AR3, AR4)

     4) Configure EBGP

  4. Configuration process:

Step 1: Modify the default name of the network device and configure the IP address

 1) Configure each PC information (omitted)

 2) Configure router AR1 default name and interface IP

<Huawei>sys //Enter the system view mode

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

[Huawei]sysname AR1 //Modify the device name

[AR1]int g0/0/0 //Enter the interface

[AR1-GigabitEthernet0/0/0]ip add 192.168.12.1 24 //Assign IP to the interface

[AR1-GigabitEthernet0/0/0]int g0/0/1

[AR1-GigabitEthernet0/0/1]ip add 192.168.13.1 24

[AR1-GigabitEthernet0/0/1]int loopback 0

[AR1-LoopBack0]ip add 192.168.1.1 32

2) Configure router AR2 default name and interface IP

<Huawei>sys

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

[Huawei]sysname AR2

[AR2]int g0/0/0

[AR2-GigabitEthernet0/0/0]ip add 192.168.12.2 24

[AR2-GigabitEthernet0/0/0]int g0/0/1

[AR2-GigabitEthernet0/0/1]ip add 192.168.24.2 24

[AR2-GigabitEthernet0/0/1]int loopback 0

[AR2-LoopBack0]ip add 192.168.2.2 32

3) Configure router AR3 default name and interface IP

<Huawei>sys

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

[Huawei]sysname AR3

[AR3]int g0/0/0

[AR3-GigabitEthernet0/0/0]ip add 192.168.13.3 24

[AR3-GigabitEthernet0/0/0]int g0/0/1

[AR3-GigabitEthernet0/0/1]ip add 192.168.34.3 24

[AR3-GigabitEthernet0/0/1]int loopback 0

[AR3-LoopBack0]ip add 192.168.3.3 32

4) Configure router AR4 default name and interface IP

<Huawei>sys

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

[Huawei]sysname AR4

[AR4]int g0/0/0

[AR4-GigabitEthernet0/0/0]ip add 192.168.34.4 24

[AR4-GigabitEthernet0/0/0]int g0/0/1

[AR4-GigabitEthernet0/0/1]ip add 192.168.24.4 24

[AR4-GigabitEthernet0/0/1]int loopback 0

[AR4-LoopBack0]ip add 192.168.4.4 32

Step 2: Configure basic OSPF (do IBGP in AR2, AR3, AR4):

[if !supportLists]1) [endif]R2

[AR2]ospf router-id 2.2.2.2 //Enable OSPF and configure router-id

[AR2-ospf-1]area 0 //Configure area

[AR2-ospf-1-area-0.0.0.0]network 192.168.24.0 0.0.0.255 //Release the network segment within the AS

[AR2-ospf-1-area-0.0.0.0]network 192.168.2.2 0.0.0.0

[if !supportLists]2) [endif]R3

[AR3]ospf router-id 3.3.3.3

[AR3-ospf-1]area 0

[AR3-ospf-1-area-0.0.0.0]network 192.168.34.0 0.0.0.255

[AR3-ospf-1-area-0.0.0.0]network 192.168.3.3 0.0.0.0

3)R4

[AR4]ospf router-id 4.4.4.4

[AR4-ospf-1]area 0

[AR4-ospf-1-area-0.0.0.0]network 192.168.24.0 0.0.0.255

[AR4-ospf-1-area-0.0.0.0]network 192.168.34.0 0.0.0.255

[AR4-ospf-1-area-0.0.0.0]network 192.168.4.4 0.0.0.0

 4) Configuration verification. After configuring IBGP, the network segments in the same AS can communicate with each other, but the network segments of different ASs cannot communicate with each other.

6416b719c480ca5f8133e5e8e3c095ae.webp

Step three, configure EBGP

[if !supportLists]1) [endif]R1:

[AR1]bgp 100

[AR1-bgp]router-id 1.1.1.1

[AR1-bgp]peer 192.168.12.2 as-number 200

[AR1-bgp]peer 192.168.13.3 as-number 200

[AR1-bgp]network 192.168.1.1 32

[if !supportLists]2) [endif]R2:

[AR2]bgp 200 //Create bgp number 200 (AS200)

[AR2-bgp]router-id 2.2.2.2   //指定router-id

[AR2-bgp]peer 192.168.12.1 as-number 100 //Establish an adjacency with neighboring networks

[AR2-bgp]peer 192.168.24.4 as-number 200 //Establish an adjacency with neighboring networks

[AR2-bgp]peer 192.168.24.4 next-hop-local //When sending a BGP route to the neighbor of 192.168.24.4, set the next hop of the route to its own address, which is to establish a neighbor with 192.168.24.4 Source address used

4b348e1d828c6cf3c3d017f25c8a7774.webp

The message indicates that the BGP neighbor is successfully established

[if !supportLists]3) [endif]R3:

[AR3]bgp 200

[AR3-bgp]router-id 3.3.3.3

[AR3-bgp]peer 192.168.13.1 as-number 100

[AR3-bgp]peer 192.168.34.4 as-number 200

[AR3-bgp]peer 192.168.34.4 next-hop-local


4)R4:

[AR4]bgp 200

[AR4-bgp]router-id 4.4.4.4

[AR4-bgp]peer 192.168.24.2 as-number 200

[AR4-bgp]peer 192.168.34.3 as-number 200

[AR4-bgp]network 192.168.4.4 32

5c7d9b50b3c782680f4a5c4cc8876256.webp

Join the exchange group 696283186 for more detailed experimental configurations

After configuring EBGP, we found that after routing is controlled by BGP, the packets from AR4 to AR1 follow the path AR2


Four, configuration verification:

1) View the connectivity between different ASs:


b7d2ca521f7289cfa20181063ef8443e.webp

Through the results of the Ping command, we found that after configuring EBGP, the same AS and different AS can communicate with each other

2) View the routing table in AR1:


eac6bf0e6019c0ca1b44e91ac4a0e861.webp

It can be found in the routing table that the EBGP destination address is 192.168.4.4, and the next hop is 192.168.12.2, indicating that the communication between 192.168.1.1 and 192.168.4.4 is the router AR2 that passes through.

3) View the capture information:

a6f8ca689e5b7bf81c5f56dadda80dfb.webp

Enable packet capture on the interface connecting AR1 and AR2, and you can capture the TCMP packets communicating between AR4 and AR1. At the same time, we found that the BGP transport protocol is TCP, and the port number is 179.


d9d14633418fab9fc2ca564e6025745f.webp

   Enable packet capture on the interface connecting AR1 and AR3 and find that there is no communication information between AR4 and AR1. This means that after routing through BGP, data from AR4 to AR1 will be sent through AR2.

     At this point, the BGP experiment is complete. As we mentioned in the experiment, BGP automatically completes route selection, so how to manually control route selection? Join the exchange group 696283186 for more detailed experimental configurations

Summary: BGP has the following characteristics:

1) Transmission protocol: TCP, port number 179;

2) BGP is an external routing protocol used to transfer routing information between ASs;

3) It is an enhanced path vector routing protocol;

4) Have a reliable routing update mechanism;

5) Possess rich Metric measurement methods;

6) No loop protocol design;

7) Attach multiple attribute information to routing entries;

8) Support CIDR (no-category inter-domain routing);

9) Rich routing filtering and routing strategies;

10) No need to update periodically;

11) Only the incremental route is sent when the route is updated;

12) Send KeepAlive messages periodically to maintain TCP connectivity;


Guess you like

Origin blog.51cto.com/15039035/2576622