DHCP v4.2.5 - How to manage hostname ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DHCP v4.2.5 - How to manage hostname ?

Jacques Grillot

Bonjour everyone,

 

I work for a company that supplies services around connected devices.

I build a new infrastructure for our customers  in which there is a DHCP server (v4.2.5 provides by Centos 7.1).

I need these devices register dynamically with a hostname in our DNS.

 

The constraint is that many devices send no information concerning their hostname (in fact, they have not this information).

What I whished was to use « host-identifier » option (which is the MSISDN, that is the phone number of the device) and use it as a parameter to build a hostname.

I groped a little bit at random and I thought of finding a solution with the conditional instructions but it dosn’t work either.

 

This in one configuration file (/etc/dhcp/subnets/customer001.conf :

 

----- BEGIN -----

shared-network customer001 {

        if exists dhcp-client-identifier {

                option dhcp-client-identifier = option dhcp-client-identifier;

        }

 

        if exists host-name {

                option host-name = option host-name;

        }

        else if exists dhcp-client-identifier {

                option host-name = option dhcp-client-identifier;

        }

 

        zone device.m2m. {

                primary 10.0.0.211;

                secondary 10.0.0.212, 10.0.0.216;

                key DDNS_UPDATE;

        }

 

        zone 10.in-addr.arpa. {

                primary 10.0.0.211;

                secondary 10.0.0.212, 10.0.0.216;

                key DDNS_UPDATE;

        }

 

        deny unknown-clients ;

        ddns-rev-domainname "in-addr.arpa.";

        ddns-updates on;

        ddns-update-style interim;

        ignore client-updates;

        infinite-is-reserved on;

        do-forward-updates on;

        option domain-name-servers 10.0.0.211, 10.0.0.212;

        update-static-leases on;

        use-host-decl-names on;

        ddns-domainname "device.m2m.";

        default-lease-time 604800;

        max-lease-time 604800;

 

        subnet 10.1.0.0 netmask 255.255.0.0 {

                range 10.1.0.2 10.1.255.250;

                option routers 10.1.255.252;

                option subnet-mask 255.255.0.0;

                option broadcast-address 10.1.255.255;

        }

 

        subnet 10.129.0.0 netmask 255.255.0.0 {

                range 10.129.0.2 10.129.255.250;

                option routers 10.129.255.252;

                option subnet-mask 255.255.0.0;

                option broadcast-address 10.129.255.255;

        }

}

 

host 00033611987141 {

        if exists host-name {

                option host-name = option host-name;

        }

        else if exists dhcp-client-identifier {

                option host-name = option dhcp-client-identifier;

        }

 

        fixed-address 10.1.0.3;

        option dhcp-client-identifier "\00033123456789";

}

 

host 00033625232212 {

        if exists host-name {

                option host-name = option host-name;

        }

        else if exists dhcp-client-identifier {

                option host-name = option dhcp-client-identifier;

        }

 

        fixed-address 10.1.0.4;

        option dhcp-client-identifier "\000330987654321";

}

----- END -----

 

Some help will be appreciate J

 

Regards,

 

Jacques

 

 

Jacques GRILLOT
Administrateur Réseaux et Systèmes
+33 (0) 4 88 36 07 52
+33 (0) 6 08 33 06 02

 

cid:part1.09070605.03080102@matooma.com

Siège social : Cap Oméga Rond-point Benjamin Franklin
34960 Montpellier Cedex 2

Agence de Paris : Le village 55 Rue de la Boétie 75008 Paris

Restons connecté !     cid:part3.09030806.03030500@matooma.com    cid:part5.05060705.08030108@matooma.com    cid:part7.01080909.08020300@matooma.com    cid:part9.09010008.08030004@matooma.com    cid:part11.09010908.03060004@matooma.com

 

 


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

Re: DHCP v4.2.5 - How to manage hostname ?

Bill Shirley
Here are couple of working examples using hardware address:
# ------------------------------------------------------------------------------
class "Pack.1"  {
         match hardware;
         set member_of = "Pack.1";
         option log-servers      10.96.0.9;
         option domain-name      "pack1.example.com";
         ddns-domainname         "pack1.example.com";
}
subclass "Pack.1"       1:00:01:E6:50:AD:0B     { ddns-hostname = "ln1prt01"; }         # ln1prt01 - 2014-09-15
subclass "Pack.1"       1:00:1B:78:E6:A7:91     { ddns-hostname = "ln1lbl01"; }         # ln1lbl01
# ------------------------------------------------------------------------------

# ------------------------------------------------------------------------------
# create a name for DNS if client doesn't send a hostname
class "NoName" {
         match if not (
                 exists server.ddns-hostname
                 or exists fqdn.hostname
                 or exists host-name
         );
         set member_of = "NoName";

         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;
}
# ------------------------------------------------------------------------------

Then inside the subnet declaration:
#               ----------------------------------------------------------------
                 pool {
                         failover peer "dhcp-failover";
                         set pool_type = "Pack.1";
                         allow members of "Pack.1";
                         deny dynamic bootp clients;
                         option routers          10.96.0.9;
                         range 10.100.1.32       10.100.1.253;
                 }
# ----------------------------------------------------------------


ddns-hostname is what you want to set so that it will update the DNS.

Bill


On 9/22/2015 5:03 AM, Jacques Grillot wrote:

> Bonjour everyone,
>
> I work for a company that supplies services around connected devices.
>
> I build a new infrastructure for our customers  in which there is a DHCP server (v4.2.5 provides by Centos 7.1).
>
> I need these devices register dynamically with a hostname in our DNS.
>
> The constraint is that many devices send no information concerning their hostname (in fact, they have not this information).
>
> What I whished was to use « host-identifier » option (which is the MSISDN, that is the phone number of the device) and use it as
> a parameter to build a hostname.
>
> I groped a little bit at random and I thought of finding a solution with the conditional instructions but it dosn’t work either.
>
> This in one configuration file (/etc/dhcp/subnets/customer001.conf :
>
> ----- BEGIN -----
>
> shared-network customer001 {
>
>          if exists dhcp-client-identifier {
>
>                  option dhcp-client-identifier = option dhcp-client-identifier;
>
>          }
>
>          if exists host-name {
>
>                  option host-name = option host-name;
>
>          }
>
>          else if exists dhcp-client-identifier {
>
>                  option host-name = option dhcp-client-identifier;
>
>          }
>
>          zone device.m2m. {
>
>                  primary 10.0.0.211;
>
>                  secondary 10.0.0.212, 10.0.0.216;
>
>                  key DDNS_UPDATE;
>
>          }
>
>          zone 10.in-addr.arpa. {
>
>                  primary 10.0.0.211;
>
>                  secondary 10.0.0.212, 10.0.0.216;
>
>                  key DDNS_UPDATE;
>
>          }
>
>          deny unknown-clients ;
>
>          ddns-rev-domainname "in-addr.arpa.";
>
>          ddns-updates on;
>
>          ddns-update-style interim;
>
>          ignore client-updates;
>
>          infinite-is-reserved on;
>
>          do-forward-updates on;
>
>          option domain-name-servers 10.0.0.211, 10.0.0.212;
>
>          update-static-leases on;
>
>          use-host-decl-names on;
>
>          ddns-domainname "device.m2m.";
>
>          default-lease-time 604800;
>
>          max-lease-time 604800;
>
>          subnet 10.1.0.0 netmask 255.255.0.0 {
>
>                  range 10.1.0.2 10.1.255.250;
>
>                  option routers 10.1.255.252;
>
>                  option subnet-mask 255.255.0.0;
>
>                  option broadcast-address 10.1.255.255;
>
>          }
>
>          subnet 10.129.0.0 netmask 255.255.0.0 {
>
>                  range 10.129.0.2 10.129.255.250;
>
>                  option routers 10.129.255.252;
>
>                  option subnet-mask 255.255.0.0;
>
>                  option broadcast-address 10.129.255.255;
>
>          }
>
> }
>
> host 00033611987141 {
>
>          if exists host-name {
>
>                  option host-name = option host-name;
>
>          }
>
>          else if exists dhcp-client-identifier {
>
>                  option host-name = option dhcp-client-identifier;
>
>          }
>
>          fixed-address 10.1.0.3;
>
>          option dhcp-client-identifier "\00033123456789";
>
> }
>
> host 00033625232212 {
>
>          if exists host-name {
>
>                  option host-name = option host-name;
>
>          }
>
>          else if exists dhcp-client-identifier {
>
>                  option host-name = option dhcp-client-identifier;
>
>          }
>
>          fixed-address 10.1.0.4;
>
>          option dhcp-client-identifier "\000330987654321";
>
> }
>
> ----- END -----
>
> Some help will be appreciate J
>
> Regards,
>
> Jacques
>
> *Jacques GRILLOT*
> Administrateur Réseaux et Systèmes
> +33 (0) 4 88 36 07 52
> +33 (0) 6 08 33 06 02
>
> cid:[hidden email] <http://www.matooma.fr/>
>
>
>
> *Siège social*: Cap Oméga Rond-point Benjamin Franklin
> 34960 Montpellier Cedex 2
>
> *Agence de Paris*: Le village 55 Rue de la Boétie 75008 Paris
>
> Restons connecté ! cid:[hidden email]
> <https://twitter.com/MatoomaM2M>cid:[hidden email]
> <https://www.facebook.com/matoomam2m>cid:[hidden email]
> <https://www.linkedin.com/company/matooma>cid:[hidden email]
> <http://www.viadeo.com/fr/company/matooma-sas>cid:[hidden email] <https://plus.google.com/+Matooma/>
>
>
>
> _______________________________________________
> 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