remove DNS A record from internal samba PDC DNS with samba-tool

I would like to remove one interface (eno0s3, 10.10.37.166) from samba PDC (samba 4.10)

I added to my smb.conf:

    bind interfaces only = yes
    interfaces = lo enp0s8

enp0s8 is 10.21.0.2. This is what I have now:

[root@site-ad ~]# samba-tool dns query localhost site.example.pl @ ALL -U administrator
Password for [example\administrator]:
  Name=, Records=4, Children=0
    SOA: serial=64, refresh=900, retry=600, expire=86400, minttl=3600, ns=site-ad.site.example.pl., email=hostmaster.site.example.pl. (flags=600000f0, serial=64, ttl=3600)
    NS: site-ad.site.example.pl. (flags=600000f0, serial=110, ttl=900)
    A: 10.10.37.166 (flags=600000f0, serial=110, ttl=900)
    A: 10.21.0.2 (flags=600000f0, serial=110, ttl=900)
  Name=_msdcs, Records=0, Children=0
  Name=_sites, Records=0, Children=1
  Name=_tcp, Records=0, Children=4
  Name=_udp, Records=0, Children=2
  Name=DomainDnsZones, Records=0, Children=2
  Name=ForestDnsZones, Records=0, Children=2
  Name=site-ad, Records=2, Children=0
    A: 10.10.37.166 (flags=f0, serial=110, ttl=900)
    A: 10.21.0.2 (flags=f0, serial=110, ttl=900)

Tried:

samba_dnsupdate --verbose --all-names --current-ip=10.21.0.2

And effect is that only 10.21.0.2 is added to dns_update_cache:

Rebuilding cache at /var/lib/samba/private/dns_update_cache
Adding A site-ad.site.example.pl 10.21.0.2 to dns_update_cache
Adding NS site.example.pl site-ad.site.example.pl to dns_update_cache
Adding NS _msdcs.site.example.pl site-ad.site.example.pl to dns_update_cache
Adding A site.example.pl 10.21.0.2 to dns_update_cache
[lot of SRV records below....]

...but samba-tool dns query still returns 10.10.37.166 A record as above.

Tried to use dns delete with zone set to ".". Error:

[root@site-ad ~]# samba-tool dns delete localhost . site-ad.example.pl A 10.10.37.166 -U administrator
Password for [example\administrator]:
ERROR(runtime): uncaught exception - (1383, 'WERR_INTERNAL_DB_ERROR')
  File "/usr/lib/python3.7/site-packages/samba/netcmd/__init__.py", line 185, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/samba/netcmd/dns.py", line 1070, in run
    raise e
  File "/usr/lib/python3.7/site-packages/samba/netcmd/dns.py", line 1066, in run
    del_rec_buf)

Is there any other way to remove this record using samba utilities?


Solution 1:

Just figured it out. zone should be set to Realm:

samba-tool dns delete localhost site.example.pl site-ad.site.example.pl A 10.10.37.166 -U administrator
samba-tool dns delete localhost site.example.pl site.example.pl A 10.10.37.166 -U administrator