302.2 Active Directory Name Resolution (weight: 2)

Tech Tutorial: 302.2 Active Directory Name Resolution (weight: 2) #

Introduction #

In this tutorial, we will delve into configuring and understanding the internal DNS server functionality provided by Samba, which is crucial for Active Directory environments. Samba can function as a Domain Controller that can serve DNS records for a domain, necessary for Active Directory operations. We will explore how to set up Samba as a DNS server in a Linux environment and how to manage DNS records using Samba’s utilities.

Key Knowledge Areas: #

  • Understanding Samba as an Active Directory Domain Controller
  • Configuring Samba as a DNS server
  • Managing DNS records with Samba tools
  • Integration with existing DNS infrastructure

Utilities: #

  • samba-tool
  • smb.conf
  • DNS management commands

Prerequisites #

To follow this tutorial, you should have:

  • A Linux machine (Ubuntu Server 20.04 LTS is used in these examples)
  • Sufficient privileges (root or sudo)
  • Samba installed (Version 4.10 or later is recommended)

Step-by-Step Guide #

Step 1: Installing Samba #

First, ensure that Samba is installed and updated to the latest version:

sudo apt update && sudo apt install -y samba

Step 2: Configuring Samba as an Active Directory Domain Controller #

Edit the Samba configuration file located at /etc/samba/smb.conf to set up Samba as a domain controller:

[global]
    workgroup = SAMBADOMAIN
    realm = SAMBADOMAIN.COM
    netbios name = SAMBASERVER
    server role = active directory domain controller
    dns forwarder = 8.8.8.8
    idmap_ldb:use rfc2307 = yes

[netlogon]
    path = /var/lib/samba/sysvol/sambadomain.com/scripts
    read only = no

[sysvol]
    path = /var/lib/samba/sysvol
    read only = no

Step 3: Provisioning the Domain #

Use the samba-tool utility to provision the domain. This step creates the required AD database and DNS entries:

sudo samba-tool domain provision --use-rfc2307 --interactive

Follow the on-screen prompts to configure the domain settings.

Step 4: Managing DNS Records Using samba-tool #

To add a DNS record:

sudo samba-tool dns add <Your-Samba-Server-IP> sambadomain.com hostname A 192.168.1.10

To delete a DNS record:

sudo samba-tool dns delete <Your-Samba-Server-IP> sambadomain.com hostname A 192.168.1.10

To query DNS records:

sudo samba-tool dns query <Your-Samba-Server-IP> sambadomain.com @ ALL

Step 5: Restart Samba Services #

After making changes to the configuration or DNS records, restart Samba to apply the changes:

sudo systemctl restart samba-ad-dc

Conclusion #

In this tutorial, we covered the basics of setting up Samba as an Active Directory Domain Controller and configuring it to manage DNS records necessary for Active Directory functionality. By understanding the role of Samba in DNS management, you can effectively integrate Linux servers into Windows-centric network environments, providing seamless domain services. Always ensure your Samba installation is secure and up to date to protect your network infrastructure.