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

FOG DHCP bug/feature request

Scheduled Pinned Locked Moved Solved
Bug Reports
2
17
5.6k
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.
  • T
    Tom Elliott @Wayne Workman
    last edited by Jul 31, 2015, 12:34 PM

    @Wayne-Workman I’ve added two new functions to the installer itself. cidr2mask and mask2cidr. We probably only need to worry about the cidr2mask function but I figure if it’s worth doing, it’s worth doing in both directions.

    I’m also rewriting the configureDHCP function to be in the common/functions.sh and going to work on getting it to automate this.

    For example, ranges should really be determined by the subnet mask of the network you’re working with. Of course you want the range to not include your FOG Server’s IP, so maybe just +1 form the fog server’s IP and up would work.

    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

    W 1 Reply Last reply Jul 31, 2015, 12:53 PM Reply Quote 0
    • W
      Wayne Workman @Tom Elliott
      last edited by Jul 31, 2015, 12:53 PM

      @Tom-Elliott said:

      Of course you want the range to not include your FOG Server’s IP, so maybe just +1 form the fog server’s IP and up would work.

      Our fog server is not the only static IP we have, we have 20 or so network printers, 5 servers, probably 20 or 30 switches, network connected battery backups, and 20 to 25 regular desktops that are static.

      our subnet range is 10.2.0.0 to 10.2.15.254

      Our DHCP range is 10.2.3.0 to 10.2.12.255 and the edges that arent’ included are purposely reserved for static IPs.

      Of course not everyone uses BOTH edges, but we do. I think the default range should be displayed to the user during the installer, and the user can accept it, or define their own range if they would like, just like other fog options are set up.

      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
      • W
        Wayne Workman
        last edited by Wayne Workman Jul 31, 2015, 3:42 PM Jul 31, 2015, 9:40 PM

        From a lot of posts around the net, I’ve been able to put this together. It accurately returns the subnet mask for the default interface.

        function GetLocalSubnetMask() {
        
        #get default interface's IP and subnet mask.
        default_info=$(ip route list | awk '/^default/ {print $5}')
        default_info=$(ip -o -f inet addr show $default_info | awk '{print $4}')
        
        #cut the CIDR value off:
        CIDR=${default_info#*/}
        
        #Convert CIDR to subnet mask:
          local i mask=""
          local full_octets=$(($CIDR/8))
          local partial_octet=$(($CIDR%8))
        
          for ((i=0;i<4;i+=1)); do
            if [ $i -lt $full_octets ]; then
              mask+=255
            elif [ $i -eq $full_octets ]; then
              mask+=$((256 - 2**(8-$partial_octet)))
            else
              mask+=0
            fi
            test $i -lt 3 && mask+=.
          done
        
          echo $mask
        }
        
        SubnetMask=$(GetLocalSubnetMask)
        echo $SubnetMask
        

        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
        • T
          Tom Elliott
          last edited by Aug 2, 2015, 3:42 AM

          While I’m not resolving this post quite yet the current version of trunk/dev fog now create the subnet place holder based on the fog servers ip subnet. This will likely fail for those using hostnames as the ip which I need to get the real interfaces ip, based on the interface if specified.

          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

          W 1 Reply Last reply Aug 3, 2015, 7:37 PM Reply Quote 0
          • W
            Wayne Workman @Tom Elliott
            last edited by Aug 3, 2015, 7:37 PM

            @Tom-Elliott Just an update on this, I was able to play with the latest FOG Trunk today (don’t know what revision), and I noticed that the subnet mask is calculated CORRECTLY, however the network address and ranges are still wrong.

            I’m not sure how far along in implementation this is, I’m just reporting on what was seen.

            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
            • W
              Wayne Workman
              last edited by Wayne Workman Aug 4, 2015, 7:03 AM Aug 4, 2015, 1:00 PM

              @Tom-Elliott

              Here are the .fogsettings and dhcpd.conf files from that location. We re-enabled DHCP in the.fogsettings file and we updated to the latest this morning. Progress is looking good, but the ranges didn’t use what we defined during installation.

              We use the -s and -e arguments to install like this:

              ./installfog.sh -s 10.12.5.0 -e 10.12.7.255 -y
              

              However you will see below that the ranges passed to the installer were not stored correctly inside of .fogsettings (unless we passed the ranges wrong in the install command?).

              Also - even after we manually corrected the start and end ranges in the .fogsettings file and reran the installer using just the -y argument, it did not use the specified start and end addresses and used what is seen below in the dhcpd.conf file.

              However we have noticed that now the subnet masks and the network address are correct.

              Also, a much more minor problem, there’s some formatting issues in the installer output - trivial. See the picture at the end.

              [root@CKFOG dhcp]# cat /opt/fog/.fogsettings
              ## Created by the FOG Installer
              ## Version: 4301
              ## Install time: Tue 04 Aug 2015 07:33:29 AM CDT
              
              ipaddress="10.12.1.11";
              interface="eno1";
              submask="255.255.240.0";
              routeraddress="         option routers      10.12.15.254;";
              plainrouter="10.12.15.254";
              dnsaddress="    option domain-name-servers      10.51.1.6; ";
              dnsbootimage="10.51.1.6";
              password='xxxxxxxxx';
              osid="1";
              osname="Redhat";
              dodhcp="y";
              bldhcp="1";
              installtype="N";
              snmysqluser=""
              snmysqlpass='';
              snmysqlhost="";
              installlang="0";
              donate="0";
              storageLocation="/images";
              mysql_conntype="MYSQLI_ASYNC";
              fogupdateloaded="1";
              storageftpuser="fog";
              storageftppass='xxxxxxxxxxxx';
              docroot="/var/www/html/";
              webroot="fog/";
              caCreated="yes";
              startrange="10.12.1.10";
              endrange="10.12.1.254";
              
              [root@CKFOG dhcp]# cat dhcpd.conf
              # DHCP Server Configuration file
              #see /usr/share/doc/dhcp*/dhcpd.conf.sample
              # This file was created by FOG
              
              #Definition of PXE-specific options
              # Code 1: Multicast IP Address of bootfile
              # Code 2: UDP Port that client should monitor for MTFTP Responses
              # Code 3: UDP Port that MTFTP servers are using to listen for MTFTP requests
              # Code 4: Number of seconds a client must listen for activity before trying
              #         to start a new MTFTP transfer
              # Code
                  5: Number of seconds a client must listen before trying to restart
              #         a MTFTP transfer
              
              
              option space PXE;
              option PXE.mtftp-ip code 1 = ip-address;
              option PXE.mtftp-cport code 2 = unsigned integer 16;
              option PXE.mtftp-sport code 3 = unsigned integer 16;
              option PXE.mtftp-tmout code 4 = unsigned integer 8;
              option PXE.mtftp-delay code 5 = unsigned integer 8;
              option arch code 93 = unsigned integer 16; # RFC4578
              
              
              use-host-decl-names on;
              ddns-update-style interim;
              ignore client-updates;
              next-server 10.12.1.11;
              
              
              # Specify subnet of ether device you do NOT want service. for systems with
              # two or more ethernet devices.
              # subnet 136.165.0.0 netmask 255.255.0.0 {}
              
              
              subnet 10.12.0.0 netmask 255.255.240.0 {
                      option subnet-mask 255.255.240.0;
                      range dynamic-bootp 10.12.1.10 10.12.1.254;
                      default-lease-time 21600
                      max-lease-time 43200;
                              option domain-name-servers      10.51.1.6;
                                      option routers      10.12.15.254;
                      filename ;
              }
              

              Formatting.png

              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
              • T
                Tom Elliott
                last edited by Aug 5, 2015, 10:21 PM

                @Wayne-Workman I’m going to solve this thread. Of course if there’s other issues I need to be made aware of about this, go ahead an reset as unsolved and add your info.

                Thanks.

                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
                • W
                  Wayne Workman
                  last edited by Wayne Workman Aug 5, 2015, 4:26 PM Aug 5, 2015, 10:22 PM

                  @Developers this is r4339 on Fedora 21

                  There is a bug in the current DHCP config generated by fog.

                  #This line is missing the colon at the end:
                  default-lease-time 21600;
                  
                  #This line is missing the default undionly.kpxe file name.
                   filename "undionly.kpxe";
                  

                  Also, it would seem that Linux DHCP cannot run on the same machine that dnsmasq is running on 😛

                  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
                  • W
                    Wayne Workman
                    last edited by Wayne Workman Aug 5, 2015, 4:48 PM Aug 5, 2015, 10:47 PM

                    @Tom-Elliott I installed using this line at home:

                    ./installfog.sh -s 10.0.0.21 -e 10.0.0.254 -y
                    

                    And it did not store the range in the /etc/dhcp/dhcpd.conf file.

                    I did install with DHCP just prior to trying this - and previously the conf file had 10.0.0.20 as the start range because I manually edited it. I just ran the installer with the above arguments to see if it would update the starting range. It did not update 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!
                    Daily Clean Installation Results:
                    https://fogtesting.fogproject.us/
                    FOG Reporting:
                    https://fog-external-reporting-results.fogproject.us/

                    1 Reply Last reply Reply Quote 0
                    • T
                      Tom Elliott
                      last edited by Aug 6, 2015, 12:08 PM

                      This is now fixed in svn/trunk/git whatever you want to call it.

                      I confirmed that it stores the IP and knows that it’s valid.

                      SVN 3861, FOG Version in cloud is: 4353.

                      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

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

                      184

                      Online

                      12.0k

                      Users

                      17.3k

                      Topics

                      155.2k

                      Posts
                      Copyright © 2012-2024 FOG Project