[Samba] How to automatically store the macAddress in AD

Rowland Penny rpenny at samba.org
Wed Mar 20 14:53:28 UTC 2019


On Wed, 20 Mar 2019 14:27:50 +0000
Rowland Penny via samba <samba at lists.samba.org> wrote:

> On Wed, 20 Mar 2019 14:40:22 +0100
> "Pierre, BRIEC via samba" <samba at lists.samba.org> wrote:
> 
> > Thanks Rowland for your modification.
> > 
> > The process is working fine as the information is added but is wrong
> > 
> > 
> > the macaddress from DHCPREQUEST is 90:1b:0e:bb:12:8a
> > and the macaddress in AD is: 1:90:1b:e:bb:12:8a (have you noticed
> > the missing 0 and  1: is added at the beginning)
> > 
> 
> No I hadn't, but I don't think it has anything to do with script, I
> think DHCP is sending the wrong data:
> 
> Commit: IP: 192.168.0.88 DHCID: 1:ec:8:6b:c:cb:c2 Name: devstation
> 
> But, the request shows this:
> 
> DHCPREQUEST for 192.168.0.88 from ec:08:6b:0c:cb:c2 (devstation) via
> eth0
> 
> 1:ec:8:6b:c:cb:c2 != ec:08:6b:0c:cb:c2
> 
> Let me look into this, I could be some time ;-)
> 
> It doesn't really matter for the scripts original purpose, but it does
> for your purpose.
> 
> Rowland
> 

OK, that was easier to fix than I thought ;-)

It was the dhcpd.conf, open /etc/dhcp/dhcpd.conf in your favourite
editor and find this line:

set ClientDHCID = binary-to-ascii(16, 8, ":", hardware);

It appears twice.

Replace with this:

set ClientDHCID = concat (
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,1,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,2,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,3,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,4,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,5,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,6,1))),2)
);

Restart the dhcp server.

With this:

Commit: IP: 192.168.0.189 DHCID: 08:00:27:9c:28:61 Name: testcen7mem

DHCPREQUEST for 192.168.0.189 from 08:00:27:9c:28:61 (testcen7mem) via
eth0

Rowland



More information about the samba mailing list