Your Gateway to a Career in Network Engineering
Configuring Core Services: DHCP, DNS, and NAT
A network without services is like a city without power, water, or a postal service. Core IP services automate essential tasks and enable your private network to communicate with the outside world. This section covers the configuration of the three most fundamental services that every network technician must understand.
How They Work Together to Get You Online:
- You connect your PC to the network. It has no IP address, so DHCP automatically assigns one.
- You type "www.google.com" in your browser. Your PC needs the IP address for that name, so DNS translates it.
- Your PC sends a packet to Google's public IP address. Your router uses NAT to translate your PC's private IP into its own public IP, allowing the communication to happen.
DHCP: The Automatic Address Dispenser
The **Dynamic Host Configuration Protocol (DHCP)** automates the process of assigning IP addresses, subnet masks, default gateways, and DNS servers to client devices. Without it, you would have to manually configure every single device on your network.
Configuring a Router as a DHCP Server
In small networks, a router can be configured to act as the DHCP server. The process involves creating a "pool" of addresses to hand out and excluding any addresses you want to reserve for static assignment (like for servers or printers).
Router# configure terminal
! 1. Exclude addresses you want to save for servers, printers, etc.
Router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10
! 2. Create the DHCP pool and give it a name
Router(config)# ip dhcp pool LAN-POOL-1
! 3. Define the network and subnet mask for the pool
Router(dhcp-config)# network 192.168.1.0 255.255.255.0
! 4. Tell clients what their default gateway (router) is
Router(dhcp-config)# default-router 192.168.1.1
! 5. Tell clients which DNS server to use
Router(dhcp-config)# dns-server 8.8.8.8
Router(dhcp-config)# end
Verification:
To see which IP addresses have been leased to clients, use the command: show ip dhcp binding.
DNS: The Internet's Phonebook
The **Domain Name System (DNS)** translates human-friendly domain names (like www.mubashercyber.com) into computer-friendly IP addresses (like 136.243.153.21). While you typically won't run a DNS server on a router, you must configure the router itself to use one so it can resolve names for management tasks.
Configuring a DNS Client on a Router
This command tells the router which external DNS server to query when it needs to look up a name.
Router# configure terminal
Router(config)# ip name-server 8.8.8.8 8.8.4.4
! You can specify multiple DNS servers for redundancy
Router(config)# end
Verification:
You can test if DNS is working by pinging a domain name from the router's CLI. If it resolves to an IP, it's working.
Router# ping www.cisco.com
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 72.163.4.185, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5)
NAT: The Network's Translator
**Network Address Translation (NAT)** is the process of modifying IP address information in packet headers while they are in transit. Its most common use is to allow the many devices on a private network (using private RFC 1918 addresses) to share a single public IP address to access the internet. The most common form is **Port Address Translation (PAT)**, also known as NAT Overload.
Configuring NAT Overload (PAT)
This is a three-step process: identify which traffic to translate, define your inside/outside interfaces, and create the translation rule.
Router# configure terminal
! STEP 1: Create an Access Control List (ACL) to identify
! which private IP addresses are allowed to be translated.
Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
! STEP 2: Define your inside (private) and outside (public) interfaces.
Router(config)# interface GigabitEthernet0/0/1
Router(config-if)# ip nat inside
Router(config-if)# exit
Router(config)# interface GigabitEthernet0/0/0
Router(config-if)# ip nat outside
Router(config-if)# exit
! STEP 3: Create the NAT rule.
! This ties the ACL (list 1) to the outside interface and enables overloading.
Router(config)# ip nat inside source list 1 interface GigabitEthernet0/0/0 overload
Router(config)# end
Verification:
To see the active NAT translations as users browse the internet, use: show ip nat translations.
- Back to Diploma Overview
- Previous Module: VLANs and Inter-VLAN Routing
- Next: Implementing Access Control Lists (ACLs)