redistribute connected
Injects directly connected interface subnets into BGP for advertisement to peers.
Definition: redistribute connected is a Cisco IOS router config command. Redistributes directly connected routes into the BGP routing table. Useful for advertising interface subnets into BGP without the need to create a static route to Null0 for each prefix.
redistribute connected [route-map <map-name>]When to Use This Command
- Advertising all connected subnets into BGP for internet reachability.
- Quick alternative to configuring individual 'network' statements.
- Used with a route-map to filter which connected routes are redistributed.
- Useful in lab environments to quickly inject test prefixes into BGP.
Command Examples
Redistribute all connected routes into BGP
R1(config)# router bgp 65001
R1(config-router)# redistribute connectedR1(config-router)#
All directly connected interface subnets are injected into BGP. Use with caution in production — this will advertise ALL connected subnets including management interfaces.
Filter redistribution with a route-map
R1(config)# ip prefix-list ADVERTISE seq 5 permit 198.51.100.0/24
R1(config)# route-map CONNECTED-TO-BGP permit 10
R1(config-route-map)# match ip address prefix-list ADVERTISE
R1(config)# router bgp 65001
R1(config-router)# redistribute connected route-map CONNECTED-TO-BGPR1(config-router)#
Only 198.51.100.0/24 is redistributed into BGP. The route-map filters out other connected subnets like loopbacks or management interfaces.
Understanding the Output
No direct output. Verify with 'show ip bgp' — redistributed routes appear with origin 'incomplete' (shown as '?') instead of 'IGP' ('i'). The '?' origin indicates the route came from redistribution, not a BGP 'network' statement.
Peers receive and install the routes normally regardless of origin.
CCNA Exam Tips
CCNA exam tip: Routes redistributed into BGP show origin code '?' (incomplete). Routes added via 'network' show 'i' (IGP). The origin code affects BGP path selection.
CCNA exam tip: Without a route-map filter, 'redistribute connected' advertises EVERYTHING including loopbacks — often undesirable.
CCNA exam tip: 'redistribute connected' and 'network' can both be used simultaneously — they are not mutually exclusive.
CCNA exam tip: The 'network' statement requires an exact match in the routing table; 'redistribute connected' is less precise but easier to configure.
Common Mistakes
Mistake 1: Using 'redistribute connected' without a route-map — advertises unintended subnets to peers.
Mistake 2: Confusing origin codes — redistribution produces '?' (incomplete), not 'i' (IGP) from network statement.
Mistake 3: Expecting redistributed routes to show up immediately — BGP may take up to the advertisement interval (30s eBGP) to send updates.
redistribute connected vs router bgp [asn]
Both commands are integral to BGP configuration on Cisco IOS, but they operate at different stages: 'router bgp [asn]' enters BGP configuration mode, while 'redistribute connected' is a subcommand used within that mode to inject directly connected routes. They are often discussed together because redistribution is a common BGP task, but they serve distinct purposes.
| Aspect | redistribute connected | router bgp [asn] |
|---|---|---|
| Scope | Within BGP configuration | Global configuration, then enters BGP config |
| Configuration mode | Router configuration (config-router) | Global configuration (config) |
| Function | Redistributes connected routes into BGP | Creates/enters BGP process for an AS |
| Dependencies | Requires active BGP process | No prior BGP configuration needed |
| Effect | Adds connected prefixes to BGP table | Starts BGP routing process and config context |
| Typical use | Advertise directly connected interfaces | Begin BGP configuration |
Use 'redistribute connected' when you need to advertise the subnets of directly connected interfaces into the BGP routing table without static null routes.
Use 'router bgp [asn]' when you are starting a new BGP configuration or need to enter BGP router configuration mode to modify BGP settings.
Related Commands
network [network] mask [mask]
Advertises a network into BGP. The specified network must exist in the local routing table (via static route, connected, or IGP) for BGP to originate and advertise it.
router bgp [asn]
Enters BGP router configuration mode and creates a BGP process with the specified autonomous system (AS) number. This is the first command required to configure BGP on a Cisco router.
show ip bgp
Displays the BGP routing table, showing learned BGP routes and their attributes, used for troubleshooting BGP path selection and verifying route advertisement.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions