1

I observerd that the bond0 interface I create at install time may randomly use the MAC address of the first or second interface.

This is causing problems because it means that the ARP information of the server would not be consistent.

I want to force the bonds to always use the first (eth0) interface, preferably without having to manually mention the MAC address (same settings are used by multiple machines).

My current bonding options are (github):

kernel_options: >
  nomodeset
  i915.modeset=0
  nouveau.modeset=0
  logo.nologo
  inst.cmdline
  inst.proxy={{ http_proxy }}
  proxy={{ http_proxy }}
  modprobe.blacklist=floppy
  console=tty0
  console={{ serial_console }}
  inst.ks.sendmac
  bond=bond0:{{ bond_slaves }}:{{ bond_options}}
  {%- if syslog_server is defined -%}inst.syslog={{ syslog_server }}{%- endif -%}
0xSheepdog
  • 535
  • 2
  • 19
sorin
  • 7,668
  • 24
  • 75
  • 100
  • By all means if used with standard ifup tool you wouldn't need to change anything. But you should have mentioned that you use ansible to build your hosts. Also are you sure that the name of the interface will be eth0 and eth1 and not something like enp3s0? – Dmitriy Kupch Dec 07 '18 at 18:52
  • This issue is not caused by random ethX assignment as I checked that. i suspect is caused by first one that gets link up would determine the mac of the bond. – sorin Dec 07 '18 at 21:21
  • Technically, it's not that the IP address isn't stable, it's that the ARP entry is wrong/unstable. – 0xSheepdog Jun 10 '19 at 15:25

1 Answers1

1

To answer your question, you should try primary=eth0 to your bond_options variable, it is expected to do what you want.

I don't understand why you say that the server ip would not be stable :

  • as soon as the bond is up, it will always keep the same mac address (either eth0 one, or eth1 one, we just don't care), considering we are running without primary=eth0 parameter

  • when you bring up the bond with its ip, the network switch arp cache table will be updated with bond mac address and associated ip, and this will just work, whatever the nic failures you may have during the time. Just try to unplug eth0 or eth1, and everything will be fine, with the same mac address & ip.

Chaoxiang N
  • 1,218
  • 4
  • 10
  • Sorry but the **primary** option is not an option unless mode=1, read https://wiki.linuxfoundation.org/networking/bonding -- I tried it and it failed to up the bond. I think I will endup manually forcing the MAC of the bond to assure it is consistent across reboots. Lucky for me I already have MACs saved in Ansible inventory. – sorin Dec 15 '18 at 10:31