0

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 enter image description here

5
  • It is important that you have correct indentation in your netplan config. Also, you don't provide any gateway, so how would you get an IP without a gateway?? Aug 11 '20 at 7:26
  • The br0 interface declares dhcp4: true, which is how it's expected to get an IP.
    – slangasek
    Aug 12 '20 at 18:23
  • Can you show the output of 'ip link show'? which of the interfaces show as 'up'?
    – slangasek
    Aug 12 '20 at 18:24
  • Of course you're right, my mistake. Aug 12 '20 at 20:40
  • I've updated the post with an ifconfig after adding gateway4 , still the same no ip in br0 and if I pit a static ip also I can´t ping to br0. ( eht0 is not part of the bonding, just for conection purposes) Aug 13 '20 at 17:30
0

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
  • Why would you care if they are on the same switch? Mar 2 '21 at 17:59
-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
  • zero requirement to manually specify a gateway when using dhcp.
    – slangasek
    Aug 12 '20 at 18:24
  • I try every thing I know and could find and I can´t get DHCP to work on the bonding. and if I use static ip also I can´t ping the ip address. Aug 26 '20 at 16:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.