Dhcp-host Option?



  • Hi,

    Sorry, just can't find where to enter this in the GUI … :-(. I would like to use dhcp-host to set up mappings from MAC to hostname (don't want / need static IP though). The dnsmasq option is something like this,
    dhcp-host=00:01:02:03:04:05,my-host

    Has anyone done this before?

    Thanks!



  • OK, after some digging it seems that ISC DHCPD is being used, not dnsmasq for DHCP … correct?

    Is there a way to configure pfSense to use dnsmasq for DHCP (and then this option will work)?

    Thanks!


  • LAYER 8 Global Moderator

    Can't you just set it in the gui here

    if you don't set IP then host name can still be handed out with IP from the pool - isn't this what your after?




  • Sorry for the delay in getting back to you! I didn't seem to get a notify of the reply for some reason, so didn't see this … :(.

    I did try this, but then in DHCP leases I don't see an IP address (though the client does get one) - and then also DNS lookup fails. Is this expected?

    Thanks!


  • LAYER 8 Global Moderator

    what are you handing it for dns, what did it get for an IP?  Did the hostname work?



  • Hi,

    Actually, it's sort of odd. I see two entries now in the DHCP leases table (for this MAC address). One shows static, with the right name, but no IP address. The other shows as active, has the right IP address, but not the name. And trying to resolve this name doesn't work.

    Thoughts?

    Thanks!


  • LAYER 8 Global Moderator

    clear the leases and let it get a new static lease you setup.



  • Hi,

    Did a system upgrade, complete reboot - still two items in the table (one static with the right name but no IP address, the other with an IP address and an incorrect name). And DNS lookup (drill) still fails.

    Thoughts?

    Thanks!

    PS: The times in the DHCP leases table are not in my current TZ also.


  • LAYER 8 Global Moderator

    So I have multiple static reservations..

    So static would not show tz,  Does the client get the right name you want to give it?  Why can you not give it in IP in that reservation?

    Can you post what your seeing please

    In the forwarder do you have it checked to register dhcp leases?

    So here is a static that is active, there are no other leases listed for this mac.




  • Sure, attached. Funny, but the two lines of interest show up beside each other (just luck).

    DNS doesn't work, and you can see the MAC address on two lines. As above (in this thread), no IP address is entered in the static address. The client does get an IP address, but name resolution to it does not work.

    Thanks!



  • LAYER 8 Global Moderator

    Well I see that it used the name android-number

    So still trying to understand what your trying to do? Did android see that it got name tablet-RMo, is it using that name?  What name do you think should be in dns?

    Why don't you assign the static a specific IP< and then setup a dns name whatever you want it to be to that IP you hand out?



  • Hi,

    I just want the name and MAC to be associated, but then assign an dynamic IP and let the name resolve - don't want to manually set all the IP addresses on the network.

    This worked / works fine with dnsmask, just not dhcpd (likely me though).

    Thanks!


  • LAYER 8 Global Moderator

    Still a bit confused at what your after..  So my son's phone is android.  And I have a fire around here somewhere I could turn on and check what it puts in the lease table

    Ummm if your going to spend time putting in info to hand out name, why not just hand out an IP and create the dns record?

    Can you not set the phone to register its name - I will take a look at my sons phone and see - notice how my phone registers its name in the dhcp leases.  Still what exactly are you wanting to accomplish - why does it matter if phones have specific names.  Can't you just look them up in the dhcp lease table by mac if need the IP of a phone?  Why do they need to resolve via dns with some special name - notice the android resolves via dns with the name it registered.

    I think android makes it a bit difficult to change the name, have to be rooted.  But let me check my son's phone when he wakes up to see if can change it under settings, developer.

    hmmm - trying to add attachments getting 500 internal error.  Will try again latter to attach my examples showing what I see for devices..



  • NP, thanks for trying! And you're right - Android devices are difficult to change hostnames (as you say, have to be rooted).

    I'll just hard-code an IP address - was trying to avoid that, but it's not a real big issue by any means.

    Thanks again!



  • Finally getting back to this … :(

    This is still quite a pain - as I have 20+ clients (family tablets, phones, PC's, WiFi AP's, etc.) ... and to assign an IP to each one, I need to find every one of them and reset them (as their new IP has to be outside of the pool).

    Is there really no way to just have a mapping from MAC to hostname, and let DHCP hand out IP addresses as it wants?

    Thanks!


  • LAYER 8 Global Moderator

    "and to assign an IP to each one, I need to find every one of them and reset them"

    What??  Reset them?  Let them grab a lease..  Then just create a reservation for them from that lease, then use whatever name and IP you want.. So for example here is my sons phone.

    I click that button - and next time it gets or renews it will use the new IP.  And the name I create will be used for dns, etc..




  • Hi,

    But the IP they currently have is from the pool, and the static IP has to be from outside the pool … so I have to change the IP on the pfSense end (to add the entry), but then it doesn't match the IP the client has ... no?

    Thanks!


  • LAYER 8 Global Moderator

    It will change when it goes to renew.. I am not understanding what your concern is?

    See how my sons phone had .225 before - this is inside my scope.. I created a reservation calling it just android.. See it got the new IP .207 which is outside my scope and I can resolve it via the name I used.

    Worse thing that happens if you have a stale lease that will just time out if client doesn't properly release the old one..




  • Makes sense. I guess my real issue is that I have a history of bandwidthd data (~ 3 months worth). By having to change the IP addresses (for the same client) I lose the legacy data. Just something I have to live with I guess. I admit, I'm used to dnsmasq, and it did have this capability (to just map a MAC to a hostname, and still run DHCP).

    Thanks for the help!!!


  • LAYER 8 Global Moderator

    who says you have to loose the data, just change the legacy data to reflect the new IP.  I would think if you were wanting to track IPs bandwidth, and have been doing so for 3 months that you would of had reservations in for every device you wanted to track from the get go.

    If you just let clients get a lease, there is nothing saying that couldn't change at some point in the future, etc.  Only way to be sure a client maintains a IP is to create a reservation or static setup the IP on the box, etc..



  • Yep, agreed - likely easier to just purge the data, start again (as there are thousands of lines in the table, don't really want to change each line …  ;)).

    Thanks for all the help!


Log in to reply