ARP, ICMP, DHCP and DNS: the network's helpers

8 min 5 sections 3 practice questions 18 sources cited

Before a laptop can open a web page it must be given an address, find the hardware address of its neighbours and turn the name of the site into a number. Four small protocols do these jobs: DHCP, ARP, DNS and ICMP. No background is assumed. Each was designed to trust whatever answer arrives, and several well-known attacks begin with that trust.

By the end of this unit you will be able to:

  • Explain what DHCP, ARP, ICMP and DNS each do for a device on a network
  • Put the four DHCP messages in order
  • Explain how a name is resolved and what the common DNS record types hold
  • Explain why ARP, DHCP and DNS can be given false answers, and name the control for each
  • Tell apart what DNSSEC protects and what it does not

A new laptop joins the office

An illustrative example

At an accountancy office a new starter opens her laptop and joins the office network. Nobody types a number. Within two seconds the laptop has an address of its own, knows which machine leads to the internet and knows which machine turns names into addresses.

She types the name of the payroll site. The laptop looks up the site's address, works out how to hand a message to the office router, and the sign-in page appears.

Several separate exchanges took place before the page appeared. What did the laptop have to learn in each?

DHCP hands a device its address and settings

A device joining a network needs four settings: an IP address, a subnet mask, a default gateway and the address of a server that looks up names. The Dynamic Host Configuration Protocol (DHCP) supplies all four automatically. The address is lent for a set time, called a lease.

  1. Discover: the new device broadcasts a request to the whole local network, because it does not yet know where the DHCP server is.
  2. Offer: a DHCP server replies with an address it can lend.
  3. Request: the device asks for the address it was offered.
  4. Acknowledge: the server confirms, and the lease begins.

DHCP in four steps: Discover, Offer, Request, Acknowledge. The initials spell DORA. The server uses UDP port 67 and the client UDP port 68.

DHCP cannot prove that an offer comes from the real server. A rogue DHCP server is an unauthorised one that answers first and hands out a false gateway or name server, so that the victim's traffic goes where the attacker chooses. In DHCP starvation an attacker requests every spare address under invented identities, and real devices get none.

The defence is DHCP snooping, a feature of . The switch is told which ports lead to the real DHCP server and drops server messages that arrive on any other port.

ARP finds the hardware address for an IP address

Every network connection has a hardware address, also called a MAC address: a 48-bit number set by the maker. It is written as six pairs of hexadecimal digits, such as 02:00:00:00:01:01. Hexadecimal counts with the digits 0 to 9 and the letters a to f. The first half of the address identifies the maker.

A frame can be delivered only to a hardware address, yet a device usually knows only the IP address it wants. The Address Resolution Protocol (ARP) fills the gap. The device broadcasts a question to the local network: who has 10.20.30.1? The owner answers with its hardware address. The device keeps the answer for a while in its ARP cache.

has no check on who answers. In ARP poisoning, also called ARP spoofing, an attacker on the same network sends false answers that pair the gateway's IP address with the attacker's own hardware address. Victims then send their traffic to the attacker, who can read it and pass it on unnoticed.

Switches defend against this with dynamic ARP inspection, which checks ARP answers against the addresses that DHCP snooping recorded and drops those that do not match. traffic limits what a successful poisoner can read.

Reverse ARP (RARP) did the opposite job. A machine that knew only its hardware address asked a server for its IP address. DHCP has taken its place.

ICMP reports problems and answers pings

The Internet Control Message Protocol (ICMP) carries error reports and simple tests between devices. It is part of IP itself, with protocol number 1, and it has no ports. Each message has a type number.

ICMP message types met by name
TypeNameMeaning
8Echo requestAre you there? Sent by the command
0Echo replyYes. The answer to a ping
3Destination unreachableThe could not be delivered
11Time exceededThe packet's time to live reached zero on the way
5RedirectA better router exists for that destination

Ping sends echo requests and times the replies, which shows whether a device can be reached. Traceroute maps a path. It sends packets with a time to live of 1, then 2, then 3. Each router that discards one returns a time exceeded message and so reveals itself.

Attackers use ICMP to find live devices and to steer or flood traffic, so limit it. Blocking all of it causes faults that are hard to diagnose. The sound allows the types the organisation needs and refuses the rest.

The Internet Group Management Protocol (IGMP) sits beside ICMP. Devices use it to tell their router which multicast groups they have joined, so that traffic for a group is sent only where someone wants it.

DNS turns names into addresses

People use names such as portal.example, and networks use numbers. The Domain Name System (DNS) translates between them. It is a worldwide directory arranged as a tree. At the top is the root. Below it are the top-level domains, such as org and uk. Below those are the domains that organisations register.

No single server holds everything. An authoritative server holds the records for one part of the tree, called a zone. A device does not search the tree itself. It asks a resolver, usually run by its organisation or internet provider. The resolver asks the authoritative servers in turn and keeps each answer for a time in its cache.

How a resolver finds the address for a name

How a resolver finds the address for a nameA laptop sends its lookup to a resolver, which holds a cache and a DNSSEC check. The resolver asks the root server, the top-level domain's server and the authoritative server in order. A forged answer meets the DNSSEC check.Laptopwantsportal.exampleForgedanswerraces thereal oneResolverCachechecked first,answer keptDNSSECcheckdetects aforged answerRootserver1. refers onwardTop-leveldomain2. refers onwardAuthoritativeserver3. the A recordUDP 53How a resolver finds the address for a nameA laptop sends its lookup to a resolver, which holds a cache and a DNSSEC check. The resolver asks the root server, the top-level domain's server and the authoritative server in order. A forged answer meets the DNSSEC check.Laptopwantsportal.exampleForgedanswerraces thereal oneResolverCachechecked first,answer keptDNSSECcheckdetects aforged answerRootserver1. refers onwardTop-leveldomain2. refers onwardAuthoritativeserver3. the A recordUDP 53
Read this figure as text

DNS is a worldwide directory arranged as a tree: the root at the top, the top-level domains below it, and the domains organisations register below those. A device does not search the tree itself; it asks a resolver, usually run by its organisation or internet provider.

  1. The laptop sends one question, the address of portal.example, to its resolver on UDP port 53. The resolver first checks its cache.
  2. If the answer is not cached, the resolver asks a root server, which refers it to the servers for the top-level domain.
  3. The resolver asks a top-level domain server, which refers it to the authoritative servers for the domain.
  4. The resolver asks the authoritative server, which holds the zone and replies with the A record, the IPv4 address. The resolver keeps the answer in its cache for a time and returns it to the laptop.
  5. In DNS cache poisoning an attacker gets a forged answer in before the real one. A resolver that checks DNSSEC signatures, in a chain up to the root, detects the forgery; one that does not stores the false address and gives it to everyone who asks until the entry expires. DNSSEC signs answers but does not encrypt them.
DNS record types and what each one holds
RecordHolds
AThe for a name
AAAAThe for a name
MXThe mail server for a domain
NSThe authoritative name servers for a zone
CNAMEAn alias: one name that points to another name
PTRThe name for an address, the reverse of an A record
SOAStart of authority: marks the start of a zone and holds its settings
TXTFree text attached to a name

Lookups travel on port 53. TCP port 53 carries answers too large for UDP, and it carries the zone transfer, in which a secondary server copies a whole zone from the primary. A full zone lists every named machine an organisation has, so transfers are allowed only to known secondary servers.

DNS can be lied to, and DNSSEC signs the answers

A resolver accepts the first answer that matches its question. In DNS cache poisoning an attacker gets a forged answer in before the real one. The resolver stores the false address and gives it to everyone who asks until the entry expires. Users who type the right name arrive at the attacker's server.

Resolvers make forging harder by choosing unpredictable query numbers and source ports. The stronger answer is the DNS Security Extensions (DNSSEC). Each zone signs its records with a private key. A resolver checks the signatures with the zone's public key and checks that key against the zone above, in a chain that ends at the root.

DNSSEC proves two things: the answer came from the real zone, and it was not altered on the way. It does not encrypt. Anyone watching the network can still read which names are looked up, and DNSSEC does nothing to stop a flood aimed at a name server. needs encryption of the lookup itself: DNS over TLS on port 853, using the same encryption as secure web pages, or DNS over HTTPS inside ordinary web traffic on port 443.

Split DNS gives different answers to questions from inside and from outside an organisation, so that internal names and addresses are not published to the internet.

Common misconception

“DNSSEC keeps DNS lookups private.”

DNSSEC signs answers so that a forgery can be detected. It gives origin authentication and integrity. Questions and answers still travel in readable form.

A question, worked through

Staff at a law firm report that the firm's document portal sometimes opens a look-alike page that asks for their password. It happens only in the office. From home the portal is always genuine. The network team finds an unknown device on the office network that answers address requests from laptops and names itself as their name server. The security manager is asked which control deals with the cause.

Which control BEST addresses the cause?

  1. Enable DHCP snooping on the office network switches
  2. Sign the firm's own DNS zone using DNSSEC signatures
  3. Limit DNS zone transfers to the secondary name server
  4. Block ICMP echo requests at the internet firewall
Decide on your answer, then open the reasoning
  1. The fault appears only in the office, and an unknown device there is handing out network settings. That is a rogue DHCP server pointing laptops at a false name server.
  2. Rule out d: ping has no part in this. Blocking echo requests at the firewall changes nothing inside the office.
  3. Rule out c: zone transfers are copies of the firm's zone between its own servers. Nobody has copied the zone.
  4. Between a and b: DNSSEC lets a resolver detect forged answers, but these laptops are asking the attacker's resolver, which will not check. The lie is told one step earlier, when a laptop is told which resolver to use.
  5. DHCP snooping makes the switches drop DHCP offers from every port but the real server's. It removes the cause, so a.

Answer: A. Enable DHCP snooping on the office network switches

Choosing between good answers

Victims on one local network are sent to the wrong gateway or the wrong name server
suspect a rogue DHCP server or ARP poisoning. Both work only from inside that network, and both are stopped at the switch.
Everyone who uses one resolver reaches a false site by its correct name
suspect DNS cache poisoning. DNSSEC is the control that detects the forged answer.
An option says DNSSEC provides confidentiality
reject it. DNSSEC provides origin authentication and integrity only.
A question asks which transport DNS uses
answer UDP port 53 for lookups and TCP port 53 for zone transfers.

Try it

Watch a laptop decide that a server is on its own subnet, ask for its hardware address with ARP, and send the frame through the switch.

Loading the preview.

Check your understanding

3 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 3

A charity's staff often work from cafés. The privacy officer wants the names they look up to be unreadable to anyone watching the café network.

Which measure meets this need?

What to remember

  • DHCP lends a device its address, mask, gateway and name server in four steps: Discover, Offer, Request, Acknowledge.
  • ARP finds the hardware address for an IP address on the local network. It trusts any answer, which is what allows ARP poisoning.
  • ICMP carries errors and tests. Ping uses echo request and echo reply. Traceroute relies on time exceeded.
  • DNS resolves names through a resolver that asks authoritative servers. Lookups use UDP 53 and zone transfers use TCP 53.
  • DHCP snooping stops rogue DHCP servers, dynamic ARP inspection stops ARP poisoning, and DNSSEC detects forged DNS answers.
  • DNSSEC signs. It does not encrypt.

Say it from memory

  1. What are the four steps of DHCP, which ports does it use, and which switch feature stops a rogue DHCP server?

    Discover, Offer, Request, Acknowledge, which spell DORA. The server uses UDP port 67 and the client UDP port 68. DHCP snooping makes the switch drop server messages arriving on any port other than those that lead to the real DHCP server.

    Read this part again

  2. What does ARP do, what is ARP poisoning, and which switch feature defends against it?

    ARP finds the hardware address that belongs to an IP address on the local network. In ARP poisoning an attacker sends false answers pairing the gateway's IP address with the attacker's own hardware address, so victims send their traffic to the attacker. Dynamic ARP inspection checks ARP answers against the addresses DHCP snooping recorded and drops those that do not match.

    Read this part again

  3. What do ICMP types 8, 0, 3 and 11 mean, and how does traceroute use type 11?

    Type 8 is echo request and type 0 is echo reply, used by ping. Type 3 is destination unreachable. Type 11 is time exceeded. Traceroute sends packets with a time to live of 1, then 2, then 3, and each router that discards one returns a time exceeded message and so reveals itself.

    Read this part again

  4. What do the DNS A, AAAA, MX and PTR records hold, and which port and transport carry a zone transfer?

    An A record holds the IPv4 address for a name and AAAA the IPv6 address. MX holds the mail server for a domain. PTR holds the name for an address, the reverse of an A record. A zone transfer travels on TCP port 53.

    Read this part again

  5. What does DNSSEC prove, what does it not do, and what gives DNS lookups privacy?

    DNSSEC proves that the answer came from the real zone and was not altered on the way: origin authentication and integrity. It does not encrypt, and it does not stop a flood aimed at a name server. Privacy needs DNS over TLS on TCP port 853, or DNS over HTTPS on port 443.

    Read this part again

Sources