Bonding / Ubuntu 20.04

Bonding / Ubuntu 20.04

I recently installed Ubuntu 20.04 on a VM with 2 ethernet ports. I'm trying to bond those 2 ethernet ports, but I can't find the right way. For example, someone says without netplan, others with netplan, bond with bridge, etc.

I'm new in this, is there a way to do a simple bonding?

Update: I reached this point:

network:
version: 2
renderer: networkd
ethernets:
    eth1:
        dhcp4: false

    eth2:
        dhcp4: false

bonds:
    bond0:
        dhcp4: false
        interfaces:
        - eth1
        - eth2
        parameters:
            mode: balance-rr
            mii-monitor-interval: 100
bridges:
    br0:
        dhcp4: true
        interfaces:
        - bond0

And I can't get the IP for br0. The same happens if I only use bond0 without br0.

Thanks

Update II

5

2 Answers

As on your screenshot, you have three ethernets: eth0, eth1, eth2 . eth0 has an IP, so you have some config for this (ie by ifupdown with /etc/network/interfaces config).

I hope eth1, eth2 is not connected to the same switch and network, to get this works it needs more settings.

You should check, that any other tools like ifupdown not used for bringing up eth1, eth2 and bond0, br0.
Do not use this tools with netplan. Disable eth1, eth2 ifaces – remove lines with auto for eth1, eth2, add just one line: iface eth1 inet manual for each. Or rename or delete file /etc/network/interfaces.

If you rename or delete /etc/network/interfaces, you should add config eth0 to netplan config.

For example, in my config I have em1, em2 ethernets. bond0 its together, and br0 at the top of bond0. br0 gets IP via DHCP. br0 is needed to get access to network from VMs on this server. My config:

network:
  version: 2
  renderer: networkd
  ethernets:
    em1:
      dhcp4: no
      dhcp6: no
    em2:
      dhcp4: no
      dhcp6: no
  bonds:
    bond0:
      dhcp4: no
      dhcp6: no
      interfaces:
        - em1
        - em2
      macaddress: "xx:xx:xx:xx:2b:62"
      parameters:
        mode: 802.3ad
        lacp-rate: fast
        mii-monitor-interval: 100
        transmit-hash-policy: layer2+3
  bridges:
    br0:
      dhcp4: yes
      dhcp6: yes
      macaddress: "xx:xx:xx:xx:2b:62"
      interfaces:
        - bond0

You can remove part with bridges and set dhcp4: yes, dhcp6: yes to bond0. This should also works, and bond0 should get IP from DHCP.

Also I made a working config for ifupdown2 (maybe because old ifupdown can't handle ifaces dependency, but ifupdown2 can).

1

Based on yours and my own config, I would imagine something like this could work:

network:
    version: 2
    renderer: networkd
    ethernets:
        eth1:
            dhcp4: false
        eth2:
            dhcp4: false
    bonds:
        bond0:
            dhcp4: false
            interfaces:
              - eth1
              - eth2
            parameters:
                mode: balance-rr
                mii-monitor-interval: 100
    bridges:
        br0:
            dhcp4: true
            gateway4: your.gate.way.addr
            interfaces:
              - bond0
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.