Jump to content

Prevent eth0 link from coming up on boot


mic_e

Recommended Posts

Hi,

 

I'm using a xenial system with Kernel 4.9.11-sunxi on LIME2 (actually it's an Olimex A20-SOM with external RTL8211 PHY) and trying to prevent the ethernet from coming up on boot.

 

When turning the system on, the ethernet interface will assign a random MAC address; later on my script sets a proper MAC from an assigned range. Until then the eth0 interface must stay down to prevent the network from being spammed with bogous messages.

 

This is because the ethernet interface chooses a random MAC address when the system boots up; later on a script sets the proper MAC address from an assigned range (along with IP and route configuration); The link must stay down until this has happened.

 

I've tried to replace the eth0 entries in /etc/network/interfaces with

auto eth0 inet manual

Which has the effect that the interface no longer gets a DHCP address, but I'm still seeing this in my dmesg log:

[   15.972814] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   16.990692] sun7i-dwmac 1c50000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   16.990760] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Link to comment
Share on other sites

What I'd do:

 

- kernel eth driver as a module (may already be the case)

- forbid this module to be autoloaded at boot time (look at blacklist files in /etc/modprobe.d)

- do your stuff to get MAC@

- load module manually (modprobe)

Link to comment
Share on other sites

I've tried to replace the eth0 entries in /etc/network/interfaces with

auto eth0 inet manual

Which has the effect that the interface no longer gets a DHCP address, but I'm still seeing this in my dmesg log:

[   15.972814] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   16.990692] sun7i-dwmac 1c50000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   16.990760] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

which is exactly what is expected to happen in this setup:

Lines beginning with the word "auto" are used to identify the

physical interfaces to be brought up when ifup is run with the -a

option. (This option is used by the system boot scripts.) Physical

interface names should follow the word "auto" on the same line.

There can be multiple "auto" stanzas.

fron interfaces man page.

Link to comment
Share on other sites

which is exactly what is expected to happen in this setup:

fron interfaces man page.

Oh. I'm sorry, the thing I actually wrote was

iface eth0 inet manual

auto lo
iface lo inet loopback

What I'd do:

 

- kernel eth driver as a module (may already be the case)

- forbid this module to be autoloaded at boot time (look at blacklist files in /etc/modprobe.d)

- do your stuff to get MAC@

- load module manually (modprobe)

Hm. How can I set the MAC address of an interface if the interface doesn't even exit yet because the corresponding driver isn't loaded?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines