This lesson covers two kinds of servers you will meet constantly but will not install here, DNS and mail, and then where all of a serverâs logs go.
DNS servers: two different jobs
Networking Fundamentals showed DNS from the clientâs side. On the server side there are two very different roles:
- A recursive resolver answers questions for clients. Your router, your internet provider, and public services like
1.1.1.1are resolvers. They ask around the internet for you and remember answers for a while. - An authoritative server holds the official records for a domain and answers only for that domain. The
NSrecords you looked up in Security Concepts name a domainâs authoritative servers.
A misconfigured resolver open to the whole internet can be abused to flood other networks with traffic, and anyone who can change a domainâs authoritative records can send its visitors anywhere. Both are why DNS servers are carefully protected.
Mail servers in one page
Email uses a few protocols:
- SMTP moves mail between servers (port 25) and from your mail app to your provider (port 587).
- IMAP lets your mail app read mail stored on the server (port 993, encrypted).
To find where mail for a domain should go, a sending server looks up the domainâs MX records. Because SMTP itself does not check who a sender is, three DNS records help receivers spot forged mail:
- SPF: which servers may send mail for this domain.
- DKIM: a signature on each message, checked with a public key published in DNS.
- DMARC: what receivers should do when SPF or DKIM fail (do nothing, quarantine, or reject), and where to send reports.
A domain without these is easy to fake in phishing emails. Running a real mail server is a specialist job; defenders mostly need to read these records.
Hands-on: inspect DNS and mail records from your server
Log in to lab01 over SSH. dig is a more detailed version of nslookup. If it is missing, install it with sudo apt install -y bind9-dnsutils.
1. Which resolver does lab01 use?
resolvectl status | grep -A 2 "DNS Servers"
2. Ask DNS directly.
dig example.com
dig +short NS example.com
The full dig output shows the question, the answer with its TTL (how many seconds a resolver may remember it), and which server answered. +short prints just the answer.
3. Read a real domainâs mail setup. Gmail is a good example:
dig +short MX gmail.com
dig +short TXT gmail.com | grep spf
dig +short TXT _dmarc.gmail.com
- The MX answers are mail servers with a priority number; lower is tried first.
- The SPF record starts with
v=spf1. - The DMARC record starts with
v=DMARC1and has ap=policy:none,quarantine, orreject.
Try the same three lookups for your schoolâs or employerâs domain. Does it publish SPF and DMARC? Which policy?
Where a serverâs logs go
On Ubuntu, two systems collect logs:
- journald (part of systemd) collects output from every service in a structured journal. You read it with
journalctl. - rsyslog writes classic text files in
/var/log/, such asauth.logandsyslog.
Services may also keep their own logs, like nginxâs /var/log/nginx/access.log from Lesson 3.
Hands-on: read the journal
# everything nginx reported today
sudo journalctl -u nginx --since today --no-pager
# SSH activity in the last hour
sudo journalctl -u ssh --since "1 hour ago" --no-pager
# only errors (and worse) since the last boot
sudo journalctl -p err -b --no-pager
# the text log files
ls -l /var/log/
-u picks one service, --since sets a time range, -p err keeps only errors and worse, and -b means âsince the last bootâ. --no-pager prints everything at once instead of opening it in a pager.
What to notice
- Recursive resolvers answer clients; authoritative servers hold a domainâs official records.
- SMTP moves mail, IMAP reads it; MX records say where a domainâs mail goes.
- SPF, DKIM, and DMARC make forged mail detectable. Reading them is a defenderâs job.
- journald and rsyslog collect logs; sending them off the server keeps them out of an attackerâs reach.