How to get custom option on client from ISC DHCP server

Over ISC-DHCP server I wanted to define a custom DHCP Option, for which I am using below config

Code:
option imagefile code 224 = ip-address;

subnet 192.168.29.0 netmask 255.255.255.0 {
 range 192.168.29.1 192.168.29.244;
 option imagefile 192.168.29.113;
}

I am able to restart DHCP server after above configuration.

However on client I am not able to grab this option. I am expecting to have this information in /var/db/dhclient.leases.em0

I am having a freebsd client.

I also tried to define below config in dhclinet (onclient side )

Code:
#option imagefile code 224 = ip-address ;
interface "em0" {
  option imagefile code 224 = ip-address;
  request imagefile;
}

However my service did not get start correctly .i.e.

Code:
Starting dhclient.
/etc/dhclient.conf line 12: expecting a statement.
  option
  ^
/etc/dhclient.conf line 13: semicolon expected.
  request
  ^
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 192.168.29.113
bound to 192.168.29.234 -- renewal in 17669 seconds.

Kindly help with correct dhclient configuration or if I need to change something on isc-dhcp server to automatically get this custom option on client without defining any config on client
 
if I define it like

Code:
interface "em0" {
  request imagefile;
}

Code:
root@test:~ # service dhclient restart em0
Stopping dhclient.
Waiting for PIDS: 3678.
Starting dhclient.
/etc/dhclient.conf line 12: imagefile: unexpected option name.
  request imagefile;
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 192.168.29.113
unknown dhcp option value 0xe0
bound to 192.168.29.234 -- renewal in 16594 seconds.
 
What's the purpose of the option? There may already be an option defined for it.
 
I need to make client aware of a particular server from where they need to go and grab stuff.
That is why, I was thinking of using a custom DHCP option
 
I need to make client aware of a particular server from where they need to go and grab stuff.
Maybe you can use this option?
Code:
    option www-server ip-address [, ip-address ...];
             The www-server option specifies a list of WWW servers available
             to the client.  Servers should be listed in order of preference.
Taken from dhcp-options(5)
 
this works for me

Code:
lease {
  interface "em0";
  fixed-address 192.168.29.234;
  option subnet-mask 255.255.255.0;
  option dhcp-lease-time 42922;
  option dhcp-message-type 5;
  option dhcp-server-identifier 192.168.29.113;
  option www-server 192.168.29.113;
  renew 5 2021/3/12 03:12:04;
  rebind 5 2021/3/12 07:40:18;
  expire 5 2021/3/12 09:09:45;
}

here, dhclient config is required (not getting by just configuring on server)


Code:
interface "em0" {
  #option image code 224 = ip-address;
  request www-server;
}

But does this mean custom options are not supported ?
 
For custom options both server and client need to know about them, so have to define in both dhclient.conf and dhcpd.conf.
 
lostpacket , Yes I have tried define in both files .ie.
dhcpd.conf

Code:
option imagefile code 224 = ip-address;

subnet 192.168.29.0 netmask 255.255.255.0 {
range 192.168.29.1 192.168.29.244;
option imagefile 192.168.29.113;
}

and dhclient.conf

Code:
#option imagefile code 224 = ip-address ;
interface "em0" {
  option imagefile code 224 = ip-address;
  request imagefile;
}

But on client when try to restart it fails with imagefile: unexpected option name
 
Code:
#option imagefile code 224 = ip-address ;
interface "em0" {
  option imagefile code 224 = ip-address;
  request imagefile;
}

But on client when try to restart it fails with imagefile: unexpected option name
You've commented out the option line by starting it with a hash "#". Remove the hash.

Never mind. I should've read the whole thread.
 
so in client if I try below in /etc/dhclient.conf


Code:
request option-224;

I get below value in lease file

Code:
lease {
  interface "em0";
  fixed-address 192.168.29.88;
  option subnet-mask 255.255.255.0;
  option dhcp-lease-time 42035;
  option dhcp-message-type 5;
  option dhcp-server-identifier 192.168.29.113;
  option option-224 "http://testing.com";
  renew 6 2021/3/13 03:35:22;
  rebind 6 2021/3/13 07:58:03;
  expire 6 2021/3/13 09:25:40;
}


However not able get custom-name, which I have configured on server (.i.e. url): dhcpserver config is like


Code:
option url code 224 = string;

subnet 192.168.29.0 netmask 255.255.255.0 {
range 192.168.29.1 192.168.29.244;
#option www-server 192.168.29.113;
option url "http://testing.com";

}
 
Back
Top