Proposal: Adding MACADDR property to networks DB


(Michael Kuhn) #1

Hi folks,

I suggest that we add a MACADDR property to every key in the networks DB. But in this case all scripts like “nethserver-cockpit/api/system-network/create” would have to be adjusted. That’s why I think we should discuss it first.

Why this proposal?
Nethserver still doesn’t embrace IPv6 very well. You can set a static IPv4-address but you can’t do the same for IPv6. That’s not completely wrong because IPv6 works differently. First you have to have privacy extensions disabled. Otherwise your IPv6-address will change from time to time even if your prefix doesn’t (the part of your address that’s given to you by your ISP in most cases). But that’s not enough. Your Nethserver probably doesn’t use your NIC directly but runs your network in bridged mode. This device (e.g. br0) doesn’t come with a physical MAC-address so every time it’s freshly initiated the MAC-address changes. And every time your MAC changes so does your IPv6-address. You can stop this if you add a MACADDR entry to your ifcfg-br0 network script (not HWADDR because it’s not an actual NIC).

TL;DR
Your IPv6-address depends on it, so you should be able to control it.

Benefit:
There would be one single place to control your IP-addresses - IPv4 and IPv6.

What do you think?


(HF) #2

The IP command can be very useful.

Also used in this how-to https://wiki.nethserver.org/doku.php?id=virtual_network_interface&s[]=dummy

A permanent MAC address could be set which is retrieved from a db property.


(Giacomo Sanchietti) #3

AFAIK if the MAC address is present inside the configuration file, CentOS will bound the interface name with the MAC address itself.
Such behavior breaks the restore procedure on different hardware along with the upgrade process from NS 6 to 7.
This is why on NS 7 we removed the MAC address since we have now consistent ethernet naming.

I don’t really know what could break adding such option.
But you can try by manually adding it:

db networks setprop MACADDR xx:xx:xx:xx:xx:xx
signal-event interface-update

The options shouldn’t be overridden by the UI unless the interface is added or removed from a logical one.


(Michael Kuhn) #4

That‘s what I did a couple of days ago. No problems so far. I’d still like to see IPv6 work out of the box in the future.

The ip command is indeed quite powerful. I already use it in a script to add unique local addresses when an interface gets up.