In BGP, Local Preference is used to control the outbound traffic path. It helps you decide which egress point (exit point) should be used when you have multiple connections to external networks, such as ISPs. Local Preference is an attribute that is local to your AS and is shared with all iBGP peers but not with eBGP neighbors.
- Higher Local Preference = More preferred outbound path.
Example Scenario:
You have two external links: ISP1 (via CE1) and ISP2 (via CE2). You want traffic to prefer ISP1 for all outbound traffic.
Network Topology:
- CE1 (connected to ISP1): 10.0.1.1/30
- CE2 (connected to ISP2): 10.0.2.1/30
- iBGP Router (Internal) connected to both CE1 (10.0.1.2/30) and CE2 (10.0.2.2/30).
Configuration on CE1 (Higher Local Preference):
Create a route map to set the local preference to 200 for routes learned from CE1:
route-map SET_LOCAL_PREF permit 10set local-preference 200
In the BGP configuration for CE1, apply this route map to the neighbor:
router bgp 65001neighbor 10.0.1.2 remote-as 65001 neighbor 10.0.1.2 route-map SET_LOCAL_PREF in
Configuration on CE2 (Default Local Preference):
CE2 will use the default local preference:
router bgp 65001 neighbor 10.0.2.2 remote-as 65001
Result:
Outbound traffic will prefer CE1 because it has a higher Local Preference value. This ensures that all traffic leaves your AS via ISP1.
Comments
Post a Comment