4.2 - BGP - Config - Basico - Hedex
4.2 - BGP - Config - Basico - Hedex
Networking Requirements
If multiple ASs want to access each other, these ASs must exchange their local routes. If
multiple routers exist in the ASs, a great deal of routing information will be exchanged
between ASs, which consumes lots of bandwidth resources. To address this issue, you can
configure basic BGP functions.
In Figure 1, Device A is in AS 65008. Device B, Device C, and Device D are in AS 65009. The
routing tables of these routers store many routes, and the routes change frequently. After
BGP is enabled on the routers, they can exchange routing information. If routes of one
router changes, the router sends Update messages carrying only changed routing
information to its peers, which greatly reduces bandwidth consumption.
Interfaces 1 through 3 in this example are GE 0/1/0, GE 0/2/0, and GE 0/3/0, respectively.
GE 0/1/0 172.16.0.1/16
GE 0/2/0 192.168.0.1/24
GE 0/1/0 10.1.1.1/24
1 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
GE 0/2/0 192.168.0.2/24
GE 0/3/0 10.1.3.1/24
GE 0/2/0 10.1.2.1/24
GE 0/3/0 10.1.3.2/24
GE 0/1/0 10.1.1.2/24
GE 0/2/0 10.1.2.2/24
Precautions
When configuring basic BGP functions, note the following rules:
If there is no directly connected physical link between EBGP peers, run the peer ebgp-
max-hop command to allow EBGP peers to establish TCP connections through multiple
hops.
Configuration Roadmap
The configuration roadmap is as follows:
3. Advertise routes using the network command on Device A, and then check the
routing tables of Device A, Device B, and Device C.
4. Configure BGP on Device B to import direct routes, and then check the routing tables
of Device A and Device C.
Data Preparation
To complete the configuration, you need the following data:
2 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
Procedure
1. Configure an IP address for each interface. For configuration details, see Configuration
Files in this section.
2. Configure OSPF.
# Configure Device B.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
# Configure Device C.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
# Configure Device D.
[~DeviceD] ospf 1
[*DeviceD-ospf-1] area 0
[*DeviceD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] network 4.4.4.4 0.0.0.0
[*DeviceD-ospf-1-area-0.0.0.0] commit
[~DeviceD-ospf-1-area-0.0.0.0] quit
[~DeviceD-ospf-1] quit
3 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
[~DeviceB-bgp] quit
# Configure Device C.
# Configure Device D.
# Configure Device B.
4 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
The command output shows that Device B has established BGP connections with other
routers and that the connection status is Established.
5 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
The command output shows that Device C has learned the route to 172.16.0.0
from AS 65008. However, this route is invalid because the next hop 192.168.0.1
is unreachable.
6 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
The command output shows that the route to 172.16.0.0 becomes valid and that the
next hop is the address of Device A.
# Verify the configuration using the ping command.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.0.1 255.255.0.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.0.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
7 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
#
bgp 65008
router-id 1.1.1.1
peer 192.168.0.2 as-number 65009
#
ipv4-family unicast
undo synchronization
network 172.16.0.0 255.255.0.0
peer 192.168.0.2 enable
#
return
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 65009
router-id 2.2.2.2
peer 3.3.3.3 as-number 65009
peer 3.3.3.3 connect-interface LoopBack0
peer 4.4.4.4 as-number 65009
peer 4.4.4.4 connect-interface LoopBack0
peer 192.168.0.1 as-number 65008
#
ipv4-family unicast
undo synchronization
import-route direct
peer 3.3.3.3 enable
peer 4.4.4.4 enable
peer 192.168.0.1 enable
8 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.3.0 0.0.0.255
#
return
#
sysname DeviceC
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
bgp 65009
router-id 3.3.3.3
peer 2.2.2.2. as-number 65009
peer 2.2.2.2 connect-interface LoopBack0
peer 4.4.4.4 as-number 65009
peer 4.4.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 4.4.4.4 enable
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.2.0 0.0.0.255
network 10.1.3.0 0.0.0.255
#
return
9 of 10 13/03/2022 16:29
Example for Configuring Basic BGP Functions http://127.0.0.1:52199/hedex/pages/AEJ12145/04/AEJ12145/04/resour...
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.2 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
bgp 65009
router-id 4.4.4.4
peer 2.2.2.2 as-number 65009
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 65009
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 3.3.3.3 enable
#
ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
#
return
10 of 10 13/03/2022 16:29