BGP无谷路由咨询:何时优先最短路径而非本地优先级及AS网络图作业求解
Hey there! Let's work through your BGP valley-free routing FIB table assignment step by step—since you’ve shared details about customer/provider relationships and red Local Preference (LP) values in your topology, I’ll tie those directly into the core logic you need.
Critical Background to Anchor Your Work
Before diving into building the FIB, let’s recap the non-negotiable rules that apply here, tailored to your topology’s specifics:
- Valley-Free Routing Priority: This is the golden rule for your assignment. When choosing BGP paths, an AS will always prioritize routes in this order:
- Routes from a customer AS (highest priority—you earn money carrying customer traffic, so these get top billing)
- Routes from a peer AS
- Routes from a provider AS (lowest priority—you pay providers for transit, so you only use these if no other options exist)
- Local Preference (LP): This is an AS-internal attribute. Higher LP values mean a route is more preferred. Important note: LP only propagates within the same AS (via iBGP), so all routers in your AS will see the same LP values for shared routes.
Step-by-Step FIB Building Process
Let’s break this down into actionable steps, using your Router 1/Router 2 example to illustrate:
1. Inventory All Routes for Each Router
For every router, list every BGP route it receives from neighbors. For each route, jot down:
- Neighbor type (customer/peer/provider)
- Incoming Local Preference value
- Full AS path (e.g.,
AS1 -> AS2 -> AS3)
2. Apply Valley-Free Priority First (Non-Negotiable)
Filter routes by neighbor type before even looking at LP values. Discard provider routes if you have customer/peer routes; discard peer routes if you have customer routes.
Example: If Router 2 has two routes to a destination—one from its customer Router 1 (LP=300) and one from its provider Router 3 (LP=400)—you still pick the customer route. Valley-free rules beat LP every time here.
3. Use LP to Break Ties (Same Neighbor Type Only)
If you have multiple routes from the same neighbor type (e.g., two customer routes), pick the one with the higher LP value.
Example: If Router 1 has two customer routes to a destination—one with LP=100 and another with LP=200—you select the route with LP=200.
4. Lock in the FIB Entry
Once you’ve selected the best path, the FIB entry for that destination will point to the next-hop router of the winning path, along with any necessary forwarding details.
Quick Example Walkthrough
Let’s build the FIB for Router 2 targeting a destination in AS4:
- Router 2 gets a route from customer Router 1: LP=300, AS path
AS1 -> AS4 - Router 2 gets a route from provider Router 5: LP=400, AS path
AS5 -> AS4 - First pass: Valley-free rule kicks in—customer route wins, even with lower LP.
- Final FIB entry for AS4 on Router 2: Next-hop = Router 1.
Pro Tips to Avoid Common Mistakes
- Don’t fixate on LP first: Valley-free neighbor type priority is the first filter. It’s easy to get distracted by the numbers, but customer/provider relationships come first.
- LP stays internal: Never carry LP values between different ASes—this attribute only matters within your own AS’s iBGP network.
- iBGP consistency: All routers in the same AS should share LP values for routes, so they’ll all agree on the best path (unless other tiebreakers like AS path length come into play).
内容的提问来源于stack exchange,提问作者user4493284

