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

    SVN 3080: NIC Registration

    Scheduled Pinned Locked Moved Solved
    Bug Reports
    5
    33
    11.3k
    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.
    • cspenceC
      cspence Developer
      last edited by

      Registration registers eth0 regardless of connection state.

      Version: SVN 3080
      Server OS: Debian
      NIC Not Used: eth0
      NIC Used: eth1

      PXE works fine on eth1 for me. Once the quick registration option is selected, it registers eth0 and carries on. Of course, it won’t recognize the machine on boot for imaging tasks until the MAC address is manually changed. Upon changing the MAC address to the eth1 adapter, the imaging process works fine.

      This may be related to the [URL=‘http://fogproject.org/forum/threads/multiple-nic-hosts.12511/’]other bug I reported earlier[/URL] regarding multiple NIC hosts having trouble with any tasks.

      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by

        You are absolutely right. Thanks for pointing this out!

        It’s being used like that in several locations:
        [CODE]src/buildroot/package/fog/scripts/bin/fog.auto.reg:mac=ifconfig | grep HWaddr | head -n1 | base64;
        src/buildroot/package/fog/scripts/bin/fog.checkin:mac64=ifconfig | grep HWaddr | head -n1 | base64;
        src/buildroot/package/fog/scripts/bin/fog.man.reg:mac=ifconfig | grep HWaddr | head -n1 | base64;
        src/buildroot/package/fog/scripts/bin/fog.quickimage:mac=ifconfig | grep HWaddr | head -n1 | cut -d' ' -f 11;
        src/buildroot/package/fog/scripts/bin/fog.sysinfo:mac=ifconfig | grep HWaddr | head -n1 ;[/CODE]

        I am not sure what would be the best way to clear this up?? Should be register ALL mac addresses or just the connected ones or what?

        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
        • cspenceC
          cspence Developer
          last edited by

          I would just stick with the interfaces that are currently up (just like with the client image issue we had the other week). I would assume that if a machine had used PXE to take inventory, the connected interfaces would be more useful. We could detect what interfaces are up. After that, I would have to take a look at the source to give better insight. If I get the chance this week, I’ll look at the source and see what might work.

          In the meantime, we can code for the future and use:

          [CODE]
          ip link show dev $iface | grep link/ether | xargs | cut -d ’ ’ -f 2
          [/CODE]

          1 Reply Last reply Reply Quote 0
          • cspenceC
            cspence Developer
            last edited by

            After looking over the code and testing a few things, I have a snippet of code that could replace the mac= statements. It also ditches the use of the legacy net tools command. Another thing to note, it just grabs all MAC addresses, but it makes it usable for imaging. This could be improved to make the primary (or first MAC) the active connection.

            [CODE]# Set for loop delimiters to just newline
            IFS=$‘\n’

            Create a pipe-separated MAC list

            for macline in $(ip addr show label eth* | grep link/ether)
            do
            # Add a pipe before adding more MACs
            if [ -n “$mac” ]; then
            mac=$mac|
            fi
            mac=$macecho $macline | xargs | cut -d ' ' -f 2
            done

            Reset delimiters

            IFS=[/CODE]

            This should be used for any registration functions for fog scripts. Hopefully I didn’t add in any typos this time.

            1 Reply Last reply Reply Quote 0
            • Tom ElliottT
              Tom Elliott
              last edited by

              Typos are perfectly fine, just as long as I can see them and correct them.

              I’m wondering, though, would it be better to assign all found mac’s that are connected with splice character that we already use?

              we have a function called parseMacList which uses a delimiter of | (pipe) symbol to break apart and find hosts. Using this same principle, if the returned string (base 64 decoded as needed) comes back with | I can explode it out from there and just add all the mac’s to the additional mac list of the relevant host.

              Example (I know I can do it, but i’m being particularly lazy today and possibly this week as both my wife and I are currently sick or something)

              00:12:34:56:78:01|23:45:67:89:01:23|45:67:89:01:23:45

              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
              • Tom ElliottT
                Tom Elliott
                last edited by

                And I can see you already thought of that…

                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
                • cspenceC
                  cspence Developer
                  last edited by

                  [quote=“Tom Elliott, post: 43613, member: 7271”]And I can see you already thought of that…[/quote]

                  I was about to say… 😄

                  1 Reply Last reply Reply Quote 0
                  • Tom ElliottT
                    Tom Elliott
                    last edited by

                    I’ll build a function rather than code this into the individually requested files.

                    I’ll have to adjust the service scripts so they no longer look for HWAddr in the fields, but I think it better to scan only for the mac addresses.

                    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
                    • cspenceC
                      cspence Developer
                      last edited by

                      [quote=“Tom Elliott, post: 43616, member: 7271”]I’ll build a function rather than code this into the individually requested files.

                      I’ll have to adjust the service scripts so they no longer look for HWAddr in the fields, but I think it better to scan only for the mac addresses.[/quote]

                      Sounds better to me.

                      1 Reply Last reply Reply Quote 0
                      • Tom ElliottT
                        Tom Elliott
                        last edited by

                        Oh, i do have a thought though.

                        Using the generate our interfaces file on the fly method, I can add the e-polling capabilities of the kernel to use more proper methods of device management. This means not all devices will automatically have eth* names, but rather whatever the device is. Is there a simpler way without designating the specific devices to search for?

                        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
                        • Tom ElliottT
                          Tom Elliott
                          last edited by

                          I wonder
                          [code]for macline in $(ip addr show | grep link/ether|awk ‘{print $2}’); do
                          # Add a pipe before adding more MACs
                          if [ -n “$mac” ]; then
                          mac=$mac|
                          fi
                          done[/code]

                          This, from what I can tell, should allow us to just echo back the mac variable and we don’t need the xargs and cut commands to operate as the only things returned is our pipe delimited list of MAC Addresses.

                          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
                          • Tom ElliottT
                            Tom Elliott
                            last edited by

                            [code]# Get All Active MAC Addresses
                            getMACAddresses()
                            {
                            IFS=$‘\n’
                            # Create a pipe-separated MAC List
                            for macline in $(ip addr | grep link/ether | awk ‘{print $2}’); do
                            # Add a pipe before adding more MACs
                            if [ -n “$mac” ]; then
                            mac=$mac|
                            fi
                            mac=$macecho $macline;
                            done
                            IFS=
                            echo $mac
                            }[/code]

                            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
                            • cspenceC
                              cspence Developer
                              last edited by

                              [quote=“Tom Elliott, post: 43618, member: 7271”]Oh, i do have a thought though.

                              Using the generate our interfaces file on the fly method, I can add the e-polling capabilities of the kernel to use more proper methods of device management. This means not all devices will automatically have eth* names, but rather whatever the device is. Is there a simpler way without designating the specific devices to search for?[/quote]

                              [CODE]# Set for loop delimiters to just newline
                              IFS=$‘\n’

                              Create a pipe-separated MAC list

                              for macline in $(ip addr | grep link/ether)
                              do
                              # Add a pipe before adding more MACs
                              if [ -n “$mac” ]; then
                              mac=$mac|
                              fi
                              mac=$macecho $macline | xargs | cut -d ' ' -f 2
                              done

                              Reset delimiters

                              IFS=[/CODE]

                              I just realized I was doing a grep on link/ether so that doesn’t include lo. Enjoy!

                              1 Reply Last reply Reply Quote 0
                              • S
                                Sebastian Roth Moderator
                                last edited by

                                Not using any extra ip tools … /sys/class/net/*/address …

                                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
                                • cspenceC
                                  cspence Developer
                                  last edited by

                                  [code]# Get All Active MAC Addresses
                                  getMACAddresses()
                                  {
                                  IFS=$‘\n’
                                  # Create a pipe-separated MAC List
                                  for macline in $(ip addr | grep link/ether | awk ‘{print $2}’); do
                                  # Add a pipe before adding more MACs
                                  if [ -n “$mac” ]; then
                                  mac=$mac|
                                  fi
                                  mac=${mac}${macline};
                                  done
                                  IFS=
                                  echo $mac
                                  }[/code]

                                  Caught a bug with your final mac= statement. Also, “ip addr” is fine by itself.

                                  1 Reply Last reply Reply Quote 0
                                  • Tom ElliottT
                                    Tom Elliott
                                    last edited by

                                    yeah I saw and edited. The echo needs to occur there. and I am using just ip addr

                                    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
                                    • Tom ElliottT
                                      Tom Elliott
                                      last edited by

                                      [quote=“Uncle Frank, post: 43623, member: 28116”]Not using any extra ip tools … /sys/class/net/*/address …[/quote]

                                      We have to know the exact path name, so it’s simpler to just use the tools that get that for us I think.

                                      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
                                      • S
                                        Sebastian Roth Moderator
                                        last edited by

                                        [quote=“Tom Elliott, post: 43626, member: 7271”]We have to know the exact path name, so it’s simpler to just use the tools that get that for us I think.[/quote]
                                        I don’t think so…
                                        [CODE]# Get All Active MAC Addresses
                                        getMACAddresses()
                                        {
                                        IFS=$‘\n’
                                        # Create a pipe-separated MAC List
                                        for macline in $(cat /sys/class/net/*/address); do
                                        # Add a pipe before adding more MACs
                                        if [ -n “$mac” ]; then
                                        mac=$mac|
                                        fi
                                        mac=${mac}${macline};
                                        done
                                        IFS=
                                        echo $mac
                                        }[/CODE]
                                        No ip, no awk, no grep…

                                        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
                                        • S
                                          Sebastian Roth Moderator
                                          last edited by

                                          And I still wonder, why do we need the IFS here??

                                          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
                                          • cspenceC
                                            cspence Developer
                                            last edited by

                                            [quote=“Uncle Frank, post: 43627, member: 28116”]I don’t think so…
                                            [CODE]# Get All Active MAC Addresses
                                            getMACAddresses()
                                            {
                                            IFS=$‘\n’
                                            # Create a pipe-separated MAC List
                                            for macline in $(cat /sys/class/net/*/address); do
                                            # Add a pipe before adding more MACs
                                            if [ -n “$mac” ]; then
                                            mac=$mac|
                                            fi
                                            mac=${mac}${macline};
                                            done
                                            IFS=
                                            echo $mac
                                            }[/CODE]
                                            No ip, no awk, no grep…[/quote]

                                            It grabs lo’s MAC. But I like where this is going…

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

                                            148

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project