BGP in virtual routers¶
BGP configuration and monitoring in VRF¶
Usually, BGP router is configured in VR main. To handle virtual routers, a separate VRF can be specified. The routes learnt and configured will be stored in the corresponding forwarding tables. It is possible to create multiple BGP instances on the same machine.
- Create a BGP instance on a VRF named
customer1, by using following command:
vrf customer 1 routing bgp as 54 .. ..
Then you can continue the configuration as usual. The BGP peering and the redistribution will happen on the whole VRF. All configured interfaces with addresses, and routing information on that VRF will be used.
To get routing information about BGP in that VR instance, you can use following command, that will dump all the instances configured.
vrouter> show bgp vrfs Type Id routerId #PeersVfg #PeersEstb Name L3-VNI Rmac DFLT 0 192.168.0.162 2 1 Default 0 00:00:00:00:00:00 VRF 2 0.0.0.0 0 0 customer1 0 00:00:00:00:00:00 VRF 3 126.96.36.199 0 0 customer2 0 00:00:00:00:00:00
To get more information on a specific VRF, you can use following command, and the VRF name to get routing information:
vrouter> show bgp vrf customer1 ipv4 unicast BGP table version is 2, local router ID is 188.8.131.52, vrf id 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 184.108.40.206/24 0.0.0.0 0 32768 i *> 220.127.116.11/24 0.0.0.0 0 32768 i Displayed 2 routes and 2 total paths
BGP use case for VRF¶
A common use case is to provide a per customer BGP peering. This use case can happen, when several customers share physical resources of a machine, but are isolated by means of either physical interfaces or VLAN interfaces. The following configuration gives an overview on how to create multiple BGP instances tighted with VLAN interfaces.
As you can see on below example, 2 instances of BGP are created, each one run over VLAN interface with its own peer. The same autonomous system can be used for all the instances. The BGP contexts share the same system process but will not share the same forwarding information.
vrf customer1 routing bgp as 65555 router-id 192.168.1.1 neighbor 192.168.1.2 remote-as 65555 .. .. interface vlan vlan10 vlan-id 10 link-interface eth0_0 ipv4 address 192.168.1.1/24 .. .. .. vrf customer2 routing bgp as 65555 router-id 192.168.2.1 neighbor 192.168.2.2 remote-as 65555 .. .. interface vlan vlan20 vlan-id 20 link-interface eth0_0 ipv4 address 192.168.2.0/24 .. ..
With the above example, it could have been possible to use the same IP mapping for both routing entities. An other benefit of having separate entities is that IP mapping can overlap.