[CentOS] Trying to override MAC addr

Thu Aug 21 15:29:48 UTC 2014
Digimer <lists at alteeve.ca>

On 21/08/14 11:22 AM, Robert Moskowitz wrote:
>
> On 08/21/2014 10:49 AM, Digimer wrote:
>> On 21/08/14 10:43 AM, Robert Moskowitz wrote:
>>> On 08/21/2014 10:32 AM, m.roth at 5-cent.us wrote:
>>>> Keith Keller wrote:
>>>>> On 2014-08-21, John R Pierce <pierce at hogranch.com> wrote:
>>>>>> On 8/21/2014 7:09 AM, Robert Moskowitz wrote:
>>>>>>> I am trying to override the mac addr.
>>>>>> pretty sure you need to use NIC model specific utilities to do this,
>>>>>> ifcfg-ethN won't do it.   the hwaddr= in there is for finding the nic,
>>>>>> not for reprogramming it.
>>>>> ifconfig claims to support it:
>>>>>
>>>>>            hw class address
>>>> <snip>
>>>> Also, don't forget /etc/udev/rules.d/70-persistant-net.rules
>>> I can't forget what I don't know.  please point me to description of
>>> these rules?
>> It's used to assign names to physical devices via udev. How it works
>> depends a bit on your version.
>>
>> It's discussed as part of these tutorials:
>>
>> CentOS 6:
>> https://alteeve.ca/w/Changing_the_ethX_to_Ethernet_Device_Mapping_in_EL6_and_Fedora_12_to_14
>
> Ah.  A bit:
>
> # cat /etc/udev/rules.d/70-persistent-net.rules
> # This file was automatically generated by the /lib/udev/write_net_rules
> # program, run by the persistent-net-generator.rules rules file.
> #
> # You can modify it, as long as you keep each rule on a single
> # line, and change only the value of the NAME= key.
>
> # net device ()
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="02:c4:03:82:c1:5
> 3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
>
> # net device ()
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="02:c3:04:01:77:c
> 3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
>
> ===========================================
>
> So I can pull that eth1 line that got generated error and change the
> eth0 line?
>
> Well I did that, took the macaddr and hwaddr lines.  restarted network
> and it was not finding eth0.  And it added eth1 back into
> /etc/udev/rules.d/70-persistent-net.rules.
>
> I cleaned that up, and rebooted.  During the boot, I see the message:
>
> Bringing up interface eth0:  Device eth0 does not seem to be present,
> delaying initialization.
> [FAILED]
>
> and once I get started, ifconfig reports eth1 again, and the eth1 line
> got added to rules.  But the network IS working with addresses I want.
> But on eth1 with the errors about eth0.
>
> So there seems to be something before rules that is needed to be edited,
> or there is some limitation on my driver(s).

Note that you generally need to stop the network, edit the udev file and 
then restart the network. It will confuse the kernel otherwise.

Please also note that I've always moved names associated to devices, 
I've not tried changing the address, so there might be something missing 
there.

-- 
Digimer
Papers and Projects: https://alteeve.ca/w/
What if the cure for cancer is trapped in the mind of a person without 
access to education?