A Windows Domain on Linux Without Windows Server. Part 1: A Windows Domain on Two Linux Servers
All parts of the series “A Windows Domain on Linux Without Windows Server”Suppose everyone in a company uses Windows and the main reason for running Windows Server is the domain. How much would two domain controllers cost? Counting servers is only the start. Windows Server Standard and Datacenter are licensed by core, and the edition determines how many Windows Server virtual machines those licenses cover. The estimate also needs Windows Server Client Access Licenses (CALs), counted per user or per device. Microsoft’s Windows Server licensing terms.
This series tests whether Linux can provide a familiar infrastructure for Windows workstations without buying Windows Server licenses or Windows Server CALs for domain access. Active Directory is a good test case: it is one of the strongest reasons to run Windows Server. The desktops will stay on Windows, while Samba on Linux will run the domain controllers. An employee should be able to sign in with a domain account, open a mapped drive, and connect to a database without entering a password again. Can an administrator manage the domain with familiar Windows tools and apply Group Policy? What keeps working when one controller goes offline?
Part 1 covers domain sign-in. We will create the domain on Linux, join a Windows 11 workstation, and sign in as an employee.
The lab
| Machine | Address | Role in this part |
|---|---|---|
| Gateway | 192.168.217.1 | Internet access |
| DC1 | 192.168.217.10 | First domain controller, DNS, and domain time |
| LAB-W11 | 192.168.217.20 | Windows 11 Pro workstation for testing domain sign-in |
| DC2 | 192.168.217.11 | Second domain controller and DNS server |
Start with a working gateway and a clean installation of Ubuntu Server 26.04 on DC1. Once the domain is ready, join the Windows workstation, then add DC2. All machines share the 192.168.217.0/24 segment, and each domain member has one network interface. Use static addresses for now. The Ubuntu 26.04.1 installation used here ships Samba 4.23.6. The DNS domain is ad.example.test and its short name is ADLAB.
The first domain controller
Run the commands on the console of the new Ubuntu installation on DC1. Give it a permanent name and address before provisioning the directory. Provisioning happens once per new forest. DC2 will join the existing domain later.
Set the controller’s name and address
Give DC1 the static address 192.168.217.10/24 and default gateway 192.168.217.1. Before the domain exists, use an external DNS resolver so Ubuntu can install packages. The example uses the public resolver 1.1.1.1. If the network already has a recursive resolver, use its address.
Identify DC1’s network interface. Its name belongs in the ethernets section of the Netplan file.
$ ip -br link
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eth0 UP 00:15:5d:02:a9:08 <BROADCAST,MULTICAST,UP,LOWER_UP>
The first column lists interface names. lo is the loopback interface. DC1 has one network adapter, called eth0 on the second line. If yours is called ens18, for example, substitute that name for eth0 below.
Find the network configuration file. List the Netplan files on the server.
$ ls /etc/netplan/
50-cloud-init.yaml
The clean Ubuntu 26.04.1 cloud image lists one file, 50-cloud-init.yaml, so edit /etc/netplan/50-cloud-init.yaml. Other installations may use a different name. If several files are present, look for the adapter’s name or MAC address under ethernets.
If the adapter has dhcp4: true, change it to dhcp4: false so it stops requesting a lease once the static address is set.
Set DC1’s address. Open the file identified above.
$ sudoedit /etc/netplan/50-cloud-init.yaml
Enter 192.168.217.10/24 and gateway 192.168.217.1 for the lab interface. The example uses eth0. If the existing file selects the adapter with match, keep that definition and update the address, route, and DNS settings inside it.
network:
version: 2
ethernets:
eth0:
addresses: [192.168.217.10/24]
routes:
- to: default
via: 192.168.217.1
nameservers:
addresses: [1.1.1.1]
Apply the network settings from DC1’s console.
$ sudo netplan try
Do you want to keep these settings?
Netplan asks for confirmation. During the countdown, use a second console to check the address and route as shown below. If both are correct, return to the first console and press Enter.
Check which interface received the address.
$ ip -br -4 addr
lo UNKNOWN 127.0.0.1/8
eth0 UP 192.168.217.10/24
The line for eth0 should contain 192.168.217.10/24.
Check the default gateway.
$ ip route show default
default via 192.168.217.1 dev eth0 proto static
The address after via is the gateway, .1. The name after dev is the same interface, eth0. Confirm the Netplan changes now.
Set the controller’s fully qualified domain name.
$ sudo hostnamectl set-hostname dc1.ad.example.test
The command produces no output on success.
Associate DC1’s full and short names with its address.
$ sudoedit /etc/hosts
Keep the localhost entry, remove any old mapping of DC1’s name to 127.0.1.1, and add this line:
192.168.217.10 dc1.ad.example.test dc1
Check the entry specifically in the local hosts file. Domain DNS does not exist yet.
$ getent -s files hosts dc1.ad.example.test
192.168.217.10 dc1.ad.example.test dc1
The first field is the lab address, followed by the full and short names. We will disable systemd-resolved once Samba starts answering DNS queries.
Check the fully qualified name Ubuntu itself uses.
$ hostname -f
dc1.ad.example.test
This will be the name of the first controller.
Check that traffic to the external resolver will use the lab gateway.
$ ip route get 1.1.1.1
1.1.1.1 via 192.168.217.1 dev eth0 src 192.168.217.10 uid 1000
cache
On the first line, via identifies the gateway and src identifies DC1’s source address. This shows the selected route. A DNS query after Samba starts will test the resolver itself.
Install the Ubuntu packages and configure the services
Refresh the package index.
$ sudo apt update
Wait for the index downloads to finish without errors.
Install the packages for the controller role.
$ sudo apt install samba-ad-dc krb5-user dnsutils smbclient chrony
…
Setting up samba-ad-dc (2:4.23.6+dfsg-1ubuntu2.2) ...
…
The Setting up samba-ad-dc line shows that Ubuntu reached the controller package’s configuration step. The version suffix depends on installed Ubuntu updates. Wait for the shell prompt.
Prepare the services for the domain controller role. The standalone instances of smbd, nmbd, and winbind should be stopped on DC1.
Stop the standalone Samba services.
$ sudo systemctl disable --now smbd nmbd winbind
Once stopped, these instances should no longer handle requests.
Prevent them from starting separately on this controller.
$ sudo systemctl mask smbd nmbd winbind
Expect masked for each of the three units.
Check the installed Samba version.
$ samba -V
Version 4.23.6-Ubuntu-4.23.6+dfsg-1ubuntu2.2
The number after Version identifies the controller tools in use.
Verify that all three standalone services are masked.
$ systemctl is-enabled smbd nmbd winbind
masked
masked
masked
Each masked line corresponds to one service, in the order specified.
A nonzero exit status from systemctl is-enabled is expected for masked services.
The samba-ad-dc package installs the controller and samba-tool. We will use kinit to request a Kerberos ticket, dig to check DNS, and smbclient to open SYSVOL. If the Kerberos installer prompts for a realm, enter AD.EXAMPLE.TEST. Provisioning the domain will generate the final Kerberos configuration. On a controller, samba-ad-dc manages the required processes. Masking the standalone units prevents a second instance from starting.
Provision the domain and configure DNS
A new server has no /var/lib/samba/private/sam.ldb. If the file already exists, stop before the next block: the machine already has a directory database. Save the package’s default smb.conf under another name so Samba can generate a controller configuration.
$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.distribution
Create the forest. Run this command only on the first controller.
$ sudo samba-tool domain provision --interactive \
> --realm=AD.EXAMPLE.TEST --domain=ADLAB --server-role=dc \
> --dns-backend=SAMBA_INTERNAL --host-name=dc1 --host-ip=192.168.217.10 \
> --option='interfaces=lo 192.168.217.10/24' --option='bind interfaces only=yes'
Server Role: active directory domain controller
Hostname: dc1
NetBIOS Domain: ADLAB
DNS Domain: ad.example.test
At the end of provisioning, check the server role and domain name. The excerpt omits timestamps, the SID, and log prefixes.
The Administrator account belongs to the newly created domain. Resolve any error that prevents this summary from appearing before starting the service.
Review the suggested values. AD.EXAMPLE.TEST is the Kerberos realm and ADLAB is the short Windows sign-in domain. Set the DNS forwarder to an external resolver, 1.1.1.1 in this example. Pointing it at DC1 itself or the local DNS stub 127.0.0.53 creates a loop. Enter the new domain Administrator password at the prompt. Samba creates the directory database, the DNS zone, the SYSVOL and NETLOGON shares, and /etc/samba/smb.conf.
Check how Samba interprets /etc/samba/smb.conf. The following command validates the syntax and displays the effective settings.
$ sudo testparm -s
Loaded services file OK.
Server role: ROLE_ACTIVE_DIRECTORY_DC
[global]
bind interfaces only = Yes
dns forwarder = 1.1.1.1
interfaces = lo 192.168.217.10/24
realm = AD.EXAMPLE.TEST
server role = active directory domain controller
workgroup = ADLAB
[sysvol]
path = /var/lib/samba/sysvol
read only = No
[netlogon]
path = /var/lib/samba/sysvol/ad.example.test/scripts
read only = No
This is an excerpt for the configuration used here. Loaded services file OK. confirms the file was read. Check the controller role and domain settings under [global].
If you supplied your own external resolver, its address appears under dns forwarder. The [sysvol] and [netlogon] sections identify the directories Samba will serve. Test network access after the service starts.
Save the original Kerberos client configuration and install the file Samba generated for this domain. The --update=none option preserves the first backup if the command is repeated.
Back up the original Kerberos client settings.
$ sudo cp --update=none -a /etc/krb5.conf /etc/krb5.conf.before-ad
Success produces no output. An existing backup is preserved.
Install the Kerberos client settings for the new domain.
$ sudo install -m 644 /var/lib/samba/private/krb5.conf /etc/krb5.conf
The shell prompt should return. Compare the two files next.
Check that the installed Kerberos configuration matches Samba’s file.
$ sudo cmp -s /var/lib/samba/private/krb5.conf /etc/krb5.conf && echo 'Files match'
Files match
The message appears only when the files are byte-for-byte identical.
Check the default Kerberos realm.
$ grep -i default_realm /etc/krb5.conf
default_realm = AD.EXAMPLE.TEST
The value after the equals sign should be AD.EXAMPLE.TEST.
The file comparison verifies the installation. The realm setting tells the client where to request a ticket when the user omits the realm.
Unmask the controller service so it can start.
$ sudo systemctl unmask samba-ad-dc
If the unit was masked, systemd reports removing the link to /dev/null.
Start the controller and enable it at boot.
$ sudo systemctl enable --now samba-ad-dc
Check the controller’s status.
$ systemctl is-active samba-ad-dc
active
Check that the controller is listening for DNS on its lab address.
$ sudo ss -lnutp 'sport = :53'
udp UNCONN … 192.168.217.10:53 …
tcp LISTEN … 192.168.217.10:53 …
Look for 192.168.217.10:53 for both UDP and TCP.
Test LDAP discovery against DC1’s DNS.
$ dig @192.168.217.10 +short _ldap._tcp.dc._msdcs.ad.example.test SRV
0 100 389 dc1.ad.example.test.
Expect 0 100 389 dc1.ad.example.test.. A second record will appear after DC2 joins.
Once DC1 returns the SRV record directly, switch Ubuntu to Samba DNS. On a standard installation, /etc/resolv.conf is a link to a file managed by systemd-resolved. Prepare a regular file and replace the link in one operation, then stop and disable the service.
Prepare the resolver list in a separate file.
$ printf '%s\n' 'search ad.example.test' 'nameserver 192.168.217.10' | sudo tee /etc/resolv.conf.new >/dev/null
Output goes to the file. The order of the nameserver lines sets the preferred server.
Give applications read access to the file.
$ sudo chmod 0644 /etc/resolv.conf.new
Changing the mode normally produces no output.
Install the prepared file as the system resolver configuration.
$ sudo mv -Tf /etc/resolv.conf.new /etc/resolv.conf
Success produces no output. /etc/resolv.conf now contains the specified addresses.
Stop the local resolver and disable automatic startup.
On Ubuntu 26.04, stop the two sockets that could reactivate the service. Success produces no output.
$ sudo systemctl stop systemd-resolved-varlink.socket systemd-resolved-monitor.socket
Disable the service itself.
$ sudo systemctl disable --now systemd-resolved
Applications should now find the domain using the DNS server listed in /etc/resolv.conf.
Check the resolver’s current state.
$ systemctl is-active systemd-resolved
inactive
The expected output is inactive: the process has stopped.
Check whether the service will stay disabled after a reboot.
$ systemctl is-enabled systemd-resolved # expect disabled
disabled
The expected output is disabled.
Check which server answers an ordinary DNS query.
$ dig _ldap._tcp.dc._msdcs.ad.example.test SRV
…
_ldap._tcp.dc._msdcs.ad.example.test. … IN SRV 0 100 389 dc1.ad.example.test.
…
;; SERVER: 192.168.217.10#53…
The SERVER line should show 192.168.217.10#53. Samba resolves external names through the dns forwarder configured earlier.
Test the controller before joining Windows
DNS. Check DC1’s address, domain service discovery, and forwarding to the external resolver.
Look up the first controller’s address.
$ dig +short dc1.ad.example.test A
192.168.217.10
The answer 192.168.217.10 should match DC1’s address.
Find the LDAP server through its SRV record.
$ dig +short _ldap._tcp.dc._msdcs.ad.example.test SRV
0 100 389 dc1.ad.example.test.
In 0 100 389 dc1.ad.example.test., check port 389 and the controller name.
Find the Kerberos server.
$ dig +short _kerberos._tcp.ad.example.test SRV
0 100 88 dc1.ad.example.test.
In 0 100 88 dc1.ad.example.test., check port 88.
Test forwarding outside the domain.
$ dig +short archive.ubuntu.com A
…
<external host IPv4 address>
Expect a public IPv4 address. Its value can change.
Once DC2 joins, the SRV answers will include the second controller.
Kerberos. Request an administrator ticket and inspect the cache.
$ kinit Administrator@AD.EXAMPLE.TEST
Password for Administrator@AD.EXAMPLE.TEST:
Enter the password. The shell prompt should return without a Kerberos error.
Check which ticket was issued.
$ klist
Default principal: Administrator@AD.EXAMPLE.TEST
… krbtgt/AD.EXAMPLE.TEST@AD.EXAMPLE.TEST
Default principal should name the user, and the ticket list should contain krbtgt/AD.EXAMPLE.TEST@AD.EXAMPLE.TEST.
SYSVOL. Use the ticket to read the share.
$ smbclient //dc1.ad.example.test/sysvol --use-kerberos=required -c ls
ad.example.test D …
The ad.example.test entry is the domain directory.
Domain time and the first user
Keep chrony’s existing external time sources. Add each of the following directives once to /etc/chrony/chrony.conf. They specify the listening address, the client network, and the socket Samba uses to sign time responses for Windows.
bindaddress 192.168.217.10
allow 192.168.217.0/24
ntpsigndsocket /var/lib/samba/ntp_signd
Give the time service access to Samba’s signing socket through the _chrony group.
$ sudo chgrp _chrony /var/lib/samba/ntp_signd
Success produces no output. The directory’s group owner should now be _chrony.
Set the permissions on the socket directory.
$ sudo chmod 0750 /var/lib/samba/ntp_signd
Success produces no output. The expected mode is 750.
Apply the time service settings.
$ sudo systemctl restart chrony
A successful restart normally produces no output.
Find the time source selected by the controller.
$ chronyc sources -v
^* ntp-nts-3.ps5.canonical.> …
The ^* marker at the start of a line identifies the selected source.
Check DC1’s synchronization status.
$ chronyc tracking
Stratum : 3
Leap status : Normal
Look for Leap status : Normal. The controller’s Stratum was 3 in the lab.
Verify that the signing socket directory has group _chrony and mode 750.
$ stat -c '%G %a' /var/lib/samba/ntp_signd
_chrony 750
After restarting chrony, look for ^* in chronyc sources and for Stratum and Leap status in tracking.
Immediately after a restart, sources may show ^? and chronyc tracking may report 503 No such source. Allow chrony to collect measurements and repeat both checks. Once a source has an asterisk, proceed to the first user. Before choosing a password, inspect the new domain’s policy. The excerpt shows the settings that affect the employee.
$ sudo samba-tool domain passwordsettings show
…
Password complexity: on
…
Password history length: 24
Minimum password length: 7
Minimum password age (days): 1
Maximum password age (days): 42
…
A new Samba domain enforces password complexity. The default minimum length is seven characters, and the history retains the previous 24 passwords. Users can change their own password again after one day. The maximum password age is 42 days.
Create a regular domain account. Enter the employee’s password at the prompt.
$ sudo samba-tool user create lab-user
…
User 'lab-user' added successfully
Create a group for granting resource access.
$ sudo samba-tool group add LabUsers
Added group LabUsers
Success is reported as Added group LabUsers.
Add the employee to the group.
$ sudo samba-tool group addmembers LabUsers lab-user
Added members to group LabUsers
Expect Added members to group LabUsers.
Read the group membership from the directory.
$ sudo samba-tool group listmembers LabUsers
lab-user
The list should include lab-user.
There are now two accounts for the next step. Administrator will join the workstation to the domain, and ADLAB\lab-user will test the first sign-in. After sign-in, w32tm /query /status shows the Windows time source. The lab reported Source: dc1.ad.example.test and Stratum: 4. The first field identifies the source, and the second gives the client’s level in the time hierarchy. Ubuntu’s Samba domain controller guide.
Join Windows to the domain
On LAB-W11, open PowerShell as a local administrator. The client needs an address on the lab network. DHCP is not running yet, so assign one manually. First identify the adapter connected to the lab network and use its name in place of Ethernet below.
PS> Get-NetAdapter
Name Status
---- ------
Ethernet Up
In the same PowerShell window, set the address and gateway. Use the active adapter name for $nic.
Save the adapter name for the following commands.
PS> $nic = 'Ethernet'
Assignment produces no output. Keep using the same PowerShell window.
Assign the Windows address and gateway.
PS> New-NetIPAddress -InterfaceAlias $nic -IPAddress 192.168.217.20 -PrefixLength 24 -DefaultGateway 192.168.217.1
IPAddress : 192.168.217.20
PrefixLength : 24
…
Check IPAddress and PrefixLength. They should be 192.168.217.20 and 24.
Point Windows at the domain DNS server.
PS> Set-DnsClientServerAddress -InterfaceAlias $nic -ServerAddresses 192.168.217.10
This normally produces no output. Next, check controller discovery.
Find the controller Windows will use for LDAP.
PS> Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.ad.example.test
NameTarget Port
dc1.ad.example.test 389
Look for dc1.ad.example.test in NameTarget and port 389.
Once DC1 appears in NameTarget, check the workstation’s own name.
PS> hostname
LAB-W11
Join the workstation to the domain. If Windows Setup gave it a different name, add -NewName LAB-W11. Enter the domain administrator’s password when prompted.
PS> Add-Computer -DomainName ad.example.test -Credential 'ADLAB\Administrator' -PassThru
…
HasSucceeded ComputerName
------------ ------------
True LAB-W11
True confirms that the join succeeded. Restart Windows to test a domain sign-in.
PS> Restart-Computer
The session ends and Windows returns to the sign-in screen.
After the restart, select Other user and sign in as ADLAB\lab-user. Use an ordinary PowerShell window to check the account, SYSVOL access, and tickets.
Check the account in the current Windows session.
PS> whoami
adlab\lab-user
Expect adlab\lab-user.
Check whether this user can read SYSVOL over the network.
PS> (Get-ChildItem '\\dc1.ad.example.test\SYSVOL').Name
ad.example.test
ad.example.test is the name of the directory inside the SMB share.
Inspect the tickets in the Windows session.
PS> klist
Server: krbtgt/AD.EXAMPLE.TEST @ AD.EXAMPLE.TEST
Server: cifs/dc1.ad.example.test @ AD.EXAMPLE.TEST
Look for Server lines containing krbtgt/AD.EXAMPLE.TEST and cifs/dc1.ad.example.test.
The first ticket was obtained at domain sign-in, and the second when reading SYSVOL over SMB. In a separate elevated PowerShell window, verify the workstation’s trust relationship with the domain.
PS> Test-ComputerSecureChannel
True
Add DC2
On a second clean Ubuntu server, repeat the network, hostname, package, and service preparation from the beginning of this section. Use dc2.ad.example.test and 192.168.217.11/24. Before joining, DC2 must find the domain through DC1. Check that DC1 answers, then switch DNS on DC2 and disable systemd-resolved.
$ dig @192.168.217.10 +short _ldap._tcp.dc._msdcs.ad.example.test SRV
0 100 389 dc1.ad.example.test.
Once DC1 responds, make it DC2’s system DNS server.
Prepare the resolver list in a separate file.
$ printf '%s\n' 'search ad.example.test' 'nameserver 192.168.217.10' | sudo tee /etc/resolv.conf.new >/dev/null
Output goes to the file. The order of the nameserver lines sets the preferred server.
Give applications read access to the file.
$ sudo chmod 0644 /etc/resolv.conf.new
Changing the mode normally produces no output.
Install the prepared file as the system resolver configuration.
$ sudo mv -Tf /etc/resolv.conf.new /etc/resolv.conf
On success, /etc/resolv.conf contains the specified addresses and the command produces no output.
Stop the local resolver and disable automatic startup.
On Ubuntu 26.04, stop the two sockets that could reactivate the service. Success produces no output.
$ sudo systemctl stop systemd-resolved-varlink.socket systemd-resolved-monitor.socket
Disable the service itself.
$ sudo systemctl disable --now systemd-resolved
Applications should now find the domain through the DNS server in /etc/resolv.conf.
The direct query from DC2 should return 0 100 389 dc1.ad.example.test.. The configuration commands are silent. The first dig below repeats the query using the system resolver and should return the same DC1.
Run the next commands on DC2. The join will retrieve the existing domain data from DC1.
$ dig +short _ldap._tcp.dc._msdcs.ad.example.test SRV
0 100 389 dc1.ad.example.test.
Once DNS responds, prepare Samba’s configuration on DC2.
$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.distribution
Join DC2 to the existing domain as an additional controller. After the password prompt, look for confirmation that it joined as a DC.
$ sudo samba-tool domain join ad.example.test DC -U 'ADLAB\Administrator' \
> --server=dc1.ad.example.test --dns-backend=SAMBA_INTERNAL \
> --option='interfaces=lo 192.168.217.11/24' --option='bind interfaces only=yes'
Install the Kerberos configuration generated during the join on DC2.
$ sudo install -m 644 /var/lib/samba/private/krb5.conf /etc/krb5.conf
Unmask the controller service.
$ sudo systemctl unmask samba-ad-dc
If the unit was masked, systemd reports removing the link to /dev/null.
Start the controller and enable it at boot.
$ sudo systemctl enable --now samba-ad-dc
Check the controller’s status.
$ systemctl is-active samba-ad-dc
active
Once the service shows active, check directory replication. LDAP may briefly return NT_STATUS_CONNECTION_REFUSED after the first start. Wait a few seconds and retry on DC2.
$ sudo samba-tool drs showrepl
…
Last attempt @ … was successful
…
Look for a successful last replication attempt in the partner details.
Check the forest and domain functional levels.
$ sudo samba-tool domain level show
Forest function level: (Windows) 2008 R2
Domain function level: (Windows) 2008 R2
These lines report the forest and domain levels. The controller level appears on a separate line.
Check that DNS on DC2 returns its own address.
$ dig @192.168.217.11 +short dc2.ad.example.test A
192.168.217.11
The expected answer is 192.168.217.11. If DC1’s address appears, check both the queried name and the DNS server address.
For a short replication status check on DC2, run:
$ sudo samba-tool drs showrepl --summary
[ALL GOOD]
Before joining, DC2 uses the DNS service already running on DC1. Before putting its own address first, verify replication in both directions and check that both DNS servers return the controller records. Then choose the resolver order for normal operation.
The Windows Server series puts the partner’s DNS first because of a startup dependency. Windows DNS waits for initial inbound AD synchronization before loading an integrated zone. To synchronize, the controller needs its replication partner’s address, which it looks up through DNS. Asking its own DNS while that service is waiting for AD can delay startup (event 4013). A running DNS service on the partner breaks the cycle. Microsoft’s explanation.
This lab uses Samba 4.23.6’s internal DNS server. At startup it opens the local directory database, reads the zones, and begins listening on the network interfaces. This startup path does not wait for fresh inbound replication from another DC. Once the join and replication checks have succeeded, the controller can use its own address first. During the join itself, DC2 still uses the running DNS service on DC1. Samba 4.23.6 internal DNS source.
On DC1, list its own address first and DC2’s second.
$ printf '%s\n' 'search ad.example.test' 'nameserver 192.168.217.10' 'nameserver 192.168.217.11' | sudo tee /etc/resolv.conf
search ad.example.test
nameserver 192.168.217.10
nameserver 192.168.217.11
On DC2, list its own DNS first and DC1’s second.
$ printf '%s\n' 'search ad.example.test' 'nameserver 192.168.217.11' 'nameserver 192.168.217.10' | sudo tee /etc/resolv.conf
search ad.example.test
nameserver 192.168.217.11
nameserver 192.168.217.10
On DC2, expect search ad.example.test followed by nameserver 192.168.217.11 and nameserver 192.168.217.10. The nameserver lines appear in the opposite order on DC1.
In [global] in /etc/samba/smb.conf, set the same external dns forwarder as on DC1 and restart the service. Repeat DC1’s chrony configuration with DC2’s own bindaddress. Add the second DNS server on LAB-W11.
Set the alternate DNS server on Windows.
PS> Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses '192.168.217.10','192.168.217.11'
Success produces no message. Query the second server directly next.
Look up the Kerberos SRV records through DC2.
PS> Resolve-DnsName -Server 192.168.217.11 -Type SRV _kerberos._tcp.ad.example.test
NameTarget Port
dc1.ad.example.test 88
dc2.ad.example.test 88
Expect 88 in Port and the domain controller names in NameTarget.
Verify a directory change in each direction
Create a temporary group on DC1.
$ sudo samba-tool group add ReplicationCheck
Added group ReplicationCheck
On DC2, read its identifier from the local directory replica.
$ sudo samba-tool group show ReplicationCheck --attributes=objectGUID
dn: CN=ReplicationCheck,CN=Users,DC=ad,DC=example,DC=test
objectGUID: c2da44d0-fa97-440f-a753-c6690acce723
Repeat the command on DC1. Both servers should return the same value. A fresh group will have its own GUID. Now change the membership on DC2.
$ sudo samba-tool group addmembers ReplicationCheck lab-user
Added members to group ReplicationCheck
On DC1, check whether the change arrived in the opposite direction.
$ sudo samba-tool group listmembers ReplicationCheck
lab-user
If the group is still empty, wait and read it again. On a newly started pair, Last success @ NTTIME(0) means there is no timestamp for a successful replication yet. To diagnose this, request replication of the domain partition to DC1. The destination comes first, followed by the source.
$ sudo samba-tool drs replicate dc1.ad.example.test dc2.ad.example.test 'DC=ad,DC=example,DC=test' -P
Replicate from dc2.ad.example.test to dc1.ad.example.test was successful.
The first request in the lab returned WERR_NETNAME_DELETED. After checking DC2’s name resolution and restarting Samba on DC1, the request succeeded. Check the membership again. Once lab-user appears on DC1, remove the temporary group.
$ sudo samba-tool group delete ReplicationCheck
Deleted group ReplicationCheck
What the lab demonstrated
Two Linux servers now run the ad.example.test domain with Samba. DC1 provisioned the domain, DC2 joined as an additional controller, and a directory change replicated in both directions. A Windows 11 workstation joined the domain, and ADLAB\lab-user signed in, obtained a Kerberos ticket, and opened the domain’s SYSVOL share.
Only registered users can leave a comment.
Sign in or register to leave a comment.