[syslinux] Can this be done with PXELinux?

Florin Izvoranu florin at cpi.ro
Mon Mar 13 04:51:43 PST 2006


On Sunday 12 March 2006 01:05 am, Kenneth Vandbæk wrote:
> Hi
>
> This is what I like to be able to do.
>
> 1. Computer boot on LAN, using PXELinux.
>
> 2. If the computer is booting for the first time it sends MAC adr, RAM,
> size of harddrive and name of videocard to a shared folder on a computer,
> maybe a server, that is attached to the network.
>
> 3. If this is not the first time it scan for a new task, could be a new
> ghostimage or an unattended installation of a OS, if there isn't a new task
> it boot from harddrive.
>
> Can this be done with PXELinux?
>
> Feel free to ask for more questions if you don't understand the senario.
> I'm new in this, so sorry for my poor knowledge.
>
>
> /Kenneth

Hi
Use pxelinux file selection mechanism:
from doc http://syslinux.zytor.com/pxe.php#config
 
> ... If that file is not found, it will remove one hex digit and try again. 
Ultimately, it will try looking for a file named default  (in lower case). As 
an example, if the boot file name is /mybootdir/pxelinux.0, the Ethernet MAC 
address is 88:99:AA:BB:CC:DD and the IP address 192.0.2.91, it will try:
> 
> 	/mybootdir/pxelinux.cfg/01-88-99-aa-bb-cc-dd
> 	/mybootdir/pxelinux.cfg/C000025B
> 	/mybootdir/pxelinux.cfg/C000025
> 	/mybootdir/pxelinux.cfg/C00002
> 	/mybootdir/pxelinux.cfg/C0000
> 	/mybootdir/pxelinux.cfg/C000
> 	/mybootdir/pxelinux.cfg/C00
> 	/mybootdir/pxelinux.cfg/C0
> 	/mybootdir/pxelinux.cfg/C
> 	/mybootdir/pxelinux.cfg/default
>  
> 
>     ... in that order.
> ...

If is an old PC some of config file is used excepting default

 if is first time booting it is unknown MAC to dhcp server , give it an 
dynamic IP address outside known hosts IP range and it will use default 
config file.

ex: 

I use IP from 10.0.1.0 to 10.0.100.255  for known hosts
and "range 10.10.0.10 10.10.0.255;"  for unknown hosts in dhcpd.conf

This will lead to /tftpboot/pxelinux.cfg/default config file which points to:
1. linux + initrd doing whatever you want (auto appending itself to 
dhcpd.conf , DNS, pxelinux.cfg   etc.)

or
2.
 halt.com[1] which shutdowns the PC (put halt.com in /tftpboot dir).

Put syslogd to send a message to you (man syslog.conf) when it sees 
"DHCPACK on 10.10."  lines and from this line get the MAC of new PC;

put it in dhcpd.conf with an ip for known hosts or
 new name(and add it in DNS);
cd /tftpboot/pxelinux.cfg
ln -s TSClient    `gethostip -x IP_of_new_PC`
wakeonlan ${MAC}

Sorry for my  english
Florin

P.S.
I run dhcpd under supervise[2] with multilog [2].
multilog stderr points to a pipe;
exec 2>/tmp/pipe_new_pc
_e_ action of multilog sends selected line to stderr :
"     '-*' '+* DHCPACK on 10.10.*to*'    e   "

pipe_new_pc is read by new_pc.sh program which creates new DNS & DHCP entries 
incremental (ex: pc0123.example.org for first PC, pc0124.example.org for next 
PC) and a cdb with name to MAC mappings for wake on lan.

P.P.S.
to H.P.A.
can tftpd be made to run in foreground , logging to stdout or stderr ?





[1] http://strange.nsk.pt/old/halt.com shutdowns the PC using APM 
[2] http://cr.yp.to/daemontools.html




More information about the Syslinux mailing list