Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 May 2014 08:40:22 -0700
From:      Doug Ambrisko <ambrisko@ambrisko.com>
To:        amine tay <amine.tay91@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: vm+ipxe+pxeboot fail
Message-ID:  <20140506154021.GA53537@ambrisko.com>
In-Reply-To: <CAMMGsZKLkXPJAyuoiNoRo3DQEOgzMps-D7-iTThz8ARPyjZXTg@mail.gmail.com>
References:  <CAMMGsZKLkXPJAyuoiNoRo3DQEOgzMps-D7-iTThz8ARPyjZXTg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Apr 30, 2014 at 10:10:07AM +0200, amine tay wrote:
| Hi everyone,
| 
| Lately I had some problems, trying to get FreeBSD to PXE boot. (Actually
| I'm using a VMware virtual machine.) First I'm using iPXE 1.0.0 and then
| load and launch the FreeBSD pxeboot
| <http://man.freebsd.org/pxeboot>loader. But I'm getting this :
| http://forums.freebsd.org/viewtopic.php?f=4&t=45901
| When using isc-dhcp as DHCP server I'm getting the error but when using
| dnsmasq everything works fine.
| 
| The problem seems that the client when booting is sending 2 DHCP requests
| and therefore gets two different IP addresses, the first one sent by the
| ROM and the second one by the FreeBSD
| pxeboot<http://man.freebsd.org/pxeboot>loader.
| 
| I found somewhere in some posts that the pxe.c file is doing a second
| bootprequest because it fails to get cached DHCP data from the ROM.
| 
| Any help or more ideas would be appreciated.

If you do a dump on the packets you can probably see the iPXE is sending
a client ID and the pxeboot isn't.  So then ISC DHCP server doesn't like
that and gives a different IP.  Then things don't match up anymore.

This is a patch to fix libstand for iPXE but then seems to break HW PXE.
However, I'm finding with some new eval. HW, PXE is starting to fail on
something else.

Index: bootp.c
===================================================================
--- bootp.c	(revision 255868)
+++ bootp.c	(working copy)
@@ -146,8 +146,12 @@
 	if (flag & BOOTP_PXE) {
 		bp->bp_vend[7] = TAG_CLASSID;
 		bp->bp_vend[8] = 9;
-		bcopy("PXEClient", &bp->bp_vend[9], 9);
-		bp->bp_vend[18] = TAG_END;
+		bcopy(bp->bp_chaddr, &bp->bp_vend[9], 9);
+		bp->bp_vend[18] = TAG_CLIENTID;
+		bp->bp_vend[19] = 7;	/* type and length */
+		bp->bp_vend[20] = 1;	/* MAC */
+		bcopy(d->myea, &bp->bp_vend[21], 6);
+		bp->bp_vend[27] = TAG_END;
 	} else
 		bp->bp_vend[7] = TAG_END;
 #else
@@ -190,7 +194,11 @@
 			bp->bp_vend[25] = TAG_CLASSID;
 			bp->bp_vend[26] = 9;
 			bcopy("PXEClient", &bp->bp_vend[27], 9);
-			bp->bp_vend[36] = TAG_END;
+			bp->bp_vend[36] = TAG_CLIENTID;
+			bp->bp_vend[37] = 7;	/* type and length */
+			bp->bp_vend[38] = 1;	/* MAC */
+			bcopy(d->myea, &bp->bp_vend[39], 6);
+			bp->bp_vend[45] = TAG_END;
 		} else
 			bp->bp_vend[25] = TAG_END;
 

You'll need to rebuild libstand.a, rebuild pxeboot with the new libstand.a.
I haven't figure out how to determine if it needs it or not.  I ran into
this when trying to PXE boot in VirtualBox and QEMU.  There might be
an option in dhcpd.conf to disable this check for client ID.

Thanks,

Doug A.

--wac7ysb48OaltWcw
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="pxe_clientid.patch"

Index: bootp.c
===================================================================
--- bootp.c	(revision 255868)
+++ bootp.c	(working copy)
@@ -146,8 +146,12 @@
 	if (flag & BOOTP_PXE) {
 		bp->bp_vend[7] = TAG_CLASSID;
 		bp->bp_vend[8] = 9;
-		bcopy("PXEClient", &bp->bp_vend[9], 9);
-		bp->bp_vend[18] = TAG_END;
+		bcopy(bp->bp_chaddr, &bp->bp_vend[9], 9);
+		bp->bp_vend[18] = TAG_CLIENTID;
+		bp->bp_vend[19] = 7;	/* type and length */
+		bp->bp_vend[20] = 1;	/* MAC */
+		bcopy(d->myea, &bp->bp_vend[21], 6);
+		bp->bp_vend[27] = TAG_END;
 	} else
 		bp->bp_vend[7] = TAG_END;
 #else
@@ -190,7 +194,11 @@
 			bp->bp_vend[25] = TAG_CLASSID;
 			bp->bp_vend[26] = 9;
 			bcopy("PXEClient", &bp->bp_vend[27], 9);
-			bp->bp_vend[36] = TAG_END;
+			bp->bp_vend[36] = TAG_CLIENTID;
+			bp->bp_vend[37] = 7;	/* type and length */
+			bp->bp_vend[38] = 1;	/* MAC */
+			bcopy(d->myea, &bp->bp_vend[39], 6);
+			bp->bp_vend[45] = TAG_END;
 		} else
 			bp->bp_vend[25] = TAG_END;
 

--wac7ysb48OaltWcw--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140506154021.GA53537>