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

Multiple NIC Hosts

Scheduled Pinned Locked Moved Solved
Bug Reports
4
32
10.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.
  • C
    cspence Developer
    last edited by Feb 28, 2015, 3:38 AM

    [quote=“Wayne Workman, post: 42928, member: 28155”]^ this guy needs to be a regular here.

    Clearly a power user, if I ever saw one.[/quote]

    Well, it’s my first week playing with FOG finally. As I slowly familiarize myself with the structure of FOG, you should expect better diagnoses. You’ll probably see me hunting down more issues as we go.

    As someone who is a system administrator for a cyber security program’s air-gapped hacking proving ground at a University, you could say power user. 🙂 I’m looking forward to getting this deployed in the next few weeks in my network. I have been dying for a decent solution for deploying Linux and Windows images multiple times in a day within small windows of time.

    1 Reply Last reply Reply Quote 0
    • S
      Sebastian Roth Moderator
      last edited by Feb 28, 2015, 9:54 AM

      Oh well, that’s interesting. So I guess we would have to “detect” NICs first and then generate /etc/network/interfaces from that. Just a quick scatch of a script that might be helpful with that:
      [CODE]for iface in $(ls -1 /sys/class/net | tr -d ‘@’)
      do

      all interface need to be up or you will get an invalid

      argument error when checking the link state

      ifconfig $iface up
      linkstate=$(cat /sys/class/net/$iface/carrier)
      if [[ “x$linkstate” = “x1” ]]
      then
      if [[ “x$iface” = “xlo” ]]
      then
      echo “auto lo”
      echo “iface lo inet loopback”
      else
      echo “auto $iface”
      echo “iface $iface inet dhcp”
      echo “udhcpc_opts -t 100 -T 20”
      fi
      fi
      done[/CODE]

      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
      • C
        cspence Developer
        last edited by Feb 28, 2015, 4:46 PM

        Added full paths. Replaced the ifconfig with the iproute2 replacement (it’s best to move away from a legacy tool). Redirected output to /etc/network/interfaces. If we slap this into /etc/init.d/S40network before the case statement, that should be a fix. I’ll be able to test it on Monday.

        [CODE]for iface in $(ls -1 /sys/class/net | tr -d ‘@’)
        do

        all interface need to be up or you will get an invalid

        argument error when checking the link state

        /sbin/ip link set $iface up
        linkstate=$(/bin/cat /sys/class/net/$iface/carrier)
        if [[ “x$linkstate” = “x1” ]]
        then
        if [[ “x$iface” = “xlo” ]]
        then
        echo “auto lo” > /etc/network/interfaces
        echo “iface lo inet loopback” >> /etc/network/interfaces
        else
        echo “auto $iface” >> /etc/network/interfaces
        echo “iface $iface inet dhcp” >> /etc/network/interfaces
        echo -e “\tudhcpc_opts -t 100 -T 20\n” >> /etc/network/interfaces
        fi
        fi
        done[/CODE]

        1 Reply Last reply Reply Quote 0
        • T
          Tom Elliott
          last edited by Feb 28, 2015, 5:23 PM

          I’m adding this change to the inits.

          All you’d have to do is, if you’re running the latest SVN versions, re-run the installer.

          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
          • C
            cspence Developer
            last edited by Feb 28, 2015, 5:41 PM

            Good to hear! Thanks everyone.

            1 Reply Last reply Reply Quote 0
            • T
              Tom Elliott
              last edited by Feb 28, 2015, 5:43 PM

              From what I’m seeing, we don’t need the -l on the ls.

              Why? Because the link is back to the /sys/devices/<location> and the separation in that folder contains multiple delimiters we need to break from. Will correct, but the for loop, from what I can see only needs to be ls /sys/class/net | tr -d ‘@’

              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
              • C
                cspence Developer
                last edited by Feb 28, 2015, 5:47 PM

                [quote=“Tom Elliott, post: 42949, member: 7271”]From what I’m seeing, we don’t need the -l on the ls.

                Why? Because the link is back to the /sys/devices/<location> and the separation in that folder contains multiple delimiters we need to break from. Will correct, but the for loop, from what I can see only needs to be ls /sys/class/net | tr -d ‘@’[/quote]

                Careful, that’s not an “L”, that’s a “One.” He set it up to do one file/directory per line.

                1 Reply Last reply Reply Quote 0
                • T
                  Tom Elliott
                  last edited by Feb 28, 2015, 5:48 PM

                  ahhhhh so difficult to tell sometimes.

                  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 Feb 28, 2015, 8:27 PM

                    [quote=“cspence, post: 42950, member: 28749”]Careful, that’s not an “L”, that’s a “One.” He set it up to do one file/directory per line.[/quote]
                    That’s right, thanks for clarifying. And thank you Tom for adding this straight into the project. I really hope that it’s not causing any trouble for other users…

                    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
                    • T
                      Tom Elliott
                      last edited by Mar 1, 2015, 1:24 AM

                      It shouldn’t pose problems unless the nic is unsupported, in which case they’d already be having problems regardless of with or without these tweaks.

                      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
                      • T
                        Tom Elliott
                        last edited by Mar 2, 2015, 6:14 PM

                        so apparently this isn’t working properly.

                        I’ve changed the for loop to only add if the interfaces found does not match lo and eth0. My testing side seems to work properly, but other’s are seeing really strange things, particularly that the nic’s aren’t getting IPs. I don’t know why, maybe I can get some help over here?

                        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 Mar 2, 2015, 9:43 PM

                          Sure I am happy to assist as much as I can!! Looking at the script in current SVN I noticed that you create ‘/etc/network/interfaces’ new from scratch (by using ‘>’) when ‘lo’ is detected. Normally that would be a good idea but when running this in my FOG test environment (QEMU) I end up with this:
                          [CODE]auto lo
                          iface lo inet loopback[/CODE]

                          Why you ask?? Because ‘lo’ does not necessarily come first. Actually on most systems ls is sorted by alphabet and ‘e’ comes before ‘l’. Do you know what I mean?

                          Fix: Use “>> /etc/network/interfaces” everywhere instead of “> /etc/network/interfaces”. If you want to make sure that it’s empty then do “echo > /etc/network/interfaces” before the for loop.

                          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
                          • C
                            cspence Developer
                            last edited by Mar 2, 2015, 10:19 PM

                            By default, udhcpc uses eth0. You will probably need to add -a $iface to udhcpc_opts. I was unsure if that would be taken care of by /etc/network/interfaces.

                            1 Reply Last reply Reply Quote 0
                            • T
                              Tom Elliott
                              last edited by Mar 2, 2015, 10:24 PM

                              What’s weird, though, is the /etc/network/interfaces appears to get the proper values set (without the -a) but even without eth0 should still be found with little issue, and without these tweaks (reverting back to only having iface eth0) everything functions properly.

                              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
                              • C
                                cspence Developer
                                last edited by Mar 3, 2015, 1:36 AM

                                [quote=“Tom Elliott, post: 43023, member: 7271”]What’s weird, though, is the /etc/network/interfaces appears to get the proper values set (without the -a) but even without eth0 should still be found with little issue, and without these tweaks (reverting back to only having iface eth0) everything functions properly.[/quote]

                                Actually, I was trying to go off memory. The flag is [B]-i $iface[/B]. You don’t want to use -a. Sorry about that.

                                1 Reply Last reply Reply Quote 0
                                • T
                                  Tom Elliott
                                  last edited by Mar 3, 2015, 9:41 AM

                                  Updated to reflect the change. Pushed to inits as well.

                                  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
                                  • T
                                    Tom Elliott
                                    last edited by Mar 3, 2015, 1:37 PM

                                    Would the problems we’re seeing be related to the fact we bring the interface up, but we don’t bring it back down, so when the interface is added and the loop happens, it can’t get dhcp because it believes the link is 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! 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
                                    • C
                                      cspence Developer
                                      last edited by Mar 3, 2015, 4:29 PM

                                      Finally got a chance to play with it, and I have a solution.

                                      Insert a 5-second sleep between setting the interface up and checking the link status (we can’t just check before it gets a chance to find out if it is connected to a cable). Here’s the snippet as modified.

                                      [CODE]…
                                      /sbin/ip link set $iface up

                                      Provide time for the interface to update linkstate

                                      sleep 5
                                      linkstate=$(/bin/cat /sys/class/net/$iface/carrier)
                                      …[/CODE]

                                      Works on my end.

                                      …and if you wait just a second, I’ll have an optimized version…

                                      1 Reply Last reply Reply Quote 0
                                      • C
                                        cspence Developer
                                        last edited by Mar 3, 2015, 4:48 PM

                                        [CODE]# Enable all interfaces
                                        ifaces=$(ls -1 /sys/class/net | tr -d ‘@’)
                                        for iface in $ifaces; do
                                        /sbin/ip link set $iface up
                                        done

                                        Provide time for interfaces to detect their state

                                        sleep 5

                                        echo “auto lo” > /etc/network/interfaces
                                        echo “iface lo inet loopback” >> /etc/network/interfaces

                                        for iface in $ifaces; do
                                        linkstate=$(/bin/cat /sys/class/net/$iface/carrier)
                                        if [[ “x$linkstate” = “x1” -a “x$iface” != “xlo” ]]; then
                                        echo “auto $iface” >> /etc/network/interfaces
                                        echo “iface $iface inet dhcp” >> /etc/network/interfaces
                                        echo -e “\tudhcpc_opts -t 100 -T 20\n” >> /etc/network/interfaces
                                        fi
                                        /sbin/ip link set $iface down
                                        done[/CODE]

                                        This solution only requires one sleep rather than five-seconds of sleep time per interface.

                                        Edit: Fixed typos.

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          Tom Elliott
                                          last edited by Mar 3, 2015, 4:58 PM

                                          Bad statement.

                                          linkstate=$(/bin/cat /sys/class/net/$iface

                                          Should be
                                          linkstate=$(/bin/cat /sys/class/net/$iface)

                                          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
                                          • 2
                                          • 1 / 2
                                          1 / 2
                                          • First post
                                            15/32
                                            Last post

                                          158

                                          Online

                                          12.1k

                                          Users

                                          17.3k

                                          Topics

                                          155.4k

                                          Posts
                                          Copyright © 2012-2024 FOG Project