What is BGP next-hop-self and why you should care?
In this blog post, we’ll demystify the concept of next-hop-self in BGP, why it’s crucial, and how it affects routing decisions.
What Is Next-Hop-Self in BGP?
In BGP, the “next hop” is the IP address used to reach a particular network or destination. The “next-hop” IP address is vital for making routing decisions and forwarding traffic. The next-hop attribute is typically advertised in BGP updates, allowing routers to determine the path for forwarding packets.
“Next-hop-self” is a BGP feature that allows a BGP router to modify the next-hop IP address in the BGP update it sends to its peers. By default, BGP advertises the next-hop address received from the advertising router. However, when next-hop-self is configured, the router substitutes the next-hop IP address with its own IP address before sending the BGP update to its peers. This is very helpful in route reflectors and Internet Exchange (IX) route servers.
Why is Next-Hop-Self Important?
The next-hop-self feature serves several crucial purposes in BGP routing:
- Avoiding Routing Issues: In BGP, routers need to have a route to the next-hop IP address to forward traffic correctly. Without next-hop-self, BGP routers might not have the necessary route information to reach the original next-hop IP address. By substituting their own IP address, routers ensure they have a route to the next hop, preventing routing issues.
- Hub-and-Spoke Networks: Next-hop-self is especially useful in hub-and-spoke network topologies. In such scenarios, the hub router can use next-hop-self to ensure that all traffic flows through it, optimizing traffic engineering and security.
- Traffic Engineering: BGP routers often use next-hop-self to influence the path that traffic takes. By modifying the next-hop address, routers can guide traffic through specific routes, which is valuable for optimizing network performance.
- Redistribution: In multi-protocol environments, routers may use next-hop-self to ensure proper redistribution of BGP routes into other routing protocols. This helps in maintaining a consistent routing table.
To configure next-hop-self in BGP, you need to access the router’s BGP configuration and apply the setting to the specific neighbor or peer. The exact steps can vary depending on your router and its operating system. Generally, you will need to:
- Access the router’s command line interface.
- Enter the BGP configuration mode.
- Specify the neighbor or peer for which you want to enable next-hop-self.
- Enable next-hop-self for that neighbor.
Here’s a simplified example using Cisco IOS syntax:
router bgp <AS-number>
Mikrotik talks about next-hop-self in their routing document.j2networks family of sites