example42/puppet-network

[feature] support MACADDR

Closed this issue · 5 comments

could we add MACADDR for the ifcfg files?
eg. https://github.com/mojothemonkey/puppet-network/pull/1/files
(done redhat only here - sorry, was in a hurry).

please note, this setting is not the same as HWADDR - it does the opposite:
https://access.redhat.com/solutions/2954

Do not confuse the MACADDR ifcfg file parameter with the HWADDR parameter. The former sets a custom MAC address when the interface is activated while setting the latter will mean the connection will only be activated on an interface with a matching MAC.

many thanks :)

@mojothemonkey that change looks ok, can you make a MR here?
It would be nice to have it also for Debian interfaces, if possible.

hmm, on Debian and Suse, we already have "hwaddr" doing "what we thought it did" - ie spoofing the mac.
(although Debian syntax should be "hwaddress ether ").
so if we amend these to use "@macaddr", to match rhel, it would be breaking for any Debian/Suse users that are using hwaddr already.
maybe we just update the comments to explain hwaddr is doing differnt things on rhel vs debian/suse?

Debian:

hwaddress <%= @manage_hwaddr %>

Suse:

LLADDR="<%= @manage_hwaddr %>"

good doc on the config diffs:
https://en.wikibooks.org/wiki/Changing_Your_MAC_Address/Linux

@mojothemonkey ugh, yes we should not change the current behaviour. Documenting the different behaviour of hwaddr is better.
Eventually I'd also add macaddr support in templates for Debian and Suse, along with the existing entries based on hwaddr, respectively with:

<% if @manage_hwaddr -%>
    hwaddress <%= @manage_hwaddr %>
<% end -%>
<% if @macaddr -%>
    hwaddress ether "<%= @macaddr %>"
<% end -%>

and

<% if @manage_hwaddr -%>
LLADDR="<%= @manage_hwaddr %>"
<% end -%>
<% if @macaddr -%>
LLADDR="<%= @macaddr %>"
<% end -%>

added PR - #336

Merged, thank you!