isc dhcp server weird hostname option value

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

isc dhcp server weird hostname option value

Radoslav Pešek

Hi all,

I sent this email few weeks ago (without being subscribed here), and didn't receive any reply, nor do I see it in lists archive. So I write once again after subscription, hope it will work now.

~~~~

My isc dhcp server behaves strangely - it sends some clients dhcp hostname option value which I don't know where it is getting it from.

It's on Debian 8.5, version 4.3.1. It's in failover mode.

I'm using dynamic hostname generation for some clients based on last byte of their mac address:

set mac_6 = suffix(concat("0", binary-to-ascii(16, 8, "", substring(hardware, 6, 1))), 2);
ddns-hostname = concat("vm1", mac_6);
option host-name = config-option server.ddns-hostname;

So for example client with mac address ending 02 should get hostname vm102 - and it seems to work correctly - I added logging to my dhcp config and I see in log file both option host-name and config-option server.ddns-hostname set to vm102.

I also see in dhcpd.leases

set mac_6 = "02";
client-hostname "vm102";

But when I run tcpdump for this client, I see

Hostname Option 12, length 5: "vm121"

and at least once it changed to vm103.

So where is it getting it from? What are the sources for this option when dhcp server sends DHCPOFFER or DHCPACK?

It works after dhcp server restart, but then it starts again after a whlie.

I tried to read isc-dhcp-server's source code but got bit lost as it was hard to follow.

Thanks for any help.

Rado.



_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: isc dhcp server weird hostname option value

Bill Shirley-2
I have a some devices that don't provide a hostname.  Dynamic DNS
doesn't get updated without a hostname.  I use:
# ------------------------------------------------------------------------------
class "NoName" {
        match if not (
                exists server.ddns-hostname
                or exists fqdn.hostname
                or exists host-name
        );

        ddns-hostname = concat("NoName-", binary-to-ascii(16, 8, "", substring(hardware, 4, 3)));
        option dhcp.host-name = config-option server.ddns-hostname;
#       option fqdn.hostname = config-option server.ddns-hostname;
}

# ------------------------------------------------------------------------------
to create a hostname for them.  It uses the last 3 bytes of the MAC address
as part of the host name.  Note: I'm using 'option dhcp.host-name' instead
of 'option host-name'.  I really don't know if that matters.  You might also
try 'option fqdn.hostname'.

You can even confine them to a pool:
        pool {
                deny dynamic bootp clients;
                allow members of "NoName";  
.
.
        }


HTH,
Bill

On 6/23/2017 7:28 AM, Radoslav Pešek wrote:

Hi all,

I sent this email few weeks ago (without being subscribed here), and didn't receive any reply, nor do I see it in lists archive. So I write once again after subscription, hope it will work now.

~~~~

My isc dhcp server behaves strangely - it sends some clients dhcp hostname option value which I don't know where it is getting it from.

It's on Debian 8.5, version 4.3.1. It's in failover mode.

I'm using dynamic hostname generation for some clients based on last byte of their mac address:

set mac_6 = suffix(concat("0", binary-to-ascii(16, 8, "", substring(hardware, 6, 1))), 2);
ddns-hostname = concat("vm1", mac_6);
option host-name = config-option server.ddns-hostname;

So for example client with mac address ending 02 should get hostname vm102 - and it seems to work correctly - I added logging to my dhcp config and I see in log file both option host-name and config-option server.ddns-hostname set to vm102.

I also see in dhcpd.leases

set mac_6 = "02";
client-hostname "vm102";

But when I run tcpdump for this client, I see

Hostname Option 12, length 5: "vm121"

and at least once it changed to vm103.

So where is it getting it from? What are the sources for this option when dhcp server sends DHCPOFFER or DHCPACK?

It works after dhcp server restart, but then it starts again after a whlie.

I tried to read isc-dhcp-server's source code but got bit lost as it was hard to follow.

Thanks for any help.

Rado.




_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: isc dhcp server weird hostname option value

Radoslav Pešek

Thanks for your reply.

What I found si that you don't need any of those three options - option host-name caused problems, option dhcp.host-name didn't help but with option fqdn.hostname it seemed to work, but then I read man pages for dhcp-options and they say:

option fqdn.hostname --never set--;

         This  option should never be set, but it can be read back using the option and config-option operators in an expression, in which case it returns
         the first label in the fqdn.fqdn suboption - for example, if the value of fqdn.fqdn is "foo.example.com.", then fqdn.hostname will be "foo".

so I tried it without and everything seems to work (DDNS update included). So now I just have

         set mac_6 = suffix(concat("0", binary-to-ascii(16, 8, "", substring(hardware, 6, 1))), 2);
         ddns-hostname = concat("vm1", mac_6);

I don't know if it's correct so would appreciate any insight.

But I have another issue, which I initially thought is related to this, so would appreciate any halp there too - https://lists.isc.org/pipermail/dhcp-users/2017-June/020656.html.

Thanks again, Rado.


On 06/23/2017 04:23 PM, Bill Shirley wrote:
I have a some devices that don't provide a hostname.  Dynamic DNS
doesn't get updated without a hostname.  I use:
# ------------------------------------------------------------------------------
class "NoName" {
        match if not (
                exists server.ddns-hostname
                or exists fqdn.hostname
                or exists host-name
        );

        ddns-hostname = concat("NoName-", binary-to-ascii(16, 8, "", substring(hardware, 4, 3)));
        option dhcp.host-name = config-option server.ddns-hostname;
#       option fqdn.hostname = config-option server.ddns-hostname;
}

# ------------------------------------------------------------------------------
to create a hostname for them.  It uses the last 3 bytes of the MAC address
as part of the host name.  Note: I'm using 'option dhcp.host-name' instead
of 'option host-name'.  I really don't know if that matters.  You might also
try 'option fqdn.hostname'.

You can even confine them to a pool:
        pool {
                deny dynamic bootp clients;
                allow members of "NoName";  
.
.
        }


HTH,
Bill

On 6/23/2017 7:28 AM, Radoslav Pešek wrote:

Hi all,

I sent this email few weeks ago (without being subscribed here), and didn't receive any reply, nor do I see it in lists archive. So I write once again after subscription, hope it will work now.

~~~~

My isc dhcp server behaves strangely - it sends some clients dhcp hostname option value which I don't know where it is getting it from.

It's on Debian 8.5, version 4.3.1. It's in failover mode.

I'm using dynamic hostname generation for some clients based on last byte of their mac address:

set mac_6 = suffix(concat("0", binary-to-ascii(16, 8, "", substring(hardware, 6, 1))), 2);
ddns-hostname = concat("vm1", mac_6);
option host-name = config-option server.ddns-hostname;

So for example client with mac address ending 02 should get hostname vm102 - and it seems to work correctly - I added logging to my dhcp config and I see in log file both option host-name and config-option server.ddns-hostname set to vm102.

I also see in dhcpd.leases

set mac_6 = "02";
client-hostname "vm102";

But when I run tcpdump for this client, I see

Hostname Option 12, length 5: "vm121"

and at least once it changed to vm103.

So where is it getting it from? What are the sources for this option when dhcp server sends DHCPOFFER or DHCPACK?

It works after dhcp server restart, but then it starts again after a whlie.

I tried to read isc-dhcp-server's source code but got bit lost as it was hard to follow.

Thanks for any help.

Rado.




_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users



_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Loading...