iPXE discussion forum

Full Version: how to do host lookups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am using a particular open source virtualisation platform, which has ipxe as the PXE implementation. In our kickstart menu (which is php), we need to do a hostname lookup to choose the appropriate local server as there are different boot servers in different global locations. Currently, on our other closed-source virtualisation platforms it is done via 'nslookup' when pxebooting. The nslookup command has not been compiled into ipxe on the open source virtualisation platform. I have requested that they add it. I could replace their ipxe rom with my own, but I thought I'd explore a different way of doing this. I've tried:

<?php $ip = gethostbyname('wds'); ?>
set wds <?php echo $ip; ?>
set net0/next-server ${wds}

However, this does not work. The lookup is successful when I use the 'show' command to print it, but it doesn't seem to get read into the variable properly. Any ideas? Or is there another way of getting this functionality?

Thanks,

Cam
(2016-06-01 14:50)iucounu9 Wrote: [ -> ]<?php $ip = gethostbyname('wds'); ?>
set wds <?php echo $ip; ?>
set net0/next-server ${wds}

However, this does not work. The lookup is successful when I use the 'show' command to print it, but it doesn't seem to get read into the variable properly. Any ideas? Or is there another way of getting this functionality?

That should work. If you fetch the generated iPXE script using a web browser, do you see what you expect? You could also try building iPXE with DEBUG=script, which will echo each script line.

Michael
Reference URL's