Web lists-archives.com

Re: [Samba] run script on domain join




hi Roland


thanks for your help


Le 23/05/2018 à 09:58, Rowland Penny via samba a écrit :
On Wed, 23 May 2018 09:36:48 +0200
Arnaud FLORENT via samba <samba@xxxxxxxxxxxxxxx> wrote:

the host has first an address in dhcp pool between 192.168.1.100-200
(it is not known by dhcpd with a fixed ip address)


i would like to add a dhcpd record to provide always same ip to host
(ie fixed-address 192.168.1.1)

when host is joined to my samba domain


in NT PDC, i can do that with  "add machine script" in smb.conf

but in AD DC, this script is not run


so i m searching another way to run a script when a computer join the
AD DC domain

Why do you feel the computers must have a fixed ipaddress ?
it is easier to identify hosts with fixed adresses (ie allow/deny access by ip in firewall for example)

But if you must give them a fixed ipaddress, you may be able to do this
with a variation on this:

https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records_with_BIND9

That just updates a computers records in AD after a lease is granted,
but I think you should be able to use this as a basis to do what you
want.

Your script would have to check that /etc/dhcp/dhcpd.conf doesn't
already contain the computers MAC and if not add something like this:

host <shorthostname of client> {
            next-server dc.your-domain.com;
            hardware ethernet 00:02:c3:d0:e5:83; < MAC address of client
            fixed-address 192.168.1.1; < IP you require
}

It will probably be a bit more complex than this and I say it 'may'
work, because I have never tried it.
i m currently trying this method.

but it seems i can not restart dhcpd from itself to reload new record


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba