Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainloading #5

Open
bdzere opened this issue Jul 12, 2019 · 5 comments
Open

Chainloading #5

bdzere opened this issue Jul 12, 2019 · 5 comments
Assignees

Comments

@bdzere
Copy link

bdzere commented Jul 12, 2019

Hi JP,

Sorry for a long post, I have been using TinyPXE to chainload iPXE to install OS.

How do I chainload ipxe? In the configuration.xml, how do I specify an alternate file name or user-class i.e. winpe4.ipxe after downloading ipxe.pxe? My TFTP IP is the same as DHCP. Please see my config below. It downloads ipxe.pxe without a problem but it does not chainload the winpe file. I'm also testing with your TFTP server.

?xml version="1.0"?> <ArrayOfDHCPServerConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <DHCPServerConfiguration> <Name>DHCP</Name> <Address>10.0.0.1</Address> <NetMask>255.255.255.0</NetMask> <PoolStart>10.0.0.50</PoolStart> <PoolEnd>10.0.0.200</PoolEnd> <LeaseTime>86400</LeaseTime> <OfferTime>30</OfferTime> <MinimumPacketSize>576</MinimumPacketSize> <Options> <OptionConfiguration xsi:type="OptionConfigurationTFTPServerName"> <Mode>Default</Mode> <ZeroTerminatedStrings>true</ZeroTerminatedStrings> <Name>10.0.0.1</Name> </OptionConfiguration> <OptionConfiguration xsi:type="OptionConfigurationBootFileName"> <Mode>Default</Mode> <ZeroTerminatedStrings>true</ZeroTerminatedStrings> <Name>ipxe.pxe</Name> </OptionConfiguration> <OptionConfiguration xsi:type="OptionConfigurationTFTPServerName"> <Mode>Default</Mode> <ZeroTerminatedStrings>true</ZeroTerminatedStrings> <Name>10.0.0.1</Name> </OptionConfiguration> <OptionConfiguration xsi:type="OptionConfigurationBootFileName"> <Mode>Default</Mode> <ZeroTerminatedStrings>true</ZeroTerminatedStrings> <Name>winpe4.ipxe</Name> </OptionConfiguration> </Options> </DHCPServerConfiguration> </ArrayOfDHCPServerConfiguration>

In the DHCP Log, the Next Server Address is 0.0.0.0. How do I set this up?

2019-07-12 11:04:55.000 : INFO : DHCP : Incoming packet - parsing DHCP Message
2019-07-12 11:04:55.000 : INFO : DHCP : c->s Opcode (op) : BootRequest
c->s HardwareType (htype) : Ethernet
c->s Hops : 0
c->s XID : 677712405
c->s Secs : 4
c->s BroadCast (flags) : True
c->s ClientIPAddress (ciaddr) : 0.0.0.0
c->s YourIPAddress (yiaddr) : 0.0.0.0
c->s NextServerIPAddress (siaddr) : 0.0.0.0
c->s RelayAgentIPAddress (giaddr) : 0.0.0.0
c->s ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
c->s ServerHostName (sname) :
c->s BootFileName (file) :
c->s Option : Option(name=[MessageType],value=[DISCOVER])
c->s Option : Option(name=[ParameterRequestList],value=[SubnetMask,TimeOffset,Router,TimeServer,NameServer,DomainNameServer,ResourceLocationServer,HostName,BootFileSize,DomainName,SwapServer,RootPath,ExtensionPath,MaximumDatagramReassembly,DefaultIPTTL,BroadcastAddress,NetworkInformationServiceDomain,NetworkInformationServiceServers,NetworkTimeProtocolServers,VendorSpecificInformation,RequestedIPAddress,IPAddressLeaseTime,ServerIdentifier,RenewalTimeValue,RebindingTimeValue,VendorClassIdentifier,TFTPServerName,BootFileName,128,129,130,131,132,133,134,135])
c->s Option : Option(name=[MaximumDHCPMessageSize],value=[1260])
c->s Option : Option(name=[ClientMachineIdentifier],value=[00 27 F6 86 73 0A BE 4A 8D 8A 38 D9 9B 16 BA D1 2A])
c->s Option : Option(name=[ClientSystemArchitectureType],value=[00 00])
c->s Option : Option(name=[ClientNetworkInterfaceIdentifier],value=[01 02 01])
c->s Option : Option(name=[VendorClassIdentifier],value=[50 58 45 43 6C 69 65 6E 74 3A 41 72 63 68 3A 30 30 30 30 30 3A 55 4E 44 49 3A 30 30 32 30 30 31])

2019-07-12 11:04:55.000 : INFO : DHCP : Client 08-00-27-65-12-15 () sent DISCOVER
2019-07-12 11:04:55.000 : INFO : DHCP : Client is known, in state Assigned
2019-07-12 11:04:55.000 : INFO : DHCP : Client sent DISCOVER but we already offered, or assigned -> repeat offer with known address
2019-07-12 11:04:55.000 : INFO : DHCP : ==== Sending response to 255.255.255.255:68 ====
2019-07-12 11:04:55.000 : INFO : DHCP : s->c Opcode (op) : BootReply
s->c HardwareType (htype) : Ethernet
s->c Hops : 0
s->c XID : 677712405
s->c Secs : 0
s->c BroadCast (flags) : True
s->c ClientIPAddress (ciaddr) : 0.0.0.0
s->c YourIPAddress (yiaddr) : 10.0.0.50
s->c NextServerIPAddress (siaddr) : 0.0.0.0
s->c RelayAgentIPAddress (giaddr) : 0.0.0.0
s->c ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
s->c ServerHostName (sname) :
s->c BootFileName (file) :
s->c Option : Option(name=[MessageType],value=[OFFER])
s->c Option : Option(name=[IPAddressLeaseTime],value=[1.00:00:00])
s->c Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
s->c Option : Option(name=[SubnetMask],value=[255.255.255.0])
s->c Option : Option(name=[TFTPServerName],value=[10.0.0.1])
s->c Option : Option(name=[BootFileName],value=[ipxe.pxe])

2019-07-12 11:04:57.000 : INFO : DHCP : Incoming packet - parsing DHCP Message
2019-07-12 11:04:57.000 : INFO : DHCP : c->s Opcode (op) : BootRequest
c->s HardwareType (htype) : Ethernet
c->s Hops : 0
c->s XID : 677712405
c->s Secs : 4
c->s BroadCast (flags) : True
c->s ClientIPAddress (ciaddr) : 0.0.0.0
c->s YourIPAddress (yiaddr) : 0.0.0.0
c->s NextServerIPAddress (siaddr) : 0.0.0.0
c->s RelayAgentIPAddress (giaddr) : 0.0.0.0
c->s ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
c->s ServerHostName (sname) :
c->s BootFileName (file) :
c->s Option : Option(name=[MessageType],value=[REQUEST])
c->s Option : Option(name=[RequestedIPAddress],value=[10.0.0.50])
c->s Option : Option(name=[ParameterRequestList],value=[SubnetMask,TimeOffset,Router,TimeServer,NameServer,DomainNameServer,ResourceLocationServer,HostName,BootFileSize,DomainName,SwapServer,RootPath,ExtensionPath,MaximumDatagramReassembly,DefaultIPTTL,BroadcastAddress,NetworkInformationServiceDomain,NetworkInformationServiceServers,NetworkTimeProtocolServers,VendorSpecificInformation,RequestedIPAddress,IPAddressLeaseTime,ServerIdentifier,RenewalTimeValue,RebindingTimeValue,VendorClassIdentifier,TFTPServerName,BootFileName,128,129,130,131,132,133,134,135])
c->s Option : Option(name=[MaximumDHCPMessageSize],value=[1260])
c->s Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
c->s Option : Option(name=[ClientMachineIdentifier],value=[00 27 F6 86 73 0A BE 4A 8D 8A 38 D9 9B 16 BA D1 2A])
c->s Option : Option(name=[ClientSystemArchitectureType],value=[00 00])
c->s Option : Option(name=[ClientNetworkInterfaceIdentifier],value=[01 02 01])
c->s Option : Option(name=[VendorClassIdentifier],value=[50 58 45 43 6C 69 65 6E 74 3A 41 72 63 68 3A 30 30 30 30 30 3A 55 4E 44 49 3A 30 30 32 30 30 31])

2019-07-12 11:04:57.000 : INFO : DHCP : Client 08-00-27-65-12-15 () sent REQUEST
2019-07-12 11:04:57.000 : INFO : DHCP : Client request matches offered address -> ACK
2019-07-12 11:04:57.000 : INFO : DHCP : ==== Sending response to 255.255.255.255:68 ====
2019-07-12 11:04:57.000 : INFO : DHCP : s->c Opcode (op) : BootReply
s->c HardwareType (htype) : Ethernet
s->c Hops : 0
s->c XID : 677712405
s->c Secs : 0
s->c BroadCast (flags) : True
s->c ClientIPAddress (ciaddr) : 0.0.0.0
s->c YourIPAddress (yiaddr) : 10.0.0.50
s->c NextServerIPAddress (siaddr) : 0.0.0.0
s->c RelayAgentIPAddress (giaddr) : 0.0.0.0
s->c ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
s->c ServerHostName (sname) :
s->c BootFileName (file) :
s->c Option : Option(name=[MessageType],value=[ACK])
s->c Option : Option(name=[IPAddressLeaseTime],value=[1.00:00:00])
s->c Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
s->c Option : Option(name=[SubnetMask],value=[255.255.255.0])
s->c Option : Option(name=[TFTPServerName],value=[10.0.0.1])
s->c Option : Option(name=[BootFileName],value=[ipxe.pxe])

2019-07-12 11:05:01.000 : INFO : DHCP : Incoming packet - parsing DHCP Message
2019-07-12 11:05:01.000 : INFO : DHCP : c->s Opcode (op) : BootRequest
c->s HardwareType (htype) : Ethernet
c->s Hops : 0
c->s XID : 3801050661
c->s Secs : 4
c->s BroadCast (flags) : True
c->s ClientIPAddress (ciaddr) : 0.0.0.0
c->s YourIPAddress (yiaddr) : 0.0.0.0
c->s NextServerIPAddress (siaddr) : 0.0.0.0
c->s RelayAgentIPAddress (giaddr) : 0.0.0.0
c->s ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
c->s ServerHostName (sname) :
c->s BootFileName (file) :
c->s Option : Option(name=[MessageType],value=[DISCOVER])
c->s Option : Option(name=[MaximumDHCPMessageSize],value=[1472])
c->s Option : Option(name=[ClientSystemArchitectureType],value=[00 00])
c->s Option : Option(name=[ClientNetworkInterfaceIdentifier],value=[01 02 01])
c->s Option : Option(name=[VendorClassIdentifier],value=[50 58 45 43 6C 69 65 6E 74 3A 41 72 63 68 3A 30 30 30 30 30 3A 55 4E 44 49 3A 30 30 32 30 30 31])
c->s Option : Option(name=[77],value=[69 50 58 45])
c->s Option : Option(name=[ParameterRequestList],value=[SubnetMask,Router,DomainNameServer,LogServer,HostName,DomainName,RootPath,InterfaceMTU,VendorSpecificInformation,VendorClassIdentifier,TFTPServerName,BootFileName,119,128,129,130,131,132,133,134,135,175,203])
c->s Option : Option(name=[175],value=[B1 05 01 80 86 10 0E EB 03 01 00 00 17 01 01 22 01 01 16 01 01 13 01 01 14 01 01 11 01 01 27 01 01 19 01 01 29 01 01 10 01 02 21 01 01 15 01 01 18 01 01 23 01 01 1B 01 01 26 01 01 12 01 01])
c->s Option : Option(name=[ClientIdentifier],htype=[Unknown],value=[08 00 27 65 12 15])
c->s Option : Option(name=[ClientMachineIdentifier],value=[00 73 86 F6 27 BE 0A 8D 4A 8A 38 D9 9B 16 BA D1 2A])

2019-07-12 11:05:01.000 : INFO : DHCP : Client 08-00-27-65-12-15 () sent DISCOVER
2019-07-12 11:05:01.000 : INFO : DHCP : Client is known, in state Assigned
2019-07-12 11:05:01.000 : INFO : DHCP : Client sent DISCOVER but we already offered, or assigned -> repeat offer with known address
2019-07-12 11:05:01.000 : INFO : DHCP : ==== Sending response to 255.255.255.255:68 ====
2019-07-12 11:05:01.000 : INFO : DHCP : s->c Opcode (op) : BootReply
s->c HardwareType (htype) : Ethernet
s->c Hops : 0
s->c XID : 3801050661
s->c Secs : 0
s->c BroadCast (flags) : True
s->c ClientIPAddress (ciaddr) : 0.0.0.0
s->c YourIPAddress (yiaddr) : 10.0.0.50
s->c NextServerIPAddress (siaddr) : 0.0.0.0
s->c RelayAgentIPAddress (giaddr) : 0.0.0.0
s->c ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
s->c ServerHostName (sname) :
s->c BootFileName (file) :
s->c Option : Option(name=[MessageType],value=[OFFER])
s->c Option : Option(name=[IPAddressLeaseTime],value=[1.00:00:00])
s->c Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
s->c Option : Option(name=[SubnetMask],value=[255.255.255.0])
s->c Option : Option(name=[TFTPServerName],value=[10.0.0.1])
s->c Option : Option(name=[BootFileName],value=[ipxe.pxe])

2019-07-12 11:05:02.000 : INFO : DHCP : Incoming packet - parsing DHCP Message
2019-07-12 11:05:02.000 : INFO : DHCP : c->s Opcode (op) : BootRequest
c->s HardwareType (htype) : Ethernet
c->s Hops : 0
c->s XID : 3801050661
c->s Secs : 10
c->s BroadCast (flags) : True
c->s ClientIPAddress (ciaddr) : 0.0.0.0
c->s YourIPAddress (yiaddr) : 0.0.0.0
c->s NextServerIPAddress (siaddr) : 0.0.0.0
c->s RelayAgentIPAddress (giaddr) : 0.0.0.0
c->s ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
c->s ServerHostName (sname) :
c->s BootFileName (file) :
c->s Option : Option(name=[MessageType],value=[DISCOVER])
c->s Option : Option(name=[MaximumDHCPMessageSize],value=[1472])
c->s Option : Option(name=[ClientSystemArchitectureType],value=[00 00])
c->s Option : Option(name=[ClientNetworkInterfaceIdentifier],value=[01 02 01])
c->s Option : Option(name=[VendorClassIdentifier],value=[50 58 45 43 6C 69 65 6E 74 3A 41 72 63 68 3A 30 30 30 30 30 3A 55 4E 44 49 3A 30 30 32 30 30 31])
c->s Option : Option(name=[77],value=[69 50 58 45])
c->s Option : Option(name=[ParameterRequestList],value=[SubnetMask,Router,DomainNameServer,LogServer,HostName,DomainName,RootPath,InterfaceMTU,VendorSpecificInformation,VendorClassIdentifier,TFTPServerName,BootFileName,119,128,129,130,131,132,133,134,135,175,203])
c->s Option : Option(name=[175],value=[B1 05 01 80 86 10 0E EB 03 01 00 00 17 01 01 22 01 01 16 01 01 13 01 01 14 01 01 11 01 01 27 01 01 19 01 01 29 01 01 10 01 02 21 01 01 15 01 01 18 01 01 23 01 01 1B 01 01 26 01 01 12 01 01])
c->s Option : Option(name=[ClientIdentifier],htype=[Unknown],value=[08 00 27 65 12 15])
c->s Option : Option(name=[ClientMachineIdentifier],value=[00 73 86 F6 27 BE 0A 8D 4A 8A 38 D9 9B 16 BA D1 2A])

2019-07-12 11:05:02.000 : INFO : DHCP : Client 08-00-27-65-12-15 () sent DISCOVER
2019-07-12 11:05:02.000 : INFO : DHCP : Client is known, in state Offered
2019-07-12 11:05:02.000 : INFO : DHCP : Client sent DISCOVER but we already offered, or assigned -> repeat offer with known address
2019-07-12 11:05:02.000 : INFO : DHCP : ==== Sending response to 255.255.255.255:68 ====
2019-07-12 11:05:02.000 : INFO : DHCP : s->c Opcode (op) : BootReply
s->c HardwareType (htype) : Ethernet
s->c Hops : 0
s->c XID : 3801050661
s->c Secs : 0
s->c BroadCast (flags) : True
s->c ClientIPAddress (ciaddr) : 0.0.0.0
s->c YourIPAddress (yiaddr) : 10.0.0.50
s->c NextServerIPAddress (siaddr) : 0.0.0.0
s->c RelayAgentIPAddress (giaddr) : 0.0.0.0
s->c ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
s->c ServerHostName (sname) :
s->c BootFileName (file) :
s->c Option : Option(name=[MessageType],value=[OFFER])
s->c Option : Option(name=[IPAddressLeaseTime],value=[1.00:00:00])
s->c Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
s->c Option : Option(name=[SubnetMask],value=[255.255.255.0])
s->c Option : Option(name=[TFTPServerName],value=[10.0.0.1])
s->c Option : Option(name=[BootFileName],value=[ipxe.pxe])

2019-07-12 11:05:04.000 : INFO : DHCP : Incoming packet - parsing DHCP Message
2019-07-12 11:05:04.000 : INFO : DHCP : c->s Opcode (op) : BootRequest
c->s HardwareType (htype) : Ethernet
c->s Hops : 0
c->s XID : 3801050661
c->s Secs : 18
c->s BroadCast (flags) : True
c->s ClientIPAddress (ciaddr) : 0.0.0.0
c->s YourIPAddress (yiaddr) : 0.0.0.0
c->s NextServerIPAddress (siaddr) : 0.0.0.0
c->s RelayAgentIPAddress (giaddr) : 0.0.0.0
c->s ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
c->s ServerHostName (sname) :
c->s BootFileName (file) :
c->s Option : Option(name=[MessageType],value=[REQUEST])
c->s Option : Option(name=[MaximumDHCPMessageSize],value=[1472])
c->s Option : Option(name=[ClientSystemArchitectureType],value=[00 00])
c->s Option : Option(name=[ClientNetworkInterfaceIdentifier],value=[01 02 01])
c->s Option : Option(name=[VendorClassIdentifier],value=[50 58 45 43 6C 69 65 6E 74 3A 41 72 63 68 3A 30 30 30 30 30 3A 55 4E 44 49 3A 30 30 32 30 30 31])
c->s Option : Option(name=[77],value=[69 50 58 45])
c->s Option : Option(name=[ParameterRequestList],value=[SubnetMask,Router,DomainNameServer,LogServer,HostName,DomainName,RootPath,InterfaceMTU,VendorSpecificInformation,VendorClassIdentifier,TFTPServerName,BootFileName,119,128,129,130,131,132,133,134,135,175,203])
c->s Option : Option(name=[175],value=[B1 05 01 80 86 10 0E EB 03 01 00 00 17 01 01 22 01 01 16 01 01 13 01 01 14 01 01 11 01 01 27 01 01 19 01 01 29 01 01 10 01 02 21 01 01 15 01 01 18 01 01 23 01 01 1B 01 01 26 01 01 12 01 01])
c->s Option : Option(name=[ClientIdentifier],htype=[Unknown],value=[08 00 27 65 12 15])
c->s Option : Option(name=[ClientMachineIdentifier],value=[00 73 86 F6 27 BE 0A 8D 4A 8A 38 D9 9B 16 BA D1 2A])
c->s Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
c->s Option : Option(name=[RequestedIPAddress],value=[10.0.0.50])

2019-07-12 11:05:04.000 : INFO : DHCP : Client 08-00-27-65-12-15 () sent REQUEST
2019-07-12 11:05:04.000 : INFO : DHCP : Client request matches offered address -> ACK
2019-07-12 11:05:04.000 : INFO : DHCP : ==== Sending response to 255.255.255.255:68 ====
2019-07-12 11:05:04.000 : INFO : DHCP : s->c Opcode (op) : BootReply
s->c HardwareType (htype) : Ethernet
s->c Hops : 0
s->c XID : 3801050661
s->c Secs : 0
s->c BroadCast (flags) : True
s->c ClientIPAddress (ciaddr) : 0.0.0.0
s->c YourIPAddress (yiaddr) : 10.0.0.50
s->c NextServerIPAddress (siaddr) : 0.0.0.0
s->c RelayAgentIPAddress (giaddr) : 0.0.0.0
s->c ClientHardwareAddress (chaddr) : 08-00-27-65-12-15
s->c ServerHostName (sname) :
s->c BootFileName (file) :
s->c Option : Option(name=[MessageType],value=[ACK])
s->c Option : Option(name=[IPAddressLeaseTime],value=[1.00:00:00])
s->c Option : Option(name=[ServerIdentifier],value=[10.0.0.1])
s->c Option : Option(name=[SubnetMask],value=[255.255.255.0])
s->c Option : Option(name=[TFTPServerName],value=[10.0.0.1])
s->c Option : Option(name=[BootFileName],value=[ipxe.pxe])

@jpmikkers
Copy link
Owner

The DHCP server would need a scripting engine to be able to distinguish the initial DHCP request from the second one (so it could return the winpe filename for the latter). The scripting engine is something I've been working on but I haven't yet found a good way to make it user-friendly.

Meanwhile, I think you could apply the suggestion of the following howto http://ipxe.org/howto/chainloading , specifically the paragraph "Breaking the loop with an embedded script"

@jpmikkers jpmikkers self-assigned this Jul 13, 2019
@sval972
Copy link

sval972 commented Jul 13, 2019

When DHCP Discover/Request is sent from ipxe it sets user class (option 77) to "iPXE", in which case the server can point to ipxe script rather than to initial ipxe image. You can break the loop based on that.

@jpmikkers
Copy link
Owner

jpmikkers commented Jul 14, 2019

I'm thinking of letting option values be filled (optionally) by user-supplied powershell scripts. The powershell scripts would get access to all the information passed by the client so they could e.g. return a different bootfilename based on the presence (or value) of option 77.

@bdzere
Copy link
Author

bdzere commented Jul 15, 2019

When DHCP Discover/Request is sent from ipxe it sets user class (option 77) to "iPXE", in which case the server can point to ipxe script rather than to initial ipxe image. You can break the loop based on that.

Thanks, this works with Windows DHCP server

@bdzere
Copy link
Author

bdzere commented Jul 15, 2019

I'm thinking of letting option values be filled (optionally) by user-supplied powershell scripts. The powershell scripts would get access to all the information passed by the client so they could e.g. return a different bootfilename based on the presence (or value) of option 77.

I like the PS idea, thanks JP. This is hard work you doing here. The product works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants