Forcing own MAC address under OpenWrt ‘WhiteRussian’

Today I had to remove my favourite network card to fit other PCI card (microATX board has only 2 PCI slots). And then I got my old problem — desktop card MAC was same as router one so wrt54gs refused to work with it.

I tried to set wan_hwaddr, def_hwaddr NVRAM entries to other MAC but it was ignored each reboot (even after nvram save). Finally I found a way to resolve/workaround it.

As OpenWrt use simple init from BusyBox I added one script into /etc/init.d/ directory — S07-hrw-set-nvram:

nvram set wan_hwaddr=C0:FF:EE:C0:FF:EE
nvram set def_hwaddr=C0:FF:EE:C0:FF:EE
nvram set il0macaddr=C0:FF:EE:C0:FF:EE

So as result MAC of router card is set to my value and do not conflict with my desktop network card.