BGP cannot discover routes and needs to import routes such as IGP routes into BGP routing tables so that the imported routes can be transmitted within an AS or between ASs. BGP imports routes in either redistribute or network mode.
- Redistribute Mode
In redistribute mode, BGP imports IGP routes, including RIP, OSPF, and IS-IS routes, into BGP routing tables based on protocol type. To ensure the validity of imported IGP routes, BGP can also import static routes and direct routes in redistribute mode.
- Network Mode
In network mode, BGP imports the routes in the IP routing table one by one to BGP routing tables. The network mode is more accurate than the import mode.
Use the following command to configure BGP to statically add routes in the IP routing table to the BGP routing table and advertise these routes to peers.
set protocols bgp [vrf <vrf-name>] ipv4-unicast network <ipv4/prefixlen> [route-map<ROUTE-MAP-NAME>]
set protocols bgp [vrf<vrf-name>] ipv4-unicast network <ipv4/prefixlen> [label-index <label-index>]
The network mode command is used to import exactly-matching routes. This means that only the routes in the local IP routing table that exactly match the specified destination address and prefix length can be added to the BGP routing table.