Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iPXE to redirect boot to another PXE server
2013-04-02, 14:40
Post: #1
iPXE to redirect boot to another PXE server
Hi all,

Is there a way to instruct iPXE to make a normal PXE boot to a specified PXE server (regardless of what DHCP says) ?

I would like to use a PXE iPXE boot to make a boot redirection to other PXE environnement (PXE server listening on port 4011). A sort of PXE redirection...

Thank you

Nicolas
Find all posts by this user
Quote this message in a reply
2013-04-02, 14:45
Post: #2
RE: iPXE to redirect boot to another PXE server
Port 4011 is the port usually used in ProxyDHCP, which is most likely what you want. Read up on PXE fundamentals linked to from http://networkboot.org/.

If your DHCP server doesn't set "next-server" and "filename", and you have a ProxyDHCP server running on your network that provides these values, it should be picked up automatically by iPXE. If it is not doing that, I suggest you try a packet trace to figure out what's going on.
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-04-02, 15:02
Post: #3
RE: iPXE to redirect boot to another PXE server
Thank you for this answer. In fact, I'm looking for a way to boot to a specific PXE server (other PXE technology) as if it was given by my DHCP.

This could be :
DHCP tells to boot iPXE server -> iPXE define alternate boot server and tells client to make a new PXE boot to this alternate server.

Thank you

Nicolas
Find all posts by this user
Quote this message in a reply
2013-04-03, 17:07
Post: #4
RE: iPXE to redirect boot to another PXE server
Have a look at the http://ipxe.org/cmd/chain page. Generally you can forward to another PXE server like this:

Code:
#!ipxe
chain tftp://10.1.2.3/pxelinux.0

Be aware though, if the other PXE NBP (Network Bootable Program) performs another DHCP request to retrieve information, it most likely will receive it from the same DHCP server, which will give out the original response. You might need to trick your DHCP server into giving different programs different responses. If you're using ISC DHCP this is quite possible with conditional clauses. But this is considered a quite advanced topic. You can find pointers to this and more from the http://ipxe.org/examples page.
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-04-04, 07:17
Post: #5
RE: iPXE to redirect boot to another PXE server
Thank you, interesting, I will try, but it may not work for all my PXE solutions.

The problem is, as fas as I understood how my other PXE solutions are working (commercial products), they expect a request on port 4011 (proxyDHCP) as if my DHCP was only configured with option 60 "PXEClient" and target IP in option 43. I think this is because they create "on the fly" the bootfile given to the client.

Is there a way to make this kind of request from iPXE, regardless what DHCP gave to the client ? (a unicast proxyDHCP request : DHCPREQUEST with proper PXEClient:Arch:xxxxx:UNDI:yyyzzz) ?

Thank you
Find all posts by this user
Quote this message in a reply
2013-04-05, 23:40
Post: #6
RE: iPXE to redirect boot to another PXE server
What is your other PXE server ?
Find all posts by this user
Quote this message in a reply
2013-04-06, 06:48
Post: #7
RE: iPXE to redirect boot to another PXE server
I have several PXE solutions, but it seems the most difficult to redirect to is TPM4OSD, because the request to the local proxyDHCP service seems to be mandatory
Find all posts by this user
Quote this message in a reply
2013-04-12, 15:51
Post: #8
RE: iPXE to redirect boot to another PXE server
I found that, using the pxebs function and then, modifying the target PXE server IP, the request sent to the PXE server is a ProxyDHCP request and is working well. Only problem : I had to change source code to be able to force an alternate IP than the one give by the DHCP...
Find all posts by this user
Quote this message in a reply
2013-04-15, 13:34
Post: #9
RE: iPXE to redirect boot to another PXE server
(2013-04-12 15:51)Kirioss Wrote:  I found that, using the pxebs function and then, modifying the target PXE server IP, the request sent to the PXE server is a ProxyDHCP request and is working well. Only problem : I had to change source code to be able to force an alternate IP than the one give by the DHCP...

You definitely don't need to modify the source code to do this.

You can set an explicit IP address using something like:

Code:
set net0/ip 192.168.0.100
set net0/netmask 255.255.255.0
set net0/gateway 192.168.0.1

Any IP address set in this way will override an IP address provided by the DHCP server.

The gritty details are that the DHCP-provided IP address will end up as ${net0.dhcp/ip}. If you explicitly specify ${net0/ip}, then this will override ${net0.dhcp/ip} since it is at a higher scope. You can get a feel for how this works using the config command: try obtaining an IP address using dhcp, then do config net0, enter a value for "ip" and then clear it with Ctrl-D.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-04-15, 14:39 (This post was last modified: 2013-04-15 14:42 by Kirioss.)
Post: #10
RE: iPXE to redirect boot to another PXE server
I may not understand your answer, but the IP I need to modify is not the client IP but the PXE server IP given by the DHCP (I want to overwrite it regarding some external rules)

My ugly code modification (for testing purposes) is in start_pxebs in src/net/udp/dhcp.c

Code:
/* Dump out PXE server lists */
    DBGC ( dhcp, "DHCP %p attempting", dhcp );
    for ( ip = dhcp->pxe_attempt ; ip->s_addr ; ip++ )
        DBGC ( dhcp, " %s", inet_ntoa ( *ip ) );
         inet_aton ("10.1.2.3",ip);      // <---- HERE
    DBGC ( dhcp, "\n" );
Find all posts by this user
Quote this message in a reply
2013-04-15, 14:55
Post: #11
RE: iPXE to redirect boot to another PXE server
(2013-04-15 14:39)Kirioss Wrote:  I may not understand your answer, but the IP I need to modify is not the client IP but the PXE server IP given by the DHCP (I want to overwrite it regarding some external rules)

My ugly code modification (for testing purposes) is in start_pxebs in src/net/udp/dhcp.c

Code:
/* Dump out PXE server lists */
    DBGC ( dhcp, "DHCP %p attempting", dhcp );
    for ( ip = dhcp->pxe_attempt ; ip->s_addr ; ip++ )
        DBGC ( dhcp, " %s", inet_ntoa ( *ip ) );
         inet_aton ("10.1.2.3",ip);      // <---- HERE
    DBGC ( dhcp, "\n" );

OK, I think I see what you're trying to do. You should try something like this:

Code:
# Set PXE boot server discovery control: no broadcast, no multicast, no unknown servers
set 43.6:uint8 7
# Set PXE boot server IP address
set 43.8:ipv4 10.1.2.3
# Perform PXE boot server discovery
pxebs net0

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-04-15, 16:18
Post: #12
RE: iPXE to redirect boot to another PXE server
Thank you

pxebs net0 does not meet usage, I tried
pxebs net0 3840 but I receive a 0x1c106002 error
Find all posts by this user
Quote this message in a reply
2013-04-15, 16:31
Post: #13
RE: iPXE to redirect boot to another PXE server
(2013-04-15 16:18)Kirioss Wrote:  pxebs net0 does not meet usage, I tried
pxebs net0 3840 but I receive a 0x1c106002 error

My fault; the PXE boot server list (option 43.8) is not simply an array of IPv4 addresses. You'll need something like this:

Code:
# Set boot server type
set pxebs_type:uint8 42  # or whatever value you want for the type
# Set PXE boot server IP address
set pxebs_ip:ipv4 10.1.2.3
# Construct PXE boot server list
set 43.8:hex ${pxebs_type:hex}:00:01:${pxebs_ip:hex}
# Set PXE boot server discovery control: no broadcast, no multicast, no unknown servers
set 43.6:uint8 7
# Perform PXE boot server discovery
pxebs net0 ${pxebs_type}

This assumes that your ${pxebs_type} is in the range 0-255. If you go over this range, you'll need to handle the fact that it gets encoded into option 43.8 as a little-endian 16-bit quantity (which can't directly be expressed within the iPXE scripting language).

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-04-15, 18:13 (This post was last modified: 2013-04-15 18:24 by Kirioss.)
Post: #14
RE: iPXE to redirect boot to another PXE server
Thank you

I think the pxebs type is 3840... not lucky :-(

43.8 has to be defined has follow in my DHCP : 080B000F020A0102030A010204 where
08 : the 43.8 option
0B : size of 08 option (11 hex)
000F : PXE server type
02 : number of PXE servers
0A010203 : 10.1.2.3 (server 1)
0A010204 : 10.1.2.4 (server 2)

43.6 is 060107 (unicast)

There is also a 09 and 0A option for the PXE menu
Find all posts by this user
Quote this message in a reply
2013-04-15, 18:45 (This post was last modified: 2013-04-15 18:45 by mcb30.)
Post: #15
RE: iPXE to redirect boot to another PXE server
(2013-04-15 18:13)Kirioss Wrote:  I think the pxebs type is 3840... not lucky :-(

It's not a huge problem: you just need to be aware of it. You could construct the entire option 43.8 manually if you prefer:

Code:
set 43.8:hex 00:0f:02:0a:01:02:03:0a:01:02:04
set 43.6:uint8 7
pxebs net0 3840

The more complex example I gave previously is designed to make it easier to edit in future if you need to e.g. change the server IP addresses. To produce the same end result for options 43.8 and 43.6, you could use:

Code:
# Boot server type = 0x0f00 = 3840
set pxebs_low:uint8 0x00
set pxebs_high:uint8 0x0f
# Boot server 1 IP address
set pxebs_ip1:ipv4 10.1.2.3
set pxebs_ip2:ipv4 10.1.2.4
# Calculate boot server type
set pxebs_type:hex ${pxebs_high:hex}:${pxebs_low:hex}
# Construct PXE boot server list
set 43.8:hex ${pxebs_low:hex}:${pxebs_high:hex}:02:${pxebs_ip1:hex}:${pxebs_ip2:hex}
# Set PXE boot server discovery control: no broadcast, no multicast, no unknown servers
set 43.6:uint8 7
# Perform PXE boot server discovery
pxebs net0 ${pxebs_type:uint16}

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-04-15, 19:06
Post: #16
RE: iPXE to redirect boot to another PXE server
I've only tested the first one for this evening and it is working perfectly !!!

Thank you very much !
Find all posts by this user
Quote this message in a reply
2017-02-12, 21:07
Post: #17
RE: iPXE to redirect boot to another PXE server
Thanks for this, need to test it for UEFI PXE->iPXE->WDS
Find all posts by this user
Quote this message in a reply
Post Reply 




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