As with IGP routes, all known static
routes can be injected into BGP using the redistribute
command, or a subset of static routes can be injected using the BGP network
command. Again, the network command
provides greater control, while increasing the administrative burden.
The figure demonstrates how routing information can
be injected dynamically into BGP.
You can configure RTB in the figure to redistribute OSPF-learned routes
into BGP dynamically:
RTB(config)#router bgp 200
RTB(config-router)#neighbor 10.1.1.2 remote-as 100
RTB(config-router)#neighbor 10.1.1.2 route-map BLOCK-BAD-ADDRESSES out
RTB(config-router)#redistribute ospf 1 match internal metric 50
RTB(config-router)#redistribute static
For insurance, you can configure a route map that
matches any private addresses that you do not want advertised outside the
AS. The route map, appropriately called BLOCK-BAD-ADDRESSES, is applied to
outbound BGP updates. Also, BGP has been configured to redistribute only
internal OSPF routes and assign them a metric of 50. The redistribute
static command will dynamically populate BGP
with any static routes that RTB happens to be configured with.
Alternatively, you can configure RTB to inject
internal routes semidynamically, by using the BGP network
command:
RTB(config)#router bgp 200
RTB(config-router)#neighbor 10.1.1.2 remote-as 100
RTB(config-router)#neighbor 10.1.1.2 route-map BLOCK-BAD-ADDRESSES out
RTB(config-router)#network 192.168.1.0
RTB(config-router)#network 192.168.2.0
If you configure RTB accordingly, it will not inject
all the internal routes into BGP. Only the two networks specified,
192.168.1.0 and 192.168.2.0, will be injected (although you could have
configured them all the same way). In a sense, the BGP network
command redistributes the specified IGP
route into BGP, allowing for precise control.