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?