BGP Explained: From Basics to Loopback Peering
๐ Table of Contents
- What is BGP
- BGP Using Physical Interfaces
- Loopback + Update Source
- Comparison
- CLI Configurations
- Math Behind Routing Decisions
- Key Takeaways
- Related Articles
๐ What is BGP?
Border Gateway Protocol (BGP) is the backbone routing protocol of the internet. It allows different Autonomous Systems (AS) to exchange routing information.
BGP is called a path-vector protocol because it tracks the full path (AS numbers) to reach a destination.
How BGP Works
- Routers form TCP sessions (port 179)
- Exchange routing tables
- Apply policies to select best routes
๐ BGP Using Physical Interfaces
In the simplest setup, routers peer using directly connected interfaces.
Example Scenario
- Router1 (AS 65500): 192.168.55.6
- Router2 (AS 65501): 192.168.55.5
Configuration Example
router bgp 65500 neighbor 192.168.55.5 remote-as 65501
Advantages
- Simple configuration
- No additional routing required
- Works out of the box
Limitations
- Fails if interface goes down
- No redundancy
- Hard to scale
๐ Loopback + Update-Source
Instead of using physical interfaces, BGP can use loopback interfaces for peering.
Why Loopback?
- Always up
- Stable peering
- Topology independent
⚠️ Common Mistakes in BGP
- ❌ Forgetting update-source
- ❌ No route to loopback IP
- ❌ Missing ebgp-multihop
- ❌ Wrong AS number
- ❌ Firewall blocking TCP 179
interface Loopback0 ip address 1.1.1.1 255.255.255.255 router bgp 65500 neighbor 2.2.2.2 remote-as 65501 neighbor 2.2.2.2 update-source Loopback0
Important Requirements
- Loopback must be reachable
- Use IGP or static routes
- Enable multihop if needed
router bgp 65500 neighbor 2.2.2.2 ebgp-multihop 2
⚖️ Physical vs Loopback
| Feature | Physical | Loopback |
|---|---|---|
| Stability | Low | High |
| Scalability | Limited | Excellent |
| Complexity | Simple | Moderate |
๐ป CLI Output Samples
BGP router identifier 1.1.1.1 Neighbor AS MsgRcvd MsgSent State 2.2.2.2 65501 100 98 Established
๐ ️ BGP Troubleshooting Commands
show ip bgp summary show ip bgp neighbors show ip route debug ip bgp
๐ Math Behind BGP Decisions
BGP uses multiple attributes. One important concept is path selection.
Path Selection Weight Example
BGP prefers the highest weight value.
Best Path = max(weight)
If:
- Path A = 200
- Path B = 100
Then Path A is selected.
AS Path Length
BGP also prefers shorter AS paths:
Best Path = min(AS_PATH length)
๐ BGP Attributes Priority
| Attribute | Preference |
|---|---|
| Weight | Highest |
| Local Preference | Highest |
| AS Path | Shortest |
| Origin | IGP preferred |
| MED | Lowest |
๐ Real-World Scenario
An ISP uses loopback-based BGP peering across multiple fiber links. If one link fails, traffic automatically reroutes without dropping the BGP session.
๐ฏ Key Takeaways
- BGP is policy-based routing
- Physical peering is simple but fragile
- Loopback peering is stable and scalable
- Always ensure reachability
- Use multihop when required
๐ Related Articles
๐ง Final Thoughts
Loopback-based BGP is essential for modern networks. While physical interface peering works in simple setups, scalable environments demand stability and flexibility.
Mastering loopback peering gives you real-world network design capability — something every serious network engineer must understand deeply.
No comments:
Post a Comment