• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Advanced iPXE script

Scheduled Pinned Locked Moved
General
4
6
5.7k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    Sebastian Roth Moderator
    last edited by Sebastian Roth Dec 16, 2015, 4:27 PM Dec 16, 2015, 10:24 PM

    @Tom-Elliott, @Developers, @Moderators
    I got carried away trying to improve the current iPXE script. Now that I’ve dug into the syntax and found some interesting new stuff I want to see what you guys think about this:

    #!ipxe
    isset ${net0/mac} && dhcp net0 || goto dhcpnet1
    echo Received DHCP answer on interface net0 && goto proxycheck
    
    :dhcpnet1
    isset ${net1/mac} && dhcp net1 || goto dhcperror
    echo Received DHCP answer on interface net1 && goto proxycheck
    
    :dhcperror
    prompt --key s --timeout 10000 DHCP failed, hit 's' for the iPXE shell; reboot in 10 seconds && shell || reboot
    
    :proxycheck
    isset ${proxydhcp/next-server} && isset ${next-server} && echo Duplicate option 66 (next server) from DHCP proxy and DHCP server && echo Using IP sent by DHCP proxy ${proxydhcp/next-server} && prompt --timeout 5000 || goto nextservercheck
    
    :nextservercheck
    isset ${proxydhcp/next-server} && set next-server ${proxydhcp/next-server} ||
    isset ${next-server} && goto netboot || goto setserv
    
    :setserv
    echo -n Please enter tftp server: && read next-server && goto netboot || goto setserv
    
    :netboot
    chain tftp://${next-server}/default.ipxe ||
    prompt --key s --timeout 10000 Chainloading failed, hit 's' for the iPXE shell; reboot in 10 seconds && shell || reboot
    

    Feel free to comment and improve. I’ve tested the script and tried to remember all the issues I came across in the last months but I am sure we’re not there yet.

    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

    1 Reply Last reply Reply Quote 4
    • T
      Tom Elliott
      last edited by Dec 17, 2015, 2:27 AM

      @Sebastian-Roth said:

      #!ipxe
      isset ${net0/mac} && dhcp net0 || goto dhcpnet1
      echo Received DHCP answer on interface net0 && goto proxycheck

      :dhcpnet1
      isset ${net1/mac} && dhcp net1 || goto dhcperror
      echo Received DHCP answer on interface net1 && goto proxycheck

      :dhcperror
      prompt --key s --timeout 10000 DHCP failed, hit ‘s’ for the iPXE shell; reboot in 10 seconds && shell || reboot

      :proxycheck
      isset ${proxydhcp/next-server} && isset ${next-server} && echo Duplicate option 66 (next server) from DHCP proxy and DHCP server && echo Using IP sent by DHCP proxy ${proxydhcp/next-server} && prompt --timeout 5000 || goto nextservercheck

      :nextservercheck
      isset ${proxydhcp/next-server} && set next-server ${proxydhcp/next-server} ||
      isset ${next-server} && goto netboot || goto setserv

      :setserv
      echo -n Please enter tftp server: && read next-server && goto netboot || goto setserv

      :netboot
      chain tftp://${next-server}/default.ipxe ||
      prompt --key s --timeout 10000 Chainloading failed, hit ‘s’ for the iPXE shell; reboot in 10 seconds && shell || reboot

      I like it and feel this should be amazing. And more informative to boot.

      If others don’t like it I can revert if needed, but I think more info is better.

      Thank you.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      T 1 Reply Last reply Dec 17, 2015, 2:27 AM Reply Quote 0
      • T
        Tom Elliott @Tom Elliott
        last edited by Dec 17, 2015, 2:27 AM

        In simpler terms, I added it 🙂

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • J
          Jean-Jacques Morda
          last edited by Feb 4, 2016, 1:26 PM

          In my case, i have severals DHCP on my network and this script (i suppose) make the ipxe boot taking the wrong dhcp server and trying to boot on it. You can see here the dhcp is swapping between 172.31.43.1 and 172.31.37.252. Each time i restart the fog isc dhcp server, it took the good one but each time i reboot the client, 1/2 chance the iPxe took the wrong one because my other dhcp is responding. Is that strange ?

          0_1454591736123_20160204_095414.jpg

          W 1 Reply Last reply Feb 4, 2016, 4:04 PM Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Sebastian Roth Feb 4, 2016, 8:30 AM Feb 4, 2016, 2:30 PM

            @Jean-Jacques-Morda Why do you have more than one DHCP server in your network? And why do they offer different information (next-server/option 66) to the clients. This is not strange but kind of expected and it just does not make any sense to me why you would want to have this.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 3
            • W
              Wayne Workman @Jean-Jacques Morda
              last edited by Feb 4, 2016, 4:04 PM

              @Jean-Jacques-Morda said:

              In my case, i have severals DHCP on my network and this script (i suppose) make the ipxe boot taking the wrong dhcp server and trying to boot on it. You can see here the dhcp is swapping between 172.31.43.1 and 172.31.37.252. Each time i restart the fog isc dhcp server, it took the good one but each time i reboot the client, 1/2 chance the iPxe took the wrong one because my other dhcp is responding. Is that strange ?

              If you already have another DHCP service, configure that one and turn fog’s DHCP off - or - turn off the other DHCP service, and just use FOG’s DHCP.

              If you don’t have split-scope configured correctly, you cannot run two DHCP services on the same broadcast domain anyways. You’ll have IP conflicts like crazy.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post

              209

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project