Jacques Grillot
2015-09-22 09:03:55 UTC
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 :)
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:***@matooma.com]<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:***@matooma.com] <https://twitter.com/MatoomaM2M> [cid:***@matooma.com] <https://www.facebook.com/matoomam2m> [cid:***@matooma.com] <https://www.linkedin.com/company/matooma> [cid:***@matooma.com] <http://www.viadeo.com/fr/company/matooma-sas> [cid:***@matooma.com] <https://plus.google.com/+Matooma/>
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 :)
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:***@matooma.com]<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:***@matooma.com] <https://twitter.com/MatoomaM2M> [cid:***@matooma.com] <https://www.facebook.com/matoomam2m> [cid:***@matooma.com] <https://www.linkedin.com/company/matooma> [cid:***@matooma.com] <http://www.viadeo.com/fr/company/matooma-sas> [cid:***@matooma.com] <https://plus.google.com/+Matooma/>