Method to configure DHCP server where ip pool is dedicated for specific type of client devices
Use vendor-class-identifier option
Configuration in client machine
Use tcpdump to check if vendor-class-identifier is configured in the client machine or not.
Sample tcpdump is here.. https://drive.google.com/file/d/1DbySyhLfNLXjER3BYoEscCDGHayM1Z-G/view?usp=sharing
Configure linux machine for sending vendor-class-identifier info
root@ubuntu:~# less /etc/dhcp/dhclient.conf
# Configuration file for /sbin/dhclient.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
# man page for more information about the syntax of this file
# and a more comprehensive list of the parameters understood by
# dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
# not leave anything out (like the domain name, for example), then
# few changes must be made to this file, if any.
#
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
#customize vendor class to group for ip-range
send vendor-class-identifier "kubelinux";
root@ubuntu:~# service networking restart
root@ubuntu:~# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 72:7d:66:00:de:83
inet addr:10.106.73.135 Bcast:10.106.73.255 Mask:255.255.255.128
inet6 addr: fe80::707d:66ff:fe00:de83/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4690 errors:0 dropped:0 overruns:0 frame:0
TX packets:412 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:312719 (312.7 KB) TX bytes:70102 (70.1 KB)
Useful link:https://ubuntuforums.org/showthread.php?t=946584
Use tcpdump to check if vendor-class-identifier is configured now.
Sample tcpdump is here.. https://drive.google.com/file/d/1ut68Yog9SOgaIhiCIFWoXU5rMJ9okYrQ/view?usp=sharing
Configuration is DHCP server machine
Configure DHCP server
root@k8-dhcp:~# vi /etc/dhcp/dhcpd.conf
....
class "kube" {
match if substring (option vendor-class-identifier, 0, 10) = "kubelinux";
}
subnet 10.106.73.128 netmask 255.255.255.128 {
pool {
allow members of "kube";
range 10.106.73.216 10.106.73.219;
range 10.106.73.135 10.106.73.136;
range 10.106.73.138 10.106.73.139;
option domain-name-servers 10.140.50.5;
option subnet-mask 255.255.255.128;
option routers 10.106.73.129;
option broadcast-address 10.106.73.255;
# option vendor-class-identifier "kubelinux";
default-lease-time 600;
max-lease-time 7200;
}
Useful link: https://www.linuxquestions.org/questions/linux-networking-3/use-cases-for-dhcpd-conf-classes-statement-4175429113/