DHCP and Virtual Machine

  • Hello.


    Host: Windows 10 64bits
    16 GB RAM
    Intel I7
    VM: Linux CentOS 7.8
    6 Gb

    DHCP in PfSense is set to use predefined IP for each MAC Address of the devices in the network.


    It works fine ... until I create a VM in my laptop. It seems that the DHCP Server of PfSense can not be reached/saw/found/listened by the VM, and so the IP leased to the VM becomes the same than the IP of my laptop.

    If I use static IP in the VM it works. But I would like that the DHCP server leases an IP to the VM like it does to any device fisical.

    Some light fo what is wrong? VM or Pfsense?

  • LAYER 8 Global Moderator

    So you have the connection of the VM bridge with your laptop interface? Its not behind a VM nat?

    Normally when you create a VM it will create a random mac for the vm to use. You would need to make sure you have reservation setup for this vms mac.

    Are you seeing anything in the logs about the vm trying to obtain and IP.. You should see the request coming into the dhcp server via its logs, and then pretty much just being ignored if that mac is not in the reservations list.

  • Hello @johnpoz
    Thank you for your answer.

    Yes, the connection is bridge with my laptop interface. Not NAT.

    "...random MAC..."

    I use static MAC address:


    I didn´t see anything in the logs that could help. It seems like the VM not even tried to acquire an IP and just uses the same IP of my laptop.

    In other hand I am using Captive Portal and I added the MAC address of the VM in the MAC´s list for "pass", but even so I have to authenticate on the Captive Portal to access Intenert when I am using the VM.


    Clearly PfSense is not receiving the MAC of the VM.

  • LAYER 8 Global Moderator

    @hugoeyng said in DHCP and Virtual Machine:

    Clearly PfSense is not receiving the MAC of the VM.

    Well then your not "bridged" like you think..

    If you were you would see the mac of the VMs virtual interface.. None of which has anything to do with pfsense. Pfsense can not magically make some vm on some host present its mac to it..

    I would think you prob get more help on a forum that deals with your specific VM hosting software.

    What VM software are you using exactly? I could fire it up and take a look see to what you might be doing wrong.

  • @johnpoz I am using Hyper V

    Next images show network settings (in portuguese, sorry) :



    Using static IP in the VM:


    But using dynamic IP in the VM, it takes the same IP than my laptop, as if my laptop ask DHCP and not the VM:


  • LAYER 8 Global Moderator

    Many wireless cards do not allow for what your doing.

    Why would you be using a wireless card if your host as a wire?

    Again none of this has anything to do with pfsense - you would get better help on hyper-v forum asking them why your VM is not using its own mac, etc.

  • I am using a wireless card because it is the device I connect my netowork. No special reason.

    I do not know why/from where comes:


    The laptop network settings:


  • LAYER 8 Global Moderator

    Virbr0 is most likely bridge interface used for nat.. is default IP for the nat..

    While I would like to help you more - I just do not have the time right now to fire up hyper-v and go through what is basic configuration on how to bridge a guest to the local network.

    And again - this has ZERO to do with pfsense. ZERO..

    I would suggest you would get better help on a hyper-v forum, better even in your native language.. So they could read your screenshots..

    Here this might help

    Again - if your trying to do do this with a physical wireless card you might have issues. Depending on the card and the version of hyper-v your using.

    But again this has nothing to do with pfsense.. And while you might find some hyper-v users willing to help you.. You most likely will have better luck on a forum that specializes in hyper-v.

    Also moving this to off-topic, because has nothing to do with pfsense. Pfsense can only hand a dchp lease to traffic it sees.. To mac addresses it sees..

  • Thank you @johnpoz

    I was not saying this question had to do or not to do with PfSense. I was looking VM issues too.

    Discarding PfSense issues will help to concentrate efforts in the VM issues.

    Thank you again.

  • LAYER 8 Global Moderator

    If I get some time I can fire up a hyper-v on windows 10.. But today not looking good, got lots of real work meetings.. And tonight is football ;)

    I currently don't have it enabled - not really a fan of it ;) I normally run all my vms just on my nas. And if needed something on my pc, I would just use virtualbox. I had it up and running awhile ago to help with someone vlan question.. But in general I avoid using it ;)

    I have vmware player on my work machine - but they have that so locked down.. Your only allowed to passthru another nic to the vm, which has direct control over it.. So no bridging done, etc.

    If pfsense doesn't see the dhcp request, from mac xyz - then no its not possible for pfsense to offer it an IP to use. So concentrate on why in hyper-v your virtual machine mac is not being seen on your network that is attached to pfsense from the vm host.

Log in to reply