How to configure BGP to import routes for S series switches

2

Background
BGP itself cannot discover routes. Therefore, it needs to import other protocol routes, such as IGP routes, to the BGP routing table. In this manner, these imported routes can be transmitted within an AS or between ASs. BGP imports routes in either of the following ways:

In import mode, BGP imports routes according to protocol types, such as RIP routes, OSPF routes, and IS-IS routes. To ensure validity of imported IGP routes, BGP can also import static routes and direct routes in import mode.

In network mode, BGP imports routes in an IP routing table one by one, making it more precise than the import mode.

Procedure
Import mode:
[HUAWEI] bgp 100
[HUAWEI-bgp] ipv4-family unicast //The IPv4 address family view is displayed. You can also enter other views as required.
[HUAWEI-bgp-af-ipv4] import-rout static //Importing static routes is taken as an example. Importing routes of other protocols is similar.
(Optional) Run the default-route import command to allow BGP to import the default route that already exists in the local IP routing table.
By default, BGP does not add default routes to the BGP routing table.

Network mode:
[HUAWEI] bgp 100
[HUAWEI-bgp] ipv4-family unicast //The IPv4 address family view is displayed. You can also enter other views as required.
[HUAWEI-bgp-af-ipv4] network 192.168.100.0 24 //Advertise routes to network segment 192.168.100.0 24.

Precaution
The network command is used to advertise exactly matched routes. That is, the routes whose destination addresses and prefix lengths exactly match the entries in the local routing table. If the network mask is not specified, routes are exactly matched according to the natural network segment.
When using the undo network command to clear the existing configuration, you need to specify the correct mask.

Other related questions:
Why cannot OSPF on S series switches import BGP routes
Question: Why cannot OSPF import BGP routes? Answer: As defined in RFC 1364, routes learned via IBGP must not be imported into OSPF. That is, OSPF cannot import IBGP routes. PEs can import IBGP routes. Most VPNv4 routing tables contain BGP routes, but the routes cannot be imported into OSPF processes. This is because the vpn-instance-capability simple command is configured in the OSPF processes. After the command is configured, the PE role is disabled on a device and the device acts as an MCE. To enable the PE role on a device, run the undo vpn-instance-capability command.

On S series switches, how long does it take for BGP routes to expire after the static routes imported by BGP expire
If the static routes imported by an S series switch become invalid, the routes imported in the BGP routing table will be invalidated. The route imported through the network command must be active in the local routing table. Otherwise, it cannot be imported in the BGP routing table.

Routes imported into IS-IS are invalid on S series switches
Q: Why are routes imported into IS-IS invalid? A: For S series switches supporting IS-IS, if the IS-IS level is not set when routes are imported into IS-IS, level-2 IS-IS is used by default. That is, routes are imported into level-2 IS-IS. To import routes to areas of other levels, specify the area level.

Why cannot OSPF import BGP routes
As defined in RFC 1364, OSPF cannot import IBGP routes. Routes learned via IBGP must not be imported into OSPF OSPF, however, can import IBGP routes on a PE. BGP routes exist in a VPNv4 routing table on a device functioning as a PE but cannot be imported to OSPF. This is because the role of the device changes from a PE to an MCE after the vpn-instance-capability simple command in run in the OSPF process. Solution: If the device needs to function as a PE, you need to run the undo vpn-instance-capability command on the device.

If you have more questions, you can seek help from following ways:
To iKnow To Live Chat
Scroll to top