DHCP static mapped hostname to DNS resolver, without specifying IP



  • So here’s the scenario:

    • Lots of internal devices on network that I don’t have much control over. Let’s use one particular IOT device for this example, which is a set of 6 Wemo switches
    • I cannot control the hostname config or client identifier on these devices directly
    • I don’t really care what the device calls itself (so pushing a hostname over DHCP isn’t really needed, but is fine)
    • Each device pushes “wemo” as its hostname to DHCP

    I’m hoping to setup DHCP static reservations for hostnames based on MAC, but I do not want to have to manually specify ip addresses (so let them assign from a pool).

    If I set a static IP and hostname, the hostname appears to get pushed to the device (which is fine), and the name is registered in my local resolver DNS per the “Enable registration of DHCP client names in DNS” option. This does override any client supplied hostname.

    But if I remove the static IP from the DHCP reservation (field says “If no IPv4 address is given, one will be dynamically allocated from the pool”), then it appears that the DHCP reservation has no meaning at this point. The hostname isn’t pushed to the client (which I don’t really care about), but more importantly there is no override of hostname for my DNS entry. The effect is that I have 6 Wemo devices all registered as “wemo” in DNS (I appear to get a random one when looking up “wemo”). And no device gets a DNS entry for the static hostname that I’m trying to assign to each MAC.

    I think my issue is more DHCP server side than DNS, as best I can tell, a hostname entry in a static DHCP reservation with no IP given, has no meaning.

    • I don’t want to have to set a manual IP for each device. I could, but this just doesn’t seem as clean as letting them grab an IP from the pool, but mapping a DNS entry to particular devices if I see them (based on their MAC address). Any way to do what I’m looking to do?


  • DNS provides an IP address only, not MAC.  When a device queries a host name, it expects an IP address back and then uses that IP address to determine whether the destination is on the local network or not and then handles it appropriately.  There is nothing that supports what you want of going directly to a MAC address.



  • @JKnott:

    DNS provides an IP address only, not MAC.  When a device queries a host name, it expects an IP address back and then uses that IP address to determine whether the destination is on the local network or not and then handles it appropriately.  There is nothing that supports what you want of going directly to a MAC address.

    I’m not trying to go directly to MAC, but I want the DHCP server to take the MAC->IP static mapping and then push the entry to DNS. It does this just fine when I have a static IP in DHCP, but not when I want it to assign an address from the pool.

    To be clear…

    DOES work:

    • client asks for DHCP address, pushes hostname
    • DHCP server assigns address from pool, takes client hostname and pushes DNS entry for this that resolves in DNS resolver

    DOES work:

    • client asks for DHCP address, gets static IP and assigned hostname
    • DHCP server assigns static IP from reservation, pushes static reservation hostname to DNS resolver

    DOES NOT work:

    • client asks for DHCP address
    • DHCP server assigns address from pool
    • DHCP server pushes static hostname configured in reservation (based on MAC), and pushes this hostname to DNS resolver

    What doesn’t appear to have any effect is configuring an IP-less static DHCP reservation with a hostname.



  • And let me get to where this is going, in case there’s another way.

    • What I’m really trying to do is to map known devices so they are easier to report in various pfsense areas.
    • I’m also hoping to do this without having to manually assign IPs to every device. (Although if this ends up being the only way, so be it, but bleh.)
    • I do not have control of what many of these devices self-report as a client identifier or hostname. (which may be nothing, or may repeat, as in the case of my wemos)

    I’m open to other ways to do this. It seems to me that DNS is probably the most straightforward way to get this done, so that reverse lookups just work for anything trying to identify an IP.



  • I’ve been trying to set this up too.

    Same situation: I have a tonne of devices which supply unfriendly hostnames when doing a DHCP request.  However, I don’t care what IP they get.

    When I used to run an isc-dhcpd instance manually, I’d configure DHCPD to hand out an IP from the pool, but use a pre-set hostname for each device MAC.

    I think this is actually a pfSense bug. It’s a perfectly valid configuration for a DHCP server, and even (as the OP mentions), the text below the IP Address field on the Static DHCP Mapping config page describes the desired behaviour.

    What actually happens is that the DHCP Leases page shows the static mappings as expected, without IP addresses.  When the host collects an IP, it does not update the IP field against the mapping as expected.  Instead, an additional row appears with an identical MAC but an empty hostname/description.  I’ve attached a screenshot.

    The static-defined hostname is not resolvable, but also, the device-supplied hostname is not displayed in the Leases list.




  • Hi
    Same need and some behavior here  :’( Anyone made any progress ?



  • I have set up pfSense to use (relay to)  my Linux isc-dhcpd server

    Now i can do all the fancy stuff there.

    /Bingo



 

© Copyright 2002 - 2018 Rubicon Communications, LLC | Privacy Policy