[Samba] Custom dns_update_list file

L. van Belle belle at samba.org
Fri Feb 11 09:53:12 UTC 2022


This should not be a big problem with a systemd networking setup. 

Small example.. 

#/etc/systemd/network/10-lan-dev-eth0.network
# This setup is for a Domain AD-DC server.
# IPV4 only.
[Match]
Name=eth0

[Network]
DHCP=no

DNSSEC=allow-downgrade
DNSSECNegativeTrustAnchors=lan

# Disable ipv6 if needed.
#IPv6PrivacyExtensions=no
#IPv6AcceptRouterAdvertisements=no
#LinkLocalAddressing=no
#LLMNR=no

# make use of systemd resolved and its setup, setup the 'search domain.'
# this MUST be set to your primary.DNSdomain.tld
Domains=primary.DNSdomain.tld

# DNS resolvers (safe to mix IPv4 and IPv6)
# The comment here is more for member servers. 
# Max 3 DNS entries. ::1 or 127.0.0.1 if you use a cacheing dns.
# if you use systemd-resolved stub (caching) dns, use 127.0.0.53 (only)
DNS=192.168.1.10
DNS=192.168.1.11
DNS=192.168.1.12

# We resolve first through the primary IP of this AD-DC.
# The google dns is use as fallback, replace these if you have more DC's
# I suggest here 2 x DNS AD-DC, 1 x DNS internet.

# IPv4 gateway and primary address.
Gateway=192.168.1.1
Address=192.168.1.201/24

Now, setup a next file. 
Same as above, change the interface names. 

# 
#/etc/systemd/network/10-lan-dev-eth0_1.network
# This setup is for a Domain AD-DC server.
# IPV4 only.
[Match]
Name=eth0:1

Set the rest and the "per" interface dns is done. 
You need routes also, 

Add [Route] in the file, like this. 

[Route]
Gateway=192.168.1.1
Destination=10.0.0.0/8

Now, with that set. What will happen.. 

A program on the server will use /etc/resolv.conf 
Systemd-resolved fills /etc/resolv.conf 
With values from 
DNS 
DOMAIN

Anything that comes in on TCP protocl, will follow above. 

Hope this helps a bit. 
Ps, have a good read in systemd-networkd, it is very usefull.

Greetz, 

Louis


> -----Oorspronkelijk bericht-----
> Van: samba [mailto:samba-bounces at lists.samba.org] Namens 
> Arnaud FLORENT via samba
> Verzonden: donderdag 10 februari 2022 10:48
> Aan: samba at lists.samba.org
> Onderwerp: Re: [Samba] Custom dns_update_list file
> 
> 
> Le 09/02/2022 à 17:50, Victor Rodriguez via samba a écrit :
> > Hello,
> Hi
> >
> > I have the need to set specific IPs in DNS to allow clients to 
> > correctly communicate with Samba. I archieve this editing 
> > samba/private/dns_update_list and replacing the A record for the 
> > domain. This works until some package update replaces it with the 
> > default one.
> >
> > Is there any way to properly set a custom dns_update_list that does 
> > not get overwritten?
> 
> on debian /ubuntu, you can try with diversion
> 
> 
> https://www.debian.org/doc/debian-policy/ap-pkg-diversions.html
> 
> >
> > I can't use the interfaces directive in smb.conf as the 
> same interface 
> > has more than one IP.
> >
> > Thanks in advance
> >
> >
> -- 
> Arnaud FLORENT
> IRIS Technologies
> 
> 
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
> 
> 




More information about the samba mailing list