What is a server: common server roles such as DNS, DHCP and web
|

What Is a Server? Common Server Roles Explained (Web, DNS, DHCP and More)

A server is a computer whose job is to answer requests from other computers. It is usually on all the time, nobody sits at it, and what it does is called its role: serving web pages, sharing files, handing out IP addresses, translating names, storing a database and so on. One machine can carry several roles, or each role can have its own machine. The word is also used for the software that plays the role (a “web server” is often a program such as nginx, Apache or IIS), which is a common source of confusion. This guide explains the roles you will meet most often, the ports they normally listen on, and how to see which roles a machine is actually running.

The idea in one picture

Every role follows the same pattern: a client asks, a server answers. Your browser asks a web server for a page, your laptop asks a DHCP server for an IP address, and an application asks a database server for a record. The client and server agree on a protocol (the rules of the conversation) and a port, a number that tells the server machine which service the request is for.

Common server roles

The ports below are the standard defaults. Administrators can move a service to another port, so treat them as the usual value, not a law.

Role What it does Typical port Examples
Web server Delivers web pages and files over HTTP or HTTPS 80 (HTTP), 443 (HTTPS) nginx, Apache, IIS
File server Shares files and folders on a network 445 (SMB), 2049 (NFS) Windows file sharing, Samba, NFS
DNS server Translates names such as example.com into IP addresses 53 (UDP and TCP) BIND, Windows DNS
DHCP server Gives devices an IP address and network settings automatically UDP 67 (server) and UDP 68 (client) Windows DHCP Server, ISC DHCP, dnsmasq
Mail server Sends, receives and stores email 25 and 587 (SMTP), 143 and 993 (IMAP) Postfix, Exchange
Database server Stores structured data for applications 3306 (MySQL/MariaDB), 5432 (PostgreSQL), 1433 (SQL Server) MariaDB, PostgreSQL, SQL Server
Directory server Keeps user accounts and permissions in one place 389 (LDAP), 636 (LDAPS) Active Directory, OpenLDAP
Remote access Lets administrators log in from elsewhere 22 (SSH), 3389 (RDP) OpenSSH, Remote Desktop
Time server Keeps the clocks on a network in step 123 (UDP) chrony, Windows Time

Other roles you will hear about are application servers (which run business software), print servers, proxy servers and reverse proxies or load balancers (which sit in front of other servers), and backup servers.

Two services you will meet on almost every network

DNS: names to addresses

People remember names and computers use numbers. A DNS server holds the records that connect the two. When you type a website name, your device asks a DNS server for the matching IP address before it can connect. The protocol is defined in RFC 1035.

DHCP: addresses without typing

Every device on a TCP/IP network needs an IP address. Without DHCP (or another automatic method, such as IPv6 autoconfiguration), someone would have to type one into each device and keep track of which ones are free. A DHCP server keeps a pool of addresses and leases one to each device that joins, together with options such as the default gateway and the DNS servers. Microsoft’s documentation describes the lease as temporary, so addresses that are no longer in use go back to the pool. The standard behind it is RFC 2131.

See which roles a machine is running

A server’s role shows up as a program listening on a port. On Linux, ss lists listening TCP ports with the program that owns each one:

ss -tlnp

This is the output from a disposable test container running a tiny web server, so the one open port is the web role:

State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      9                  *:80              *:*    users:(("httpd",pid=16,fd=3))

Reading it: the machine is listening on TCP port 80 and the program behind it is httpd. On a real server you would see more lines, for example port 22 for SSH.

That command shows TCP only. Add u to include UDP, which DNS, DHCP and time services use, and run it with sudo so that ss can show the program name for processes owned by other users:

sudo ss -tulnp

To see the services systemd is running, use systemctl list-units --type=service --state=running. Treat an open port as a clue, not proof: a service can listen on an unusual port, and the same port number can be used by something else.

On Windows, netstat -ano | findstr LISTENING shows the listening TCP ports and the process ID behind each one, and netstat -ano -p udp shows UDP. On Windows Server, Server Manager lists the installed roles and features and lets you add more with Add Roles and Features.

One server or many?

A home lab or a small business often runs several roles on one machine, because it is cheaper and simpler. Larger setups split the roles, and the reasons are practical: a problem or an attack on one role is less likely to bring down the others, each machine can be updated and restarted without affecting the rest, and a busy role can get more resources. Today the “machine” is often a virtual machine or a container, so a role can have its own server without its own hardware.

Common questions

Can an ordinary PC act as a server?

Yes. A server is defined by what it does, not by the hardware. Any computer can share a folder or run a web server program. Real server hardware adds things such as redundant power supplies and remote management, which improve availability and make maintenance easier.

Is a server a machine or a program?

Both meanings are in use. “The web server is down” can mean the computer or the program on it. If it matters, say “the server machine” or “the nginx service”.

Why do I need to know the ports?

Because firewalls, troubleshooting and security reviews are all expressed in ports. If a service is not answering, checking that it is listening and that nothing blocks its port is the first step. Only open the ports a machine really needs.

Sources

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *