You are not logged in.

#1 2023-03-03 01:03:28

Corrupted
Member
Registered: 2021-07-07
Posts: 18

Using networkd to randomize bond mac address

I'm using systemd-networkd to create a bond interface that enslaves my wlan and eth interfaces in active-backup mode. It works but currently when the bond interface is created it and the enslaved interfaces are given a 'persistent' ( read same across boots / network resets ) mac address. I want the mac address for the bond interface randomized on reboots and/or network resets. My current method of trying to do this is to create a link file for the bond interface that sets the MACAddressPolicy to random. It looks like networkd is reading the link file and using it for the bond interface per: networkctl status bond0

2: bond0
                     Link File: /etc/systemd/network/10-default-bond0.link
                  Network File: /etc/systemd/network/30-bond0.network

Despite that I'm still getting the same, persistent mac address assigned to bond. I'm not entirely sure what's going wrong here. I've checked journalctl -u systemd-networkd.service to see if there were any errors reading the file but couldn't find anything to suggest there was a mistake. Below are my link and netdev configs. I was wondering if anyone might be able to tell me:

1.) If it's even possible to assign a random mac to a bond interface? From what I've read it sounds like it should be.
2.) If you've managed to configure a random mac for a bond using networkd how did you do it/what might I be doing wrong?

10-default-bond0.link:

[Match]
Type=bond

[Link]
MACAddressPolicy=random

30-bond0.netdev:

[NetDev]
Kind=bond

[Bond]
Mode=active-backup
PrimaryReselectPolicy=always
MIIMonitorSec=1s

Thanks!

Offline

#2 2023-03-03 01:09:44

Corrupted
Member
Registered: 2021-07-07
Posts: 18

Re: Using networkd to randomize bond mac address

Apologies, I think this is in the wrong section. Taking a look at the tagged post it seems like this probably belongs in Networking, Server and Protection. Is there a way to get this moved over to the correct subforum?

Offline

#3 2023-03-03 07:11:49

d.ALT
Member
Registered: 2019-05-10
Posts: 649

Re: Using networkd to randomize bond mac address

Corrupted wrote:

Is there a way to get this moved over to the correct subforum?

Just click on Report: forum moderators will take care of your request.


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#4 2023-03-03 15:48:27

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,243

Re: Using networkd to randomize bond mac address

Moved, in anticipation of a request wink


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#5 2023-03-17 16:52:10

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,394

Re: Using networkd to randomize bond mac address

I've not tried, but the wiki writes to add a "NamePolicy=" for the link. Since it's a bonded interface, I'd also try to set a "FailOverMACPolicy=active" in the netdev [bond] section. Then check the logs again.

Offline

Board footer

Powered by FluxBB