BGP - network vs redistribute commands

When implementing BGP, there are two fundamental ways in which a prefix can be advertised. It can be done using the network command, or using redistribution.

The network command in BGP is used to advertise networks that are already present in the routing table. It’s a good practice to use this command when you want to have granular control over which routes are being advertised. This method requires more configuration as you would need to manually specify each network that you wish to advertise.

In order for such a prefix to be advertised, the prefix and the subnet mask in the routing table entry must match exactly.

On the other hand, the redistribute command is used to take routes from other routing protocols and inject them into BGP. This is a more automated way of advertising routes, as it doesn’t require manual configuration for each network. Although the redistribute command requires that the redistributed prefixes be in the routing table, it doesn’t require an exact match as the network command does. However, it can potentially lead to the advertisement of unwanted routes if not properly controlled, which may cause routing loops or other issues.