DHCP e DNS CCNA spiegati: cosa fa funzionare le reti silenziosamente?
DHCP e DNS CCNA spiegati semplicemente: due protocolli che lavorano silenziosamente dietro ogni connessione.
Ogni volta che un dispositivo si connette a una rete e naviga su un sito web, due eroi invisibili lavorano dietro le quinte:
- DHCP (Dynamic Host Configuration Protocol) – assegna automaticamente gli indirizzi IP
- DNS (Domain Name System) – traduce i nomi di dominio in indirizzi IP
Entrambi sono essenziali per le reti e spesso testati nell'esame CCNA.
Cos'è DHCP?
DHCP assegna automaticamente indirizzi IP, maschere di sottorete, gateway predefiniti, e indirizzi dei server DNS ai dispositivi su una rete.
Senza DHCP:
Devi configurare manualmente ogni dispositivo.
Con DHCP:
Gli indirizzi IP vengono assegnati automaticamente — non è necessaria alcuna configurazione manuale.
Come funziona DHCP – Il processo DORA
| Fase | Descrizione |
|---|---|
| Discover | Il client invia una richiesta broadcast per trovare il server DHCP |
| Offer | Il server risponde con un IP disponibile |
| Request | Il client richiede di accettare l'IP offerto |
| Acknowledge | Il server conferma e assegna l'IP |
👉 Questo processo è noto come DORA (Discover, Offer, Request, Acknowledge).
Configurazione DHCP nei router Cisco
Router(config)# ip dhcp pool LAN-POOL
Router(dhcp-config)# network 192.168.10.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.10.1
Router(dhcp-config)# dns-server 8.8.8.8
Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
➡️ This sets up a pool of IP addresses and reserves .1 to .10 for static/manual assignments.
DHCP Relay: When the Server Isn’t on the Local Subnet
DHCP’s Discover message is a broadcast, and broadcasts do not cross a router by default – so a client on a subnet with no local DHCP server would never reach one sitting elsewhere on the network. The fix is a DHCP relay (also called an IP helper), configured on the router interface closest to the client:
Router(config)# interface gigabitEthernet 0/1
Router(config-if)# ip helper-address 192.168.1.5
This converts the client’s broadcast into a unicast packet aimed directly at the DHCP server’s address, and relays the server’s reply back the same way. This is exactly how most real enterprise networks work – one or two central DHCP servers, with every other subnet’s router relaying requests to them rather than running a DHCP server on every single subnet.
DHCP Troubleshooting Commands
When a client is not getting an address, these three commands narrow down the cause quickly:
Router# show ip dhcp binding
Router# show ip dhcp conflict
Router# debug ip dhcp server events
show ip dhcp binding confirms whether the router has actually leased an address to the client’s MAC – no binding means the Discover never reached the pool, which usually points back to a missing ip helper-address on the client’s subnet. show ip dhcp conflict shows addresses the server detected as already in use, often caused by a static IP accidentally set inside the DHCP pool’s range.
What is DNS?
DNS (Domain Name System) translates human-friendly domain names like google.com into machine-friendly IP addresses like 142.250.190.78.
Without DNS, users would need to remember numeric IP addresses to visit websites.
Testing DNS Resolution Directly
Before assuming a “website won’t load” problem is DNS, confirm it directly rather than guessing – a browser error message does not tell you which layer actually failed:
C:\> nslookup google.com
$ dig google.com
nslookup (Windows and also available on Linux/macOS) and dig (Linux/macOS, more detailed output) both query a DNS server directly and show exactly what it returned. If the lookup succeeds here but the website still does not load in a browser, the problem is not DNS – it is routing, a firewall, or the web server itself. This distinction, confirmed with one command instead of assumed, is exactly the kind of troubleshooting discipline the CCNA exam expects and that saves real time in the field.
How DNS Works – Step-by-Step
- You type
facebook.comin your browser. - The DNS resolver checks if it already knows the IP.
- If not, it queries a root server → top-level domain server → authoritative server.
- It returns the IP to your browser → website loads!
DNS Terms to Know (for CCNA)
| Term | Descrizione |
|---|---|
| A Record | Maps domain to IPv4 address |
| AAAA Record | Maps domain to IPv6 address |
| CNAME | Alias for another domain |
| MX Record | Directs email to the mail server |
DHCP vs Static IP – When to Use What?
| DHCP (Dynamic) | Static IP |
|---|---|
| Automatically assigned | Manually configured |
| Great for clients | Best for servers, printers |
| Easy to manage | Harder in large networks |
| IP may change | IP remains the same |
🧪 CCNA Packet Tracer Lab – DHCP in Action
Lab Scenario:
You have a router, a switch, and multiple PCs. PCs should receive IPs automatically.
- Configure DHCP pool on router
- Connect PCs and enable DHCP
- Verify IPs are assigned correctly using
ipconfig
Optional: Assign a static IP to a printer or server and exclude that range.
📡 Real-World DNS Example
Let’s say you own yourbrand.com.
To point it to a hosting server:
- A Record → your website’s IP
- CNAME → alias like
blog.yourbrand.comto redirect to a CMS - MX Record → email hosting provider
DNS is the backbone of all web and mail-based services.
✅ Essential Network Devices for CCNA
🌐 Cisco DHCP Configuration Guide
🌐 How DNS Works – Cloudflare Docs
🙋♂️ FAQ – DHCP and DNS
What is DHCP in CCNA?
DHCP stands for Dynamic Host Configuration Protocol. It automatically assigns IP configuration to network devices, covered in CCNA exams and labs.
What does DNS do in a network?
DNS resolves domain names to IP addresses, allowing users to access websites using names instead of numbers.
Can I use DHCP and DNS together?
Yes. DHCP assigns the IP, and includes the DNS server address in the lease, allowing devices to resolve domain names immediately.
Is DHCP better than static IP?
For clients, yes. For devices like printers, servers, and routers — static IPs are preferred.
Se preferisci che qualcuno ti guidi passo passo, o hai bisogno di un laboratorio Packet Tracer specifico completato e spiegato anziché scoperto da solo, vedi il Lezioni CCNA e Packet Tracer pagina su come funziona.

