Skip to content

Create BGP underlay Network

Huanyu He edited this page Mar 22, 2022 · 7 revisions

BGP underlay sample is a basic configuration of creating a BGP Network. Mostly like creating a VLAN Network, you need to create a Network with a BGP valued spec.mode field and group Nodes by different labels (and selectors):

apiVersion: networking.alibaba.com/v1
kind: Network
metadata:
  name: network1
spec:
  nodeSelector:
    network: network1
  type: Underlay
  mode: BGP                     # Required.
  netID: 100                    # Required.
                                # For Underlay BGP network, netID refers to the AS number used by hybridnet
                                # nodes which belongs to this network.
  config:
    bgpPeers:                         # Required. Only one BGP peer is supported now.
      - asn: 200                      # Required. The AS number for remote BGP peer.
        address: 192.168.56.254       # Required. The IP address for remote BGP peer. Usually is an address of a TOR switch.
        gracefulRestartSeconds: 600   # Optional. Default 300.
        password: "12345"             # Optional.

There is a topologic of hybridnet BGP Network like this:

bgp-topologic

In the diagram above, we are showing that each BGP Network object represents a TOR switch (in other words, the Nodes belongs to the switch) and every Node belongs to the same BGP Network shares one AS number. The AS number of Nodes should be different from the TOR it belongs to, but for Nodes which belong to different TOR switches, using the same AS number is fine.

The topologic is quite similar with the downward default model of Calico. Every TOR switch should be the default gateway of Node and each router announces all of its routes to its upstream peer (the Nodes to their ToR, the ToRs to the spine switches). Except these, things are different.

In order to keep the flexibility of ip address management and make the spine switches carry less hybridnet network routes, hybridnet daemon always announces each Subnet with its origin prefix length, which means every spine switch will have only one route for every Subnet (no Subnet will across multiple Networks).

At the same time, because a Node has no routing information of other Nodes, the cross-node traffic will always be forwarded by TOR. To tell TOR switches about the information of Pod ip addresses, hybrident daemon will announce every Pod ip address with a NO_EXPORT community (so the spine switches will not get any Pod ip route).

Here is another sample topologic of BGP Network (maybe more typical):

bgp-topologic-sample