[Samba] run script on domain join
Rowland Penny
rpenny at samba.org
Wed May 23 07:58:13 UTC 2018
On Wed, 23 May 2018 09:36:48 +0200
Arnaud FLORENT via samba <samba at lists.samba.org> 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 ?
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.
Rowland
More information about the samba
mailing list