Networking · Topic 4 of 8
Implementing BGP for IPv4 and IPv6
Configure iBGP and eBGP for IPv4 and IPv6 with address families, attributes, redistribution, additional paths and PIC, with XR and XE differences.
- 6 min
- Includes a diagram
- The remote AS decides whether a session is iBGP or eBGP.
- iBGP does not re-advertise routes to other iBGP peers, so use a full mesh or route reflectors.
- eBGP changes the next hop. iBGP leaves it unchanged unless
next-hop-selfis set.
What it is
BGP is the routing protocol that joins autonomous systems and carries customer and internet routes.
eBGP runs between different autonomous systems. iBGP runs inside one AS to spread the routes that eBGP learned. Modern BGP carries many kinds of routes, such as IPv4, IPv6 and VPN routes, by using address families.
How it works
A BGP session is built from a TCP connection, and each address family is then activated on it.
Neighbours
The neighbour address and the remote AS number define the session. If the remote AS equals the local AS, the session is iBGP. Otherwise it is eBGP.
Some rules differ by session type:
- eBGP expects the neighbour to be directly connected, unless you allow more hops with
ebgp-multihop. - iBGP sessions normally use loopback addresses, with
update-sourceset to the loopback. - iBGP does not pass a route learned from one iBGP peer to another. You need a full mesh or route reflectors.
- eBGP changes the next hop to itself. iBGP keeps it, so you often set
next-hop-selfon the edge routers.
Configuration on IOS XR
IOS XR is strict about policy. By default, an eBGP neighbour accepts and sends no routes until a route policy is applied in each direction.
RP/0/RP0/CPU0:PE1(config)# route-policy PASS
RP/0/RP0/CPU0:PE1(config-rpl)# pass
RP/0/RP0/CPU0:PE1(config-rpl)# end-policy
RP/0/RP0/CPU0:PE1(config)# router bgp 65000
RP/0/RP0/CPU0:PE1(config-bgp)# bgp router-id 1.1.1.1
RP/0/RP0/CPU0:PE1(config-bgp)# address-family ipv4 unicast
RP/0/RP0/CPU0:PE1(config-bgp-af)# network 10.0.0.0/24
RP/0/RP0/CPU0:PE1(config-bgp-af)# exit
RP/0/RP0/CPU0:PE1(config-bgp)# neighbor 192.0.2.2
RP/0/RP0/CPU0:PE1(config-bgp-nbr)# remote-as 65001
RP/0/RP0/CPU0:PE1(config-bgp-nbr)# address-family ipv4 unicast
RP/0/RP0/CPU0:PE1(config-bgp-nbr-af)# route-policy PASS in
RP/0/RP0/CPU0:PE1(config-bgp-nbr-af)# route-policy PASS out
RP/0/RP0/CPU0:PE1(config-bgp-nbr-af)# commit
Configuration on IOS XE
On IOS XE, a neighbour needs activate in each address family. IPv4 unicast is activated automatically unless no bgp default ipv4-unicast is set, and policy is optional.
R1(config)# router bgp 65000
R1(config-router)# neighbor 192.0.2.2 remote-as 65001
R1(config-router)# neighbor 2001:DB8:1::2 remote-as 65001
R1(config-router)# address-family ipv4
R1(config-router-af)# network 10.0.0.0 mask 255.255.255.0
R1(config-router-af)# neighbor 192.0.2.2 activate
R1(config-router-af)# exit-address-family
R1(config-router)# address-family ipv6
R1(config-router-af)# network 2001:DB8:A::/48
R1(config-router-af)# neighbor 2001:DB8:1::2 activate
Address families
Each address family has its own neighbour settings and its own table. IPv4 unicast, IPv6 unicast and VPNv4 are common ones. An IPv6 prefix can be exchanged over an IPv4 session, or the reverse, if both families are activated.
Prefix advertisement and redistribution
A network statement advertises a prefix only if an exact match exists in the routing table. aggregate-address advertises a summary. redistribute brings in routes from other protocols or from connected and static routes.
By default, iBGP learned routes are not redistributed into an IGP. Doing so is possible with a setting, but use it with care, because it can cause loops.
Attributes
| Class | Examples | Passed on |
|---|---|---|
| Well known mandatory | Origin, AS path, next hop | Always present |
| Well known discretionary | Local preference | Present when needed |
| Optional transitive | Community, aggregator | Passed on between ASes |
| Optional non transitive | MED, originator ID, cluster list | Not passed to a third AS |
Path selection uses these attributes, in the order described on the previous page.
Additional paths
Normally a router advertises only its best path. With additional paths, a router can send several paths for one prefix, each with a path identifier, so that peers can see the alternatives.
RP/0/RP0/CPU0:RR1(config-bgp-af)# additional-paths send
RP/0/RP0/CPU0:RR1(config-bgp-af)# additional-paths receive
RP/0/RP0/CPU0:RR1(config-bgp-af)# additional-paths selection route-policy ADD_PATH
That is IOS XR, and the route policy chooses which extra paths to send.
PIC
Prefix independent convergence (PIC) prepares a backup path before a failure. The forwarding table stores the primary and backup together, so a failure is repaired with one change, however many prefixes depend on it.
PIC Edge protects against the loss of an edge router or link. PIC Core protects against the loss of a core link on the way to the next hop. PIC Edge needs the backup path to be known in BGP, which additional paths can supply.
RP/0/RP0/CPU0:PE1# show bgp ipv4 unicast summary
RP/0/RP0/CPU0:PE1# show bgp neighbors 192.0.2.2
What to remember for the exam
Eight facts cover most questions on this topic.
- The remote AS decides whether a session is iBGP or eBGP.
- iBGP does not re-advertise routes to other iBGP peers, so use a full mesh or route reflectors.
- eBGP changes the next hop. iBGP leaves it unchanged unless
next-hop-selfis set. - IOS XR eBGP needs a route policy in each direction by default, or no routes pass.
- IOS XE needs
neighbor ... activatein each address family, except the automatic IPv4 unicast. - A
networkstatement needs an exact match in the routing table. - Additional paths advertise more than the best path.
- PIC pre computes a backup path so repair time does not depend on prefix count.
When an IOS XR eBGP session is up but no routes arrive, look for a missing route policy first.
Common mistakes
These four mistakes appear often.
Forgetting activate on IOS XE. For IPv6 and other families, the session comes up but no prefixes for that family are exchanged.
Using interface addresses for iBGP. A loopback keeps the session alive when one link fails.
Leaving the next hop unreachable. iBGP keeps the external next hop, so the IGP must carry it or next-hop-self must be set.
Writing a network statement with the wrong mask. The prefix is not advertised unless the route exists exactly.
Additional paths and PIC address different goals. One spreads alternatives, and the other repairs forwarding quickly.
Check yourself
Work through these three questions.
Why might an up IOS XR eBGP session receive nothing?
No route policy is applied in the inbound direction, so no routes pass.
Why set
next-hop-selfon an iBGP edge router?iBGP keeps the external next hop, and internal routers may not be able to reach it.
What does PIC give you?
A pre computed backup path, so repair time does not depend on how many prefixes use it.
Topic 4 of 8 in Networking
Test yourself on Networking
The full Cisco CCNP 350-501 SPCOR question bank has 738 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.