The officially official Devuan Forum!

You are not logged in.

#1 Yesterday 23:28:24

grunchy
Member
Registered: 2024-01-01
Posts: 42  

[SOLVED] MAC change and eudev

had to replace my motherboard yesterday and as a result the computer's MAC address changed.

as a result of the MAC change the computer could no longer connect to the LAN. ifup would fail as the DHCP broadcast failed. digging around i 'found' the file /etc/udev/rules.d/70-persistent-net.rules  where the MAC was hardcoded. manually editing this file, replacing the old MAC with the new MAC, then rebooting fixed the problem.

in the 70-persistent-net.rues file is mentions that it was generated by /lib/udev/write_net_rules. found a mention in stack-exchange (i know, i know) that it was possible to re-generate this file with this command-line

# export INTERFACE=eth0; export MATCHADDR="xx:xx:xx:xx:xx:xx"; /lib/udev/write_net_rules

did not try this as a manual edit worked, but it left me curious. what is the recommended way to update this file when the MAC changes?

Offline

#2 Today 00:40:15

viptux
Member
Registered: 2025-05-06
Posts: 12  

Re: [SOLVED] MAC change and eudev

Interesting.. can also be set from the base network stanza.. either of the two eth0 iface option examples below should work.

# cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
      hwaddress ether 11:22:33:44:55:66
      pre-up ip link set dev eth0 address 11:22:33:44:55:66

Regards

Offline

#3 Today 00:54:09

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,664  

Re: [SOLVED] MAC change and eudev

That /etc/network/interface block would be used to assign the MAC address, wherease the UDEV rule is a condition to only apply for the given MAC address.

Another way to change that udev rules file is by removing it and reboot.

Offline

#4 Today 06:54:19

PedroReina
Member
From: Madrid, Spain
Registered: 2019-01-13
Posts: 302  
Website

Re: [SOLVED] MAC change and eudev

ralph.ronnquist wrote:

Another way to change that udev rules file is by removing it and reboot.

This has been my course of action every time I've been in this situation (a lot of them).

Offline

#5 Today 17:29:26

grunchy
Member
Registered: 2024-01-01
Posts: 42  

Re: [SOLVED] MAC change and eudev

ralph.ronnquist wrote:
Another way to change that udev rules file is by removing it and reboot.

ok. this is satisfyingly simple.

thanks

Offline

Board footer