Multiple NIC Hosts
-
I’m experiencing problems with some of the SVN revisions after 1.2.0 on machines with two NICs. I’m using the NIC that tends to register as eth1.
Here’s some base information:
FOG Versions Tested: 1.2.0, SVN 2948, and SVN 3053
On-Board NIC: Intel 82579LM Gigabit (Registers as eth1 with Linux)
PCI-Express NIC: Broadcom NetXtreme BCM5722 Gigabit (Registers as eth0 with Linux)First of all, version 1.2.0 works fine. [B]This bug is experienced in SVN 2948 and 3053.[/B]
When I try to register a host or capture an image from a host, SVN 2948 and 3053 do not power on the On-Board NIC (eth1) while attempting to get a DHCP lease. Switching the cable to the PCI-E NIC immediately leases an IP. Removing the PCI-E NIC allows registration and imaging to work on the On-Board NIC.
It appears that some point between 1.2.0 and SVN 2948, the behavior was changed to only use eth0 rather than find the working interface.
-
If I get thinks right here I’d say that this is simply a question of the order in which linux registers the network interfaces when FOG comes up on the client. Maybe I am wrong but I believe that FOG 1.2.0 did not magicaly “find the working interface”. It’s just that the older kernel registered the onboard NIC as eth0 I guess. Interesting post on this topic: [url]https://lists.debian.org/debian-user/2006/01/msg00075.html[/url]
Easy test would be to extract bzImage{,32} and init{,_32}.xz from fog_1.2.0.tar.gz and put those into ‘/var/www/fog/service/ipxe/’ where SVN 2948/3053 is running. Probably best to backup this whole directory first before overwriting those files.
Will be interesting to see if I am on the wrong track with this…
-
[quote=“Uncle Frank, post: 42916, member: 28116”]If I get thinks right here I’d say that this is simply a question of the order in which linux registers the network interfaces when FOG comes up on the client. Maybe I am wrong but I believe that FOG 1.2.0 did not magicaly “find the working interface”. It’s just that the older kernel registered the onboard NIC as eth0 I guess. Interesting post on this topic: [url]https://lists.debian.org/debian-user/2006/01/msg00075.html[/url]
Easy test would be to extract bzImage{,32} and init{,_32}.xz from fog_1.2.0.tar.gz and put those into ‘/var/www/fog/service/ipxe/’ where SVN 2948/3053 is running. Probably best to backup this whole directory first before overwriting those files.
Will be interesting to see if I am on the wrong track with this…[/quote]
It was worth a shot.
Results:
It appears that the 1.2.0 images use the on-board NIC without issue even when in use by SVN 2948/3053 (but that’s not surprising). It’s the end of the week so I’ll probably pick this up Monday.Also, a tidbit of humor: If you run a debug task and you’re having network issues or you don’t have a network, even debug will get stuck looking for an IP from udhcpc. Very helpful.
-
Okay, I lied about waiting until Monday.
On the 1.2.0 boot image, my best guess is it doesn’t use udhcpc. The 1.2.0 image successfully uses eth1 on its own. So it looks like your initial theory is out.
But I found more: /etc/network/interfaces forces the use of [B]udhcpc -t 100 -T 20[/B] as an argument to [B]iface [COLOR=#ff0000]eth0[/COLOR] inet dhcp[/B] on the SVN versions. The 1.2.0 does not even have configurations for eth0 or eth1. At this time, I’m not sure what action gets an IP on the 1.2.0 image. But this should be helpful for anyone else to continue the search.
-
[quote=“cspence, post: 42927, member: 28749”]Okay, I lied about waiting until Monday.
On the 1.2.0 boot image, my best guess is it doesn’t use udhcpc. The 1.2.0 image successfully uses eth1 on its own. So it looks like your initial theory is out.
But I found more: /etc/network/interfaces forces the use of [B]udhcpc -t 100 -T 20[/B] as an argument to [B]iface [COLOR=#ff0000]eth0[/COLOR] inet dhcp[/B] on the SVN versions. The 1.2.0 does not even have configurations for eth0 or eth1. At this time, I’m not sure what action gets an IP on the 1.2.0 image. But this should be helpful for anyone else to continue the search.[/quote]
^ this guy needs to be a regular here.
Clearly a power user, if I ever saw one.
-
[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.
-
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 ‘@’)
doall 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] -
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 ‘@’)
doall 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] -
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.
-
Good to hear! Thanks everyone.
-
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=“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.
-
ahhhhh so difficult to tell sometimes.
-
[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… -
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.
-
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?
-
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.
-
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.
-
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=“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.