Networking DOCA SDK Documentation

Layer-3 Routing

NVIDIA DOCA™ HBN supports native Layer 3 routing, BGP peering with the host, VRF route leaking, and VLAN subinterfaces on NVIDIA® BlueField® systems.

Before You Begin

  • Plan the interface roles, VLANs, IP addresses, VRFs, BGP autonomous system numbers, and peer relationships for the deployment.

  • Replace the interface names, addresses, prefixes, autonomous system numbers, VRF names, route-map names, and MAC addresses in the examples with deployment-specific values.

  • Use either NVIDIA® user experience (NVUE) or flat-file configuration for a given configuration workflow.

The addresses and command output on this page are example values.

Default Configuration

After a new HBN installation, /etc/network/interfaces contains the loopback declaration:

source /etc/network/interfaces.d/*.intf

auto lo
iface lo inet loopback

FRRouting (FRR) files are present under /etc/frr/, but routing protocols are not enabled by default.

Next-Hop IDs and Next-Hop Groups

HBN uses next-hop IDs to identify route next hops. Routes with multiple paths use next-hop groups to represent equal-cost multipath (ECMP) sets. Linux operational commands can therefore display a next-hop ID rather than embedding each next hop directly in the route.

Native Routing With BGP and ECMP

HBN supports IPv4 and IPv6 unicast routing with BGP and ECMP. The ECMP hash includes the source address, destination address, and IP protocol. For TCP and UDP traffic, it also includes the source and destination ports.

HBN supports up to 64 ECMP paths.

Verify an ECMP Route

The following example shows a route with two next hops. The route references next-hop group 106, which contains next-hop IDs 105 and 107.

Bash
ip route show 20.20.20.0/24
20.20.20.0/24 nhid 106 proto bgp metric 20

ip nexthop show group id 106
id 106 group 105/107 proto zebra

ip nexthop show id 105
id 105 via fe80::202:ff:fe00:7 dev p0_if scope link proto zebra

ip nexthop show id 107
id 107 via fe80::202:ff:fe00:c dev p1_if scope link proto zebra

Confirm that the route references the expected next-hop group and that the group contains each intended uplink.

Configure Host-Facing Ports as Access Ports

NVUE Example

nv set interface lo ip address 10.10.10.1/32
nv set interface lo ip address 2010:10:10::1/128
nv set interface vlan100 type svi
nv set interface vlan100 vlan 100
nv set interface vlan100 base-interface br_default
nv set interface vlan100 ip address 2030:30:30::1/64
nv set interface vlan100 ip address 30.30.30.1/24
nv set bridge domain br_default vlan 100
nv set interface pf0hpf_if,pf1hpf_if bridge domain br_default access 100
nv set vrf default router bgp router-id 10.10.10.1
nv set vrf default router bgp autonomous-system 65501
nv set vrf default router bgp path-selection multipath aspath-ignore on
nv set vrf default router bgp address-family ipv4-unicast enable on
nv set vrf default router bgp address-family ipv4-unicast redistribute connected enable on
nv set vrf default router bgp address-family ipv6-unicast enable on
nv set vrf default router bgp address-family ipv6-unicast redistribute connected enable on
nv set vrf default router bgp neighbor p0_if remote-as external
nv set vrf default router bgp neighbor p0_if type unnumbered
nv set vrf default router bgp neighbor p0_if address-family ipv4-unicast enable on
nv set vrf default router bgp neighbor p0_if address-family ipv6-unicast enable on
nv set vrf default router bgp neighbor p1_if remote-as external
nv set vrf default router bgp neighbor p1_if type unnumbered
nv set vrf default router bgp neighbor p1_if address-family ipv4-unicast enable on
nv set vrf default router bgp neighbor p1_if address-family ipv6-unicast enable on

Flat-File Example

/etc/network/interfaces:

auto lo
iface lo inet loopback
    address 10.10.10.1/32
    address 2010:10:10::1/128

auto p0_if
iface p0_if

auto p1_if
iface p1_if

auto pf0hpf_if
iface pf0hpf_if
    bridge-access 100

auto pf1hpf_if
iface pf1hpf_if
    bridge-access 100

auto vlan100
iface vlan100
    address 2030:30:30::1/64
    address 30.30.30.1/24
    vlan-raw-device br_default
    vlan-id 100

auto br_default
iface br_default
    bridge-ports pf0hpf_if pf1hpf_if
    bridge-vlan-aware yes
    bridge-vids 100
    bridge-pvid 1

Configure Host-Facing Ports as Trunk Ports

NVUE Example

nv set interface lo ip address 10.10.10.1/32
nv set interface lo ip address 2010:10:10::1/128
nv set interface vlan100 type svi
nv set interface vlan100 vlan 100
nv set interface vlan100 base-interface br_default
nv set interface vlan100 ip address 2030:30:30::1/64
nv set interface vlan100 ip address 30.30.30.1/24
nv set bridge domain br_default vlan 100
nv set interface pf0hpf_if,pf1hpf_if bridge domain br_default
nv set vrf default router bgp router-id 10.10.10.1
nv set vrf default router bgp autonomous-system 65501
nv set vrf default router bgp path-selection multipath aspath-ignore on
nv set vrf default router bgp address-family ipv4-unicast enable on
nv set vrf default router bgp address-family ipv4-unicast redistribute connected enable on
nv set vrf default router bgp address-family ipv6-unicast enable on
nv set vrf default router bgp address-family ipv6-unicast redistribute connected enable on
nv set vrf default router bgp neighbor p0_if remote-as external
nv set vrf default router bgp neighbor p0_if type unnumbered
nv set vrf default router bgp neighbor p0_if address-family ipv4-unicast enable on
nv set vrf default router bgp neighbor p0_if address-family ipv6-unicast enable on
nv set vrf default router bgp neighbor p1_if remote-as external
nv set vrf default router bgp neighbor p1_if type unnumbered
nv set vrf default router bgp neighbor p1_if address-family ipv4-unicast enable on
nv set vrf default router bgp neighbor p1_if address-family ipv6-unicast enable on

Flat-File Example

/etc/network/interfaces:

auto lo
iface lo inet loopback
    address 10.10.10.1/32
    address 2010:10:10::1/128

auto p0_if
iface p0_if

auto p1_if
iface p1_if

auto pf0hpf_if
iface pf0hpf_if

auto pf1hpf_if
iface pf1hpf_if

auto vlan100
iface vlan100
    address 2030:30:30::1/64
    address 30.30.30.1/24
    vlan-raw-device br_default
    vlan-id 100

auto br_default
iface br_default
    bridge-ports pf0hpf_if pf1hpf_if
    bridge-vlan-aware yes
    bridge-vids 100
    bridge-pvid 1

Configure FRR for Native Routing

/etc/frr/daemons:

bgpd=yes
vtysh_enable=yes

/etc/frr/frr.conf:

frr version 7.5+cl5.3.0u0
frr defaults datacenter
hostname hbn
log syslog informational
no zebra nexthop kernel enable
!
router bgp 65501
 bgp router-id 10.10.10.1
 bgp bestpath as-path multipath-relax
 neighbor p0_if interface remote-as external
 neighbor p0_if advertisement-interval 0
 neighbor p0_if timers 3 9
 neighbor p0_if timers connect 10
 neighbor p1_if interface remote-as external
 neighbor p1_if advertisement-interval 0
 neighbor p1_if timers 3 9
 neighbor p1_if timers connect 10
 !
 address-family ipv4 unicast
  redistribute connected
  maximum-paths 64
  maximum-paths ibgp 64
 exit-address-family
 !
 address-family ipv6 unicast
  redistribute connected
  neighbor p0_if activate
  neighbor p1_if activate
  maximum-paths 64
  maximum-paths ibgp 64
 exit-address-family
!
line vty
!
end

Configure Direct Routing on Host-Facing Interfaces

Host-facing PF and VF representors can operate as Layer 3 interfaces without being members of a bridge.

NVUE Example

nv set interface pf0hpf_if ip address 30.30.11.1/24
nv set interface pf0hpf_if ip address 2030:30:11::1/64
nv set interface pf0vf0_if ip address 30.30.13.1/24
nv set interface pf0vf0_if ip address 2030:30:13::1/64

Flat-File Example

auto pf0hpf_if
iface pf0hpf_if
    address 2030:30:11::1/64
    address 30.30.11.1/24

auto pf0vf0_if
iface pf0vf0_if
    address 2030:30:13::1/64
    address 30.30.13.1/24

BGP Peering With the Host

HBN can establish a BGP session with a routing stack on the host. The host can then advertise endpoint prefixes through the BlueField system into the underlay fabric. HBN supports IPv4 and IPv6 unicast address families, and traffic to and from the advertised host endpoints can be offloaded.

Apply route filtering to limit the prefixes that the host can advertise.

NVUE Example

The following example peers with host addresses 45.3.0.4 and 2001:cafe:1ead::4. Either BGP session can carry IPv4 and IPv6 unicast routes.

nv set vrf default router bgp autonomous-system 63642
nv set vrf default router bgp enable on
nv set vrf default router bgp neighbor 45.3.0.4 nexthop-connected-check off
nv set vrf default router bgp neighbor 45.3.0.4 peer-group dpu_host
nv set vrf default router bgp neighbor 45.3.0.4 type numbered
nv set vrf default router bgp neighbor 2001:cafe:1ead::4 nexthop-connected-check off
nv set vrf default router bgp neighbor 2001:cafe:1ead::4 peer-group dpu_host
nv set vrf default router bgp neighbor 2001:cafe:1ead::4 type numbered
nv set vrf default router bgp peer-group dpu_host address-family ipv4-unicast enable on
nv set vrf default router bgp peer-group dpu_host address-family ipv6-unicast enable on
nv set vrf default router bgp peer-group dpu_host remote-as external

HBN Flat-File Example

/etc/frr/frr.conf:

router bgp 63642
 bgp router-id 27.0.0.4
 bgp bestpath as-path multipath-relax
 neighbor dpu_host peer-group
 neighbor dpu_host remote-as external
 neighbor dpu_host advertisement-interval 0
 neighbor dpu_host timers 3 9
 neighbor dpu_host timers connect 10
 neighbor dpu_host disable-connected-check
 neighbor fabric peer-group
 neighbor fabric remote-as external
 neighbor fabric advertisement-interval 0
 neighbor fabric timers 3 9
 neighbor fabric timers connect 10
 neighbor 45.3.0.4 peer-group dpu_host
 neighbor 2001:cafe:1ead::4 peer-group dpu_host
 neighbor p0_if interface peer-group fabric
 neighbor p1_if interface peer-group fabric
 !
 address-family ipv4 unicast
  neighbor dpu_host activate
 exit-address-family
 !
 address-family ipv6 unicast
  neighbor dpu_host activate
 exit-address-family

Host FRR Example

The following example configures FRR on the host. The host uses VRF v_200_2000 and advertises connected IPv4 and IPv6 routes.

frr version 7.2.1
frr defaults traditional
hostname host
no ip forwarding
no ipv6 forwarding
!
router bgp 1000008
!
router bgp 1000008 vrf v_200_2000
 neighbor 45.3.0.2 remote-as external
 neighbor 2001:cafe:1ead::2 remote-as external
 !
 address-family ipv4 unicast
  redistribute connected
 exit-address-family
 !
 address-family ipv6 unicast
  redistribute connected
  neighbor 45.3.0.2 activate
  neighbor 2001:cafe:1ead::2 activate
 exit-address-family
!
line vty
!
end

Host interface configuration:

auto lo
iface lo inet loopback
    address 27.0.0.7/32
    address 2001:c000:10ff:f00d::7/128

auto v_200_2000
iface v_200_2000
    address 60.1.0.1
    address 60.1.0.2
    address 60.1.0.3
    address 2001:60:1::1
    address 2001:60:1::2
    address 2001:60:1::3
    vrf-table auto

auto ens1f0np0
iface ens1f0np0
    address 45.3.0.4/24
    address 2001:cafe:1ead::4/64
    gateway 45.3.0.1
    gateway 2001:cafe:1ead::1
    vrf v_200_2000
    hwaddress 00:03:00:08:00:12
    mtu 9162

After applying both configurations, confirm that the BGP neighbors are established and that the expected host prefixes appear in the HBN BGP and routing tables.

VRF Route Leaking

VRF route leaking dynamically imports routes from a source VRF into a destination VRF through BGP. Use it to share services between VRFs or to provide multiple tenant VRFs with connectivity through a shared external-services VRF.

When you configure route leaking:

  • Use BGP redistribute, not network, to leak connected or static routes.

  • Do not import overlapping prefixes into the same destination VRF.

  • Do not use the default VRF as the shared-services VRF.

  • Route leaking does not provide access from a host in one VRF to an interface address local to the BlueField system in another VRF.

Import Routes From Another VRF

The following commands import IPv4 BGP routes from VRF BLUE into VRF RED:

nv set vrf RED router bgp address-family ipv4-unicast route-import from-vrf list BLUE
nv config apply

To remove the import:

nv unset vrf RED router bgp address-family ipv4-unicast route-import from-vrf list BLUE
nv config apply

Filter Imported Routes

The following example permits routes learned through BGP, sets community 11:11, and applies the route map to the import from VRF BLUE:

nv set vrf RED router bgp address-family ipv4-unicast route-import from-vrf list BLUE
nv set router policy route-map BLUEtoRED rule 10 match type ipv4
nv set router policy route-map BLUEtoRED rule 10 match source-protocol bgp
nv set router policy route-map BLUEtoRED rule 10 action permit
nv set router policy route-map BLUEtoRED rule 10 set community 11:11
nv set vrf RED router bgp address-family ipv4-unicast route-import from-vrf route-map BLUEtoRED
nv config apply

Verify Route Leaking

Display the NVUE route-import state:

nv show vrf <vrf-name> router bgp address-family ipv4-unicast route-import

Display the vtysh route-leak state:

show ip bgp vrf <vrf-name> ipv4|ipv6 unicast route-leak

Example NVUE output:

nv show vrf RED router bgp address-family ipv4-unicast route-import
                operational   applied
--------------  ------------  ---------
from-vrf
  enable                      on
  route-map                   BLUEtoRED
  [list]        BLUE          BLUE
[route-target]  10.10.10.1:3

For detailed import state, use:

  • nv show vrf <vrf-name> router bgp address-family ipv4-unicast route-import from-vrf

  • nv show vrf <vrf-name> router bgp address-family ipv4-unicast route-import from-vrf list

  • nv show vrf <vrf-name> router bgp address-family ipv4-unicast route-import from-vrf list <leak-vrf-id>

Display the BGP table:

nv show vrf <vrf-name> router bgp address-family ipv4-unicast
show ip bgp vrf <vrf-name> ipv4|ipv6 unicast

Display the FRR routing table:

show ip route vrf <vrf-name>
net show route vrf <vrf-name>

Confirm that the intended routes appear in the destination VRF and that routes excluded by the route map are absent.

VLAN Subinterfaces

A VLAN subinterface is a Layer 3 interface associated with a VLAN tag. Linux uses dot notation, such as p0_if.100, to identify VLAN 100 on parent interface p0_if.

  • p0_if.100 receives traffic tagged with VLAN 100.

  • Traffic transmitted through p0_if.100 carries VLAN tag 100.

You can create VLAN subinterfaces on uplink interfaces and host-facing PF and VF representors. Do not add a Layer 3 VLAN subinterface to a bridge.

The following example creates VLAN 10 on uplink p0_if and VLAN 999 on host-facing VF representor pf1vf0_if. It assigns IPv4 and IPv6 addresses to the host-facing subinterface.

NVUE Example

nv set interface p0_if.10 base-interface p0_if
nv set interface p0_if.10 type sub
nv set interface p0_if.10 vlan 10

nv set interface pf1vf0_if type swp
nv set interface pf1vf0_if.999 base-interface pf1vf0_if
nv set interface pf1vf0_if.999 type sub
nv set interface pf1vf0_if.999 vlan 999
nv set interface pf1vf0_if.999 ip address 30.30.14.1/24
nv set interface pf1vf0_if.999 ip address 2030:30:14::1/64

Flat-File Example

/etc/network/interfaces:

auto p0_if.10
iface p0_if.10

auto pf1vf0_if.999
iface pf1vf0_if.999
    address 2030:30:40::1/64
    address 30.30.40.1/24

After applying the configuration, confirm that each subinterface is present, assigned to the intended VLAN, and using the expected addresses.

Last updated: