Notes 03‐1 - LPouliot/Junior-Spring-NET-330-01-Network-Design GitHub Wiki
Dynamic Host Configuration Protocol (DHCP)
What is DHCP?
How does a computer receive an IP address?
Statically:
- Manually entered by the administrator
Dynamically:
- Automatically assigned by the network
DHCP:
- is used to automatically assign an IP address to a host
- May include a lot more network information too
Key information that we need:
- IP Address
- Subnet Mask
- Default Gateway/Router
- DNS Server Address
How does DHCP Work
The client (computer) has no idea what network it's even on
So it sends out a broadcast asking for help
If a DHCP server hears this broadcast, it will respond with an IP address that the client can use.
The DCHP employs a connectionless service model of UDP
It is implemented with two known UDP port numbers:
- Server port: 67
- Client port: 68
DHCP has two primary Operation Phases:
- Initialization: Client requests, reviews, receives, and confirms an IP address
- Renewal: Client asks to renew its "lease" of the IP address
DHCP Header
Key Fields:
-
Operation Code: Indicates if this is a request or a reply
-
Hardware Type: Type of HW address
-
Hardware Length: Length of HW address
-
Transaction ID: Random number used to pair requests and replies (since UDP is connectionless)
-
Client IP Address: Eventual client IP
-
Your IP Address: Offered client IP
-
Server IP Address: IP of DHCP server
-
Gateway IP Address: Default gateway IP
-
Client Hardware Address: Client's MAC
DHCP Initialization
DORA: Four-step process
-
Discover: Client attempts to discover a DHCP server
-
Offer: IP lease offer from server to client
-
Request: Client requests to use the IP lease sent by the server
-
Acknowledgement: Server sends acknowledgement to client that the lease was accepted.
DHCP Renewal
DHCP Renewal: Process for client to request continued use(renewal) of its lease.
- By default, this begins 50% of the way through the current IP lease.
- The client sends DHCP Request packets directly to the server.
- If the server respond with a DHCP Acknowledgement, the IP lease is renewed and its time clock restarts.
- The amount of time is up to you
DHCP Rebinding: If the server does not respond to the client's renewal requests, we eventually reach the rebinding phase.
- By default, this begins 87.5% of the way through the current IP lease.
- The client begins sending its DHCP Request packets as broadcasts to see if any DHCP server will allow them to continue using their IP.
- If a server responds, the lease is renewed and the timer restarts.
DHCP Expiration: If no server responds before the lease ends, the lease expires and the IP is released.
- All TCP/IP communication stops.
- The client must go through the DORA initialization process once again to get a new IP address.
DHCP Relay
Remember, unconfigured clients have no IP configuration.
- They know nothing about the subnet, gateway, etc.
- All they can do is a broadcast into the wild
But broadcasts are Layer 2 only…what happens if a network doesn't have a local DHCP server?
- Layer 3 devices (routers, servers) can be configured as DHCP relays (aka helpers)
- Pick up broadcasts and forward to the DHCP server
DHCP
DHCP Relay/Helper on Cisco
Cisco IOS uses the “ip helper-address”
Can be assigned to a physical or VLAN interface
If configured, grabs DHCP broadcasts seen on that interface and sends to DHCP server
E.g. If DHCP server is 10.16.1.50
(config) interface vlan 100
(config-if) ip helper-address 10.16.1.50
Sends any DHCP broadcasts on VLAN 100 to the server
VLAN Interfaces
Routers (or Multi-Layer Switches acting as routers) act as the Default Gateway for VLANs
Physical Ports on Router assigned to VLAN (or trunked)
- E.g GigEthernet 0/1 may be trunked for VLAN 2,3, and 10
”Virtual” Interface is configured to assign IP address
- e.g. interface vlan2 ip address 10.1.2.1 /24
The Virtual Interface can act as the Default Gateway for that subnet/vlan