The displayed MAC address is different each time a portal device is power cycled. It looks like an appropriate MAC address however it is random and not correct (i.e. not the same fixed MAC address shown by ip addr for eth0).
The problem and solution are described here: https://runebook.dev/en/docs/python/library/uuid/uuid.getnode
It seems that the behaviour of uuid.getnode() is that it will return a random MAC address if it cannot access the true hardware one.
Instead the 'getmac' package (https://pypi.org/project/getmac/) can be used to return the correct hardware MAC address each time.
Solution:
- Update the
install_portal.sh script to include installation of getmac
python -m pip install getmac
If a portal is already installed and this update is required, then run the install_portal.sh script.
- Update the portal-main.py script to use getmac:
a. Add the appropriate import:
from getmac import get_mac_address as gma
b. Modify the get_mac() function:
def get_mac():
return f'{gma()}'
Where gma() returns the MAC address in the desired string format without any reformatting required.
The displayed MAC address is different each time a portal device is power cycled. It looks like an appropriate MAC address however it is random and not correct (i.e. not the same fixed MAC address shown by
ip addrfor eth0).The problem and solution are described here: https://runebook.dev/en/docs/python/library/uuid/uuid.getnode
It seems that the behaviour of uuid.getnode() is that it will return a random MAC address if it cannot access the true hardware one.
Instead the 'getmac' package (https://pypi.org/project/getmac/) can be used to return the correct hardware MAC address each time.
Solution:
install_portal.shscript to include installation of getmacIf a portal is already installed and this update is required, then run the install_portal.sh script.
a. Add the appropriate import:
b. Modify the get_mac() function:
Where gma() returns the MAC address in the desired string format without any reformatting required.