Labels

Android (1) Apache (1) bash (2) boost (2) C (36) C++ (4) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (3) Dreamweaver (2) Eclipse (3) fail2ban (5) git (6) GitHub (5) Hacking (4) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (33) javascript (3) Linux (180) Mac (21) Machine Learning (1) mySQL (52) Netbeans (6) Networking (1) Nexus (1) OpenVMS (6) Oracle (3) Pandas (3) php (17) Postgresql (8) Python (9) raid (1) RedHat (15) Samba (2) Slackware (51) SQL (14) ssh (1) svn (1) tar (1) ThinkPad (1) Virtualbox (4) Visual Basic (2) Visual Studio (1) Windows (5) wire (1)

Tuesday, 28 July 2026

DHCP server on Slackware using dnsmasq

 Example configuration file:


# Listen on internal network interface

interface=eth0

domain=company.local

local=/company.local/


# Upstream public DNS servers

server=1.1.1.3

server=1.0.0.3

server=1.1.1.2

server=1.0.0.2

server=8.8.8.8

server=8.8.4.4

server=1.1.1.1

server=1.0.0.1

# Either or...

strict-order

#all-servers


# DHCP Range and Lease Time (12 hours)

dhcp-range=192.168.1.50,192.168.1.200,255.255.255.0,12h


# Gateway & Local DNS server push

dhcp-option=option:router,192.168.1.1

dhcp-option=option:dns-server,192.168.1.2


# Fixed IPs for core servers (MAC address mapping)

dhcp-host=AA:BB:CC:DD:EE:FF,appserver,192.168.1.10,infinite

### Optional Start ###

# Optional: Read static host definitions from Slackware's standard /etc/hosts file

expand-hosts

# Optional: Prevent forwarding plain names (without dots) to upstream servers

domain-needed

# Optional: Prevent forwarding reverse-DNS lookups for private IP ranges upstream

bogus-priv

### Optional End ###


NOTES:

domain=company.local: Defines your local domain name. When DHCP clients request an IP address, Dnsmasq automatically appends .company.local to their hostname (e.g., a workstation named pc-smith becomes pc-smith.company.local). It also pushes this domain to DHCP clients as their search domain.

local=/company.local/: Directs Dnsmasq to treat any query ending in .company.local as strictly internal. It will never forward queries for .company.local to upstream internet DNS servers. If a local name isn't found in Dnsmasq's lease table or local hosts file, it immediately returns NXDOMAIN (non-existent domain).

option:router (Option 3): Sets the default gateway pushed to clients. In this setup, clients will send all non-local internet traffic through 192.168.1.1.

option:dns-server (Option 6): Tells clients which DNS server address to use. By pointing this to 192.168.1.2 (the IP of your Slackware box running Dnsmasq), all client DNS traffic routes through your local server.


See also here

No comments:

Post a Comment

Note: only a member of this blog may post a comment.