Table of Contents

DHCP

autoconfig client network settings such as IP address, subnet mask, default gateway, DNS server…

Implementations

bind is usually a sane choice on linux, BSD.

DHCPv4

  1. DHCP Discover
    • Client sends broadcast message, looking for any DHCP server
  2. DHCP Offer
    • Server responds with address offer
    • Server creates entry in ARP table with offered IP
  3. DHCP Request
    • Client request mentioned address or another
  4. DHCP ACK/NACK
    • Server accepts/rejects IP request

Router as DHCP server

A dedicated DHCP server can be configured for IPv4 networks, however the router usually serves this purpose, while medium-sized networks generally should have a seperate DHCP server.

Renew lease

In order to renew a DHCP IP lease, the host periodically sends Request messages (time specified by server) and the server responds with Acknowledge

DHCPv6

  1. DHCPv6 SOLICIT
    • Host sends multicast to ff02::1:2
  2. DHCPv6 ADVERTISE
    • Server is available
  3. DHCPv6 REQUEST
    • Host wants an IPv6 address or other parameters
  4. DHCPv6 REPLY
    • Server responds with config information

ICMPv6 specific messages

Router Advertisement messages use three flags in order to specify which method hosts will use in order to get an IPv6 address:

IOS Configuration

DHCPv4 Server

R1(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.9
R1(config)#ip dhcp excluded-address 192.168.10.254
R1(config)#ip dhcp pool LAN-POOL-1
R1(dhcp-config)#network 192.168.10.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.0.1
R1(dhcp-config)#dns-server 192.168.11.5
R1(dhcp-config)#domain-name example.com
R1(dhcp-config)#exit

DHCPv4 Relay

R1(config)#interface g0/0/0
R1(config)#ip helper-address 192.168.11.6
R1(config-if)#exit

Router as DHCPv4 Client

Client(config)#interface g0/0/0
Client(config-if)#ip address dhcp
Client(config-if)#no shutdown
Client(config-if)#end
Client#show ip interface g0/0/1
GigabitEthernet0/0/1 is up, line protocol is up
Internet address is 209.165.201.12/27
Broadcast address is 255.255.255.255
Address determined by DHCP

Stateless DHCPv6 Server

R1(config)#ipv6 unicast-routing
R1(config)#ipv6 dhcp pool IPV6-STATELESS
R1(config-dhcpv6)#dns-server 2001:db8:acad:1::254
R1(config-dhcpv6)#domain-name example.com
R1(config-dhcpv6)#exit
R1(config)#interface g0/0/1
R1(config-if)#ipv6 dhcp server IPV6-STATELESS
R1(config-if)#ipv6 nd other-config-flag

Stateless DHCPv6 - Client

R3(config)#ipv6 unicast-routing
R3(config)#interface g0/0/1
R3(config-if)#ipv6 enable
R3(config-if)#ipv6 address autoconfig
R3(config-if)#do show ipv6 interface brief
GigabitEthernet0/0/1
[up/up]
FE80::2FC:BAFF:FE94:29B1
2001:DB8:ACAD:1:2FC:BAFF:FE94:29B1
R3#

Stateful DHCPv6 - Server

R1(config)#ipv6 unicast-routing
R1(config)#ipv6 dhcp pool IPV6-STATEFUL
R1(config-dhcpv6)#address prefix 2001:db8:acad:1::/64
R1(config-dhcpv6)#dns-server 2001:4860:4860::8888
R1(config-dhcpv6)#domain-name example.com
R1(config-dhcpv6)#exit
R1(config)#interface g0/0/1
R1(config-if)#ipv6 dhcp server IPV6-STATEFUL
R1(config-if)#ipv6 nd managed-config-flag
R1(config-if)#ipv6 dhcp nd prefix default no-autoconfig

Stateful DHCPv6 - Client

R3(config)#ipv6 unicast-routing
R3(config)#interface g0/0/1
R3(config-if)#ipv6 enable
R3(config-if)#ipv6 address dhcp
R3(config-if)#do show ipv6 interface brief
GigabitEthernet0/0/1
[up/up]
FE80::2FC:BAFF:FE94:29B1
2001:DB8:ACAD:1:B4CB:25FA:3C9:747C

Relay

R1(config)#interface g0/0/1
R1(config-if)#ipv6 dhcp relay destination 2001:db8:acad:1::2 g0/0/0

Debugging

R1#show ip dhcp binding and R1#show ipv6 dhcp binding

Client: FE80::5C43:EE7C:2959:DA68
DUID: 0001000124F5CEA2005056B3636D
Username : unassigned
VRF : default
IA NA: IA ID 0x03000C29, T1 43200, T2 69120
Address: 2001:DB8:ACAD:2:9C3C:64DE:AADA:7857
preferred lifetime 86400, valid lifetime 172800
expires at Sep 29 2019 08:26 PM (172710 seconds)
R1#show ipv6 dhcp interface
GigabitEthernet0/0/1 is in relay mode
Relay destinations:
2001:DB8:ACAD:1::2
2001:DB8:ACAD:1::2 via GigabitEthernet0/0/0