Bond Interface

1. Introduction

A bond interface is a virtual network interface that combines multiple network interfaces into a single one. It ensures that if one network interface fails, others can take over, and systems remain connected.

Create a bond interface.


$ ip link add <interface-name> type bond
  

Add interfaces to the bond interface.

  
$ ip link set <another_interface> master <bond_interface>
  

Set bond mode.

  
$ ip link set <interface-name> type bond mode <bond_mode>
  

2. Labs

2.1. Create a Bond Interface

flowchart LR
    subgraph "bond interface"
        bond0
        dummy1
        dummy2
    end

    network <---> bond0
    bond0 <-- primay --> dummy1
    bond0 <-. backup .-> dummy2

# create dummy interfaces
$ ip link add dummy1 type dummy
$ ip link add dummy2 type dummy

# create bond interface
$ ip link add bond0 type bond

# set bond mode
$ ip link set bond0 type bond mode active-backup

# add dummy1, dummy2 to bond0
$ ip link set dummy1 master bond0
$ ip link set dummy2 master bond0

# assign IP address to bond0
$ ip addr add 192.168.1.3/24 dev bond0

# turn on interfaces
$ ip link set dummy1 up
$ ip link set dummy2 up
$ ip link set bond0 up
  
   
$ ping -I bond0 192.168.1.3
$ cat /proc/net/bonding/bond0
   
  
# turn of primary interface and ping
$ ip link set dummy1 down
$ cat /proc/net/bonding/bond0
$ ping -I bond0 192.168.1.3
  

References