Dynamic Host Configuration Protocol
Service sur le port 67 en UDP (bootps)
Client sur le port 68 en UDP (bootpc)
Liste des options de configuration disponibles:
Options DHCP
Debian
tcpdump -n -i {iface} port bootpc or port bootps
DHCP service
isc-dhcp-server /var/lib/dhcp/dhcpd.leases
/etc/dhcp/dhcpd.conf
option domain-name "michel-joly.fr";
option domain-name-servers ns1.michel-joly.fr;
option domain-search "michel-joly.fr";
default-lease-time 28200;
max-lease-time 28800;
subnet 192.168.42.0 netmask 255.255.255.0 {
range 192.168.42.100 192.168.42.130;
option routers 192.168.42.254;
}
host workstation{
hardware ethernet 70:85:c2:fc:8b:b0;
fixed-address 192.168.42.1;
}
Classes DHCP
# Le sous réseau auquel appartient notre serveur DHCP
subnet 192.168.42.0 netmask 255.255.255.0 {
range 192.168.42.1 192.168.42.99;
option domain-name-servers 192.168.42.250,192.168.42.251;
option domain-name "mic.local";
option routers 192.168.42.254;
default-lease-time 28200;
max-lease-time 28800;
}
class "class1"{
match if substring (option user-class,0,6)="class1";
}
# Le deuxième sous-réseau : la configuration reste la même que pour un sous réseau # normal, avec les mêmes possibilités d’options
subnet 192.168.142.0 netmask 255.255.255.0 {
option domain-name-servers 192.168.42.250, 192.168.42.251;
option routers 192.168.142.254;
pool {
allow members of "class1";
range 192.168.42.100 192.168.42.110;
option domain-name "class1.local";
#on donne la passerelle aux clients de la class1
option routers 192.168.42.254;
}
pool {
allow unknown-clients;
deny members of "class1";
range 192.168.42.200 192.168.42.240;
option domain-name "visiteurs.local";
}
}
Debian DHCP relay
isc-dhcp-relay
Le fichier de configuration :
/etc/default/isc-dhcp-relay
# What servers should the DHCP relay forward requests to?
SERVERS="192.168.42.250"
# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
INTERFACES="enp0s8 enp0s3"
Client
/etc/dhcp/dhclient.conf
dhclient -r {iface}
dhclient {iface}
Windows
Transfert de configuration en powershell
Export-DHCPServer -ComputerName {former_dhcp_server} -File {file_path.xml}
Import-DHCPServer -File {file_path.xml} -BackupPath
Cisco
Configuration
> en
# conf t
# (config) service dhcp
# (config) ip dhcp pool {nom}
# (dhcp-config) network {adresse_reseau} {masque}
# (dhcp-config) default-router {adresse_passerelle}
# (dhcp-config) dns-server {ip}
# (dhcp-config) option {num_option}
Status et Capture de paquet
Configuration des reseaux DHCP
> en
# conf t
# (config) show ip dhcp pool
capture des requetes
# (config-if) ip dhcp snooping [vlan {vlan_id}]
# (config-if) ip dhcp snooping information option
# (config) show ip dhcp snooping database [detail]