Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DHCP message configuration
2013-05-15, 03:48
Post: #1
DHCP message configuration
Hi everyone,

Is there a way to configure the DHCP process? In particular, I want to configure the DHCP Discover message, so that it includes more options in Parameter Request List (Option 55) for the server to replied with. Currently, only a restricted subset of options are requested, but I want more.

Thanks.
Find all posts by this user
Quote this message in a reply
2013-05-15, 23:47
Post: #2
RE: DHCP message configuration
(2013-05-15 03:48)Rickert Wrote:  Is there a way to configure the DHCP process? In particular, I want to configure the DHCP Discover message, so that it includes more options in Parameter Request List (Option 55) for the server to replied with. Currently, only a restricted subset of options are requested, but I want more.

There is no way (other than modifying the source code) to alter the parameter request list.

Fiddling with DHCP options is generally cumbersome; you are almost certainly better off using an iPXE script for fine-grained control of the boot process.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-05-16, 07:37 (This post was last modified: 2013-05-16 07:45 by Rickert.)
Post: #3
RE: DHCP message configuration
(2013-05-15 23:47)mcb30 Wrote:  
(2013-05-15 03:48)Rickert Wrote:  Is there a way to configure the DHCP process? In particular, I want to configure the DHCP Discover message, so that it includes more options in Parameter Request List (Option 55) for the server to replied with. Currently, only a restricted subset of options are requested, but I want more.

There is no way (other than modifying the source code) to alter the parameter request list.

Fiddling with DHCP options is generally cumbersome; you are almost certainly better off using an iPXE script for fine-grained control of the boot process.

Michael
Thanks, Micheal.

I posted another question on SO (for richer representation): How iPXE sends DHCP message

The problem is, I want to modify iPXE so that it can request all options from DHCP server, because some options indicate which environment (we have multiple server environments) iPXE is in. I need to identify the environment because init scripts need such information. Currently, retrieving DHCP options is the only way to identify the environment used by the network init script.
Find all posts by this user
Quote this message in a reply
2013-05-16, 09:57
Post: #4
RE: DHCP message configuration
(2013-05-16 07:37)Rickert Wrote:  I posted another question on SO (for richer representation): How iPXE sends DHCP message

The problem is, I want to modify iPXE so that it can request all options from DHCP server, because some options indicate which environment (we have multiple server environments) iPXE is in. I need to identify the environment because init scripts need such information. Currently, retrieving DHCP options is the only way to identify the environment used by the network init script.

Answering your StackOverflow question here:

I would strongly recommend that you do not under any circumstances use cached DHCP settings from the OEM PXE stack's DHCP request. Allow iPXE to make its own DHCP request, and it should request everything that might be relevant.

If you see "DHCP (net0 52:54:00:12:34:56)... using cached" then you are using cached DHCP settings. This is a Bad Thing.

If you are currently using undionly.kkpxe, try switching to undionly.kpxe or to ipxe.pxe.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-05-16, 10:07 (This post was last modified: 2013-05-16 10:22 by Rickert.)
Post: #5
RE: DHCP message configuration
(2013-05-16 09:57)mcb30 Wrote:  Answering your StackOverflow question here:

I would strongly recommend that you do not under any circumstances use cached DHCP settings from the OEM PXE stack's DHCP request. Allow iPXE to make its own DHCP request, and it should request everything that might be relevant.

If you see "DHCP (net0 52:54:00:12:34:56)... using cached" then you are using cached DHCP settings. This is a Bad Thing.

If you are currently using undionly.kkpxe, try switching to undionly.kpxe or to ipxe.pxe.

Michael
It's true that I used cached setting and saw that message. So I'm trying to let iPXE make its own request.

You are right that I'm using undionly.kkpx. I will switch to other options and see if it works.

What's the different between undionly.kpxe or ipxe.pxe with undionly.kkpxe?
Find all posts by this user
Quote this message in a reply
2013-05-16, 12:10
Post: #6
RE: DHCP message configuration
(2013-05-16 09:57)mcb30 Wrote:  Answering your StackOverflow question here:

I would strongly recommend that you do not under any circumstances use cached DHCP settings from the OEM PXE stack's DHCP request. Allow iPXE to make its own DHCP request, and it should request everything that might be relevant.

If you see "DHCP (net0 52:54:00:12:34:56)... using cached" then you are using cached DHCP settings. This is a Bad Thing.

If you are currently using undionly.kkpxe, try switching to undionly.kpxe or to ipxe.pxe.

Michael
I tried both undionly.kpxe and ipxe.pxe. ipxe.pxe is not compatible, while undionly.kpxe can only send DHCP messages (Discover and Request), but server returns no reply. Only undionly.kkpxe works and the embedded script has "set use-cached 0"  I captured the packets on both case using tcpdump (I stopped when iPXE finished downloading all tftp files) and inspect them with Wireshark. 

According to what you say, iPXE should request everything from the server. However, I only got a subset of specified options in /etc/dhcpd.conf, because DHCP discover message only contains that many.

Is there any other solution? If not, then I guess the only way is to modify the code.
Find all posts by this user
Quote this message in a reply
2013-05-16, 12:40
Post: #7
RE: DHCP message configuration
(2013-05-16 12:10)Rickert Wrote:  I tried both undionly.kpxe and ipxe.pxe. ipxe.pxe is not compatible, while undionly.kpxe can only send DHCP messages (Discover and Request), but server returns no reply.

This is potentially a configuration problem on your server.

Quote:Only undionly.kkpxe works and the embedded script has "set use-cached 0"  I captured the packets on both case using tcpdump (I stopped when iPXE finished downloading all tftp files) and inspect them with Wireshark. 

According to what you say, iPXE should request everything from the server. However, I only got a subset of specified options in /etc/dhcpd.conf, because DHCP discover message only contains that many.

Is there any other solution? If not, then I guess the only way is to modify the code.

Two things:

If you are still seeing the "DHCP (....) ...using cached" message then iPXE is not issuing its own DHCP request, and everything else is therefore irrelevant until you fix that problem.

There is no (sensible) way for a DHCP client to request "all" options. iPXE requests all options that it understands (i.e. all options corresponding to named settings), plus all options mandated by the PXE spec including the site-local options. Any other options would simply be ignored anyway, since no code ever accesses them.

Could you provide some more specific detail on which options you consider to be missing?

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-05-16, 13:30
Post: #8
RE: DHCP message configuration
(2013-05-16 12:40)mcb30 Wrote:  Two things:

If you are still seeing the "DHCP (....) ...using cached" message then iPXE is not issuing its own DHCP request, and everything else is therefore irrelevant until you fix that problem.

There is no (sensible) way for a DHCP client to request "all" options. iPXE requests all options that it understands (i.e. all options corresponding to named settings), plus all options mandated by the PXE spec including the site-local options. Any other options would simply be ignored anyway, since no code ever accesses them.

Could you provide some more specific detail on which options you consider to be missing?

Michael
Sorry I was a bit unclear there. When I said "set use-cached 0", which means iPXE issue its own request and not display that message. Instead, it displayed "DHCP net0 ........ok". Only undionly.kkpxe can send the message and got replied back.

When I captured the packets, only basic options (i.e. 1 or 55... as I remember) and PXE options (130,131...) are included on DHCP discover message. By "all options mandated by the PXE spec including the site-local options", do you mean that the site-local options depends on PXE ROM?

I have global specific options like

Code:
option domain-name "isc.org";
option domain-name-servers ns1.isc.org, ns2.isc.org;

as defined in dhcpd.conf

I want such options to be carried in a reply from DCHP server. Such options can be retrieved with the kernel during booting. But the problem is that I want the options before kernel start booting.

Thanks.
Find all posts by this user
Quote this message in a reply
2013-05-16, 19:36 (This post was last modified: 2013-05-16 19:38 by robinsmidsrod.)
Post: #9
RE: DHCP message configuration
Rickert: Those two options you mentioned there are available, how else would iPXE be able to resolve DNS names? They are available as ${net0/domain} and ${net0/dns} for adapter net0 or just ${dns} if you're just reading it out from the active adapter. Use the config command from the iPXE shell to see all the variables available by default.

It is also possible to instruct ISC dhcpd to send additional (non-requested) options for certain clients. I think it's described in one of the dhcpd man pages (can't recall which one).

What is it precisely you're trying to do? If we knew your end goal, maybe we could help you out with the most appropriate solution.
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-05-17, 05:28 (This post was last modified: 2013-05-17 07:42 by Rickert.)
Post: #10
RE: DHCP message configuration
(2013-05-16 19:36)robinsmidsrod Wrote:  Rickert: Those two options you mentioned there are available, how else would iPXE be able to resolve DNS names? They are available as ${net0/domain} and ${net0/dns} for adapter net0 or just ${dns} if you're just reading it out from the active adapter. Use the config command from the iPXE shell to see all the variables available by default.

It is also possible to instruct ISC dhcpd to send additional (non-requested) options for certain clients. I think it's described in one of the dhcpd man pages (can't recall which one).

What is it precisely you're trying to do? If we knew your end goal, maybe we could help you out with the most appropriate solution.
Sorry those two options I gave are bad examples. What I want is for iPXE to request custom options like this:

Code:
ption vlan-id                          code 100 = unsigned integer 16;
option system-name                     code 101 = text;
option oam-master                      code 102 = ip-address;
option static-vlan-id-list             code 103 = array of unsigned integer 16;
option is-snmp-trap-receiver           code 104 = ip-address;

These options will be used in a custom network script (one in /etc/init.d/boot.d
), after Linux finished loading vmlinuz and initrd. Before the network script can use such information, it must be retrieved by iPXE or PXE ROM (unfortunately, PXE ROM is unable to perform such request), so my only hope is iPXE. There are more options to be added later.

Edit: Ok I found out the code to add more request options in src/net/udp/dhcp.c line 76. Just added the options I wanted and it works: iPXE finally sends out messages with such options. Thanks for your help everyone. I will still try to understand and study the iPXE source code though.
Find all posts by this user
Quote this message in a reply
2013-05-17, 16:06
Post: #11
RE: DHCP message configuration
(2013-05-17 05:28)Rickert Wrote:  Sorry those two options I gave are bad examples. What I want is for iPXE to request custom options like this:
Code:
option vlan-id                          code 100 = unsigned integer 16;
option system-name                     code 101 = text;
option oam-master                      code 102 = ip-address;
option static-vlan-id-list             code 103 = array of unsigned integer 16;
option is-snmp-trap-receiver           code 104 = ip-address;

These options will be used in a custom network script (one in /etc/init.d/boot.d
), after Linux finished loading vmlinuz and initrd.
[/code]

What you should be doing is issuing a separate DHCP request from within Linux. You need to do this anyway; you can't use the IP address from iPXE indefinitely because your DHCP lease will eventually expire.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)