0

I'm setting up bonding of two 1 GB Ethernet NICs on Ubuntu Server 20.04 LTS in mode 0 (balanced-rr).

The bond is working in that it comes up at the assigned IP address and I can SSH into it at this address. However, each of the bonded slave NICs still get a DHCP address assigned.

How can I set this up so only the bond has an IP address?

Here's how I set it up:

sudo apt-get install ifenslave
sudo modprobe bonding
Edited /etc/modules to add "bonding"

Finally, edited /etc/network/interfaces to contain the following: (Note, it was blank before I edited it)

# bond0 is the bonded NIC, can be used like a normal NIC
auto bond0
iface bond0 inet static
  address 10.16.0.91
  gateway 10.16.0.1
  netmask 255.255.0.0

#mode 0 is balanced-rr bond-mode 0 bond-miimon 100 bond-slaves enp1s0 enp2s0

enp1s0 connected to bond0

auto enp1s0 iface enp1s0 inet manual bond-master bond0

enp2s0 connected to bond0

auto enp2s0 iface enp2s0 inet manual bond-master bond0

After rebooting, when I do "ifconfig" it gives the following (and I can use all 3 IPs)

bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 10.16.0.91  netmask 255.255.0.0  broadcast 10.16.255.255
        inet6 fe80::203:2dff:fe41:edae  prefixlen 64  scopeid 0x20<link>
        ether 00:03:2d:41:ed:ae  txqueuelen 1000  (Ethernet)
        RX packets 356  bytes 29976 (29.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 110  bytes 16969 (16.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp1s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 inet 10.16.100.143 netmask 255.255.0.0 broadcast 10.16.255.255 ether 00:03:2d:41:ed:ae txqueuelen 1000 (Ethernet) RX packets 252 bytes 23651 (23.6 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 76 bytes 8779 (8.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0x91300000-913fffff

enp2s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 inet 10.16.100.142 netmask 255.255.0.0 broadcast 10.16.255.255 ether 00:03:2d:41:ed:ae txqueuelen 1000 (Ethernet) RX packets 240 bytes 19975 (19.9 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 75 bytes 12250 (12.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0x91100000-911fffff

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 85 bytes 6400 (6.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 85 bytes 6400 (6.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

How do I prevent the slave interfaces from getting their own DHCP address?

wkwave
  • 1
  • Thanks for the suggestion, @Terrance. Unfortunately, it doesn't - the system doesn't have dhcpcd (there is not a /etc/dhcpcd.conf file.) I looked to see if there is a way to do something similar using /etc/dhcp/dhclient.conf but it didn't appear so. – wkwave Jul 19 '21 at 21:21
  • Maybe look at the answer here: https://askubuntu.com/questions/1293208/cant-disable-local-addresses-on-network-interfaces/1293486#1293486 Possible that netplan.io is still there causing some issues? – Terrance Jul 19 '21 at 21:28
  • I'm not using netplan. (The only updates to the networking after the Ubuntu server install are those above.) In that linked question, the Answer "Feb. 25, 2021 Note:" it seems the final solution was for DHCPCD, editing the /etc/dhcpcd.conf file again. – wkwave Jul 19 '21 at 21:50
  • I wrote that answer, but I also removed Netplan.io from the system to stop conflicting with ifupdown. I wasn't using netplan either, but it was there causing issues as well. – Terrance Jul 19 '21 at 21:52
  • I see. Removing netplan.io did indeed fix the issue! It also seems to have removed an irritating wait on network configuration that was causing the boot to take a lot longer. @Terrance you sir are a gentleman and a scholar! Thank you. – wkwave Jul 19 '21 at 22:13
  • Let me write that up here. – Terrance Jul 19 '21 at 23:27

1 Answers1

0

Since you are going to be using ifupdown for controlling your network cards, the application of netplan.io is no longer needed. It will conflict with ifupdown causing issues of extra IP addresses, etc.

sudo apt remove netplan.io

Hope this helps!

Terrance
  • 41,612
  • 7
  • 124
  • 183
  • that wants to remove ubuntu-minimal as well, which sounds important, can netplan.io be removed in 22.04? – teknopaul Oct 19 '22 at 16:45
  • @teknopaul I don't have it installed on my 22.04, but I don't remember it asking to remove ubuntu-minimal. It only removed the netplan.io for me. Then again, when I upgraded to 22.04 I can't remember if netplan.io was even installed. – Terrance Oct 19 '22 at 17:07