sipeed / NanoKVM

NanoKVM: Affordable, Multifunctional, Nano RISC-V IP-KVM
GNU General Public License v3.0
3.12k stars 52 forks source link

Static MAC Address #28

Open cedartinkerer opened 2 months ago

cedartinkerer commented 2 months ago

I know you can set a static IP but I'd like to be able to set a static MAC address. Or at least I assume so. Every reboot it grabs a new IP. And if I am moving between networks being able to 'lock in' a MAC address so the DHCP server would keep handing out the same IP would be really helpful. Ideally it could be in the GUI like a check box 'Lock MAC Address' or something.

cedartinkerer commented 2 months ago

I believe I fixed it for myself by using the command:

echo "pre-up ifconfig eth0 hw ether whatever:mac:address" >> /etc/network/interfaces

It would be nice if not in the UI to at least add this in the technical documentation next to the static IP option

cedartinkerer commented 2 months ago

And it looks like I spoke to soon. That actually did not resolve the issue. It seemed to keep it for a reboot or two but then it goes back to cycling.

Jakdaw commented 1 month ago

Have a look in /etc/init.d/S10uuid - looks like you can persist a MAC in /boot/ethmac, but there's clearly an error in that script so that it only looks in /boot/ethmac if /boot/eth.mac exists. I'd put your static MAC in both, if I were you!

cedartinkerer commented 1 month ago

@Jakdaw - That seems to have held better. Thanks for that pointer. I ended up putting the mac in /boot/ethmac and just creating /boot/eth.mac but I agree it looks like an error.

Interestingly on one of my networks even though the mac was the same I was getting different IPs. Once I hard coded a reservation it worked. I need to try another network to see if it is a network issue or NanoKVM oddity. I'm suspecting network.