1

I have multiple ARM devices on which Debian runs. I have a single image saved from the SD Card and intent to use it on all devices.

Now I have the problem, that each time the MAC address of the eth, wlan, etc... port changes, it adds a new entry to the 70-persistent-net.rules file. For me this is a problem because in my /etc/network/interfaces file I only have eth0 setup. If the interface gets linked to eth1 it won't connect to the network. Since no screen is connected it is a hassle to redo this process everytime.

Is there a way to tell the OS to always use eth0 when the MAC address of the ethernet interface changes?

1

This is what I put in my 70-persistent-net.rules file; you might only need the first two:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth0", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth1", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth2", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth3", NAME="eth3"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth4", NAME="eth4"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth5", NAME="eth5"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth6", NAME="eth6"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth7", NAME="eth7"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth8", NAME="eth8"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth9", NAME="eth9"
1

At the end of /etc/rc.local

 if ifconfig | grep -q eth0 
 then
   : > /etc/udev/rules.d/70-persistent-net.rules
   reboot
 fi

This sould do the job, and in case you reboot on same devices, you reboot only once.

As a faster alternatives, you can delete 70-persistent-net.rules on shutdown, this suppose you only do scheduled shutdown.

  • So using wildcards like * in the MAC adress field in the 70-persistent-net.rules file is not allowed? – ap0 Sep 21 '15 at 8:51
1
  1. Delete your current interface name prescriptions:

    # rm /etc/udev/rules.d/70-persistent-net.rules
    
  2. Make sure they don't get regenerated:

    # touch /etc/udev/rules.d/75-persistent-net-generator.rules
    
  3. That's it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.