Chuyển đến nội dung chính

Lesson 10: Dynamic Routing - BGP

Configure BGP dynamic routing on VyOS, including theory, practical examples, lab steps, and a summary.

Dynamic Routing - BGP

Introduction to BGP on VyOS

This lesson explains how to configure BGP (Border Gateway Protocol) on VyOS 1.4.x/1.5 rolling release. BGP is the standard dynamic routing protocol for large networks, ISPs, and multi-provider connectivity.

1. BGP fundamentals

  • AS (Autonomous System): A distinct administrative routing domain.
  • iBGP vs eBGP: iBGP (internal), eBGP (external peering).
  • Path Selection: Rules to choose the best path.

2. Basic BGP configuration

set protocols bgp 65001 parameters router-id 1.1.1.1
set protocols bgp 65001 neighbor 2.2.2.2 remote-as 65002
set protocols bgp 65001 neighbor 2.2.2.2 address-family ipv4-unicast
set protocols bgp 65001 network 192.168.10.0/24
set protocols bgp 65001 network 10.10.10.0/24
  • Route-map, prefix-list, AS-path:
set policy prefix-list PL-OUT rule 10 action permit prefix 192.168.10.0/24
set policy route-map RM-OUT rule 10 action permit
set policy route-map RM-OUT rule 10 match ip address prefix-list PL-OUT
set protocols bgp 65001 neighbor 2.2.2.2 route-map export RM-OUT
set protocols bgp 65001 neighbor 2.2.2.2 as-path-prepend '65001 65001'

3. BGP Communities, Route Reflector, and IPv6

set protocols bgp 65001 neighbor 3.3.3.3 remote-as 65001
set protocols bgp 65001 neighbor 3.3.3.3 route-reflector-client
set protocols bgp 65001 neighbor 2.2.2.2 address-family ipv6-unicast
set protocols bgp 65001 neighbor 2.2.2.2 extended-nexthop
set protocols bgp 65001 neighbor 2.2.2.2 soft-reconfiguration inbound

4. Verify BGP status

show ip bgp summary
show ip bgp
show ip bgp neighbors

5. Example network diagram

+---------+     +---------+
| VyOS 1 |-----| VyOS 2 |
| AS65001|     | AS65002|
+---------+     +---------+

6. Hands-on lab: BGP peering between 2 ASes

  1. Configure BGP on two VyOS routers with different AS numbers.
  2. Set neighbor, route-map, prefix-list, and as-path-prepend.
  3. Commit and save the configuration:
commit
save
  1. Verify BGP status and routes.
show ip bgp summary
show ip bgp

7. Summary

You now know how to configure BGP on VyOS and apply it to large, multi-provider networks with policy-based dynamic routing control.