Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

VM IP adress changes on every restart

Supergrobi

Member
Joined
Mar 24, 2019
Messages
25
I have noticed, that every time I restart one of my VMs, it gets a new IP adress from my FritzBox router. The router is configured for DHCP and every other device in my local network (including the FreeNAS itself) always gets the same IP adress. I always thought the ip adress depends on the MAC address of a machine, but since the MAC of the VMs is not changing I don't understand why this is happening. I am using FreeNAS 11.2-U5. This happens with every VM (Windows, Linux etc.). Any ideas?
 

nojohnny101

Neophyte Sage
Joined
Dec 3, 2015
Messages
1,474
If you want your VM to have the same IP every time then setup an address reservation on your router to match the MAC address and give it always the same IP.
 

Supergrobi

Member
Joined
Mar 24, 2019
Messages
25
I know that this is possible but this is not very convinient. The question is what is the difference between the VMs and „normal“ devices like my mobile phone, ipad or tv? Why do the behave different? What difference does the router see after a reboot of the VM?
 

nojohnny101

Neophyte Sage
Joined
Dec 3, 2015
Messages
1,474
That I do not know as I can't pretend to know the internal logic of your router. Generally a router will assign a new IP address if it thinks it is a new device. So perhaps every time you reboot your VM, your router things it is a completely new device.

I do not have a lot of experience with VMs but when you reboot, does your VM have a new MAC address?
 

Supergrobi

Member
Joined
Mar 24, 2019
Messages
25
Hmmm, this ist strange. My initial statement is not totally true. It seems to be a Windows problem. Just restarted a Linux Mint VM and nothing changed. The MAC adress I can see in the NIC device details in FreeNAS is identical to the MAC I can see in my router config. With Windows 10 this is different. In Freenas I see the MAC 00:A0:98:FF:FF:FF. When I look in my router I see a different MAC :

MSFT 5.0
00:A0:98:69:9B:6A

I do not know where the "MSFT 5.0" comes from, but this seems to be some Microsoft thing. I will investigate further...
 

sretalla

Wizened Sage
Joined
Jan 1, 2016
Messages
4,084
What's happening here is you have not specified the MAC address on the NIC in your VM devices, so every reboot, it will invent a new one and your router sees it as a new device because it has a new MAC address (as expected).

Just specify one (copy the current one if you don't want to invent one) and set it in the NIC under VM devices. (I see in the new UI, they now put a button there to generate one)
 

Supergrobi

Member
Joined
Mar 24, 2019
Messages
25
I already can see a MAC 00:A0:98:FF:FF:FF for my NIC device in the FreeNAS UI. But it seems that it is not used by Windows. Maybe it this is related to the type of NIC. For the Windows VM I changed it to VirtIO and installed the Windows VirtIO driver.
 

sretalla

Wizened Sage
Joined
Jan 1, 2016
Messages
4,084
For the Windows VM I changed it to VirtIO and installed the Windows VirtIO driver.
This is a good/recommended move. I hope it works out for oyu that way.
 

Supergrobi

Member
Joined
Mar 24, 2019
Messages
25
Seems it is not related to the type of NIC. I think I will have to switch to a static ip if no one has a solution.
 
Top