On Fri, 7 Aug 2009, Chris O'Regan wrote:

I am encountering a weird problem. I have a number of servers with a
pair of on-board network interfaces. Kickstart is configured to set up
eth0 with a static ip address; there is no mention of eth1 in the
config. In the past, eth1 was always disabled by default. Now it's
enabled, and trying to configure itself via DHCP. This interface is not
even plugged into a switch; it's never going to get an answer. As such,
booting takes a lot longer because it has to wait for the DHCP request
for eth1 to time out.

Sure, I can manually edit the configuration for eth1 to disable the
interface, but I have a number of systems lined up to be built, and I
would rather avoid this manual intervention. Any ideas?

This is SL5.3.

I obviously hit something similar once (possibly long ago), because my standard kickstart postinstall scripts check each network interface ifcfg file and change the ONBOOT=y to ONBOOT=no for all but the 'primary' interface.

The script is ugly and probably overly complex, but I can send you a copy if you like...

I note that all the recent multi-network machines I've installed havn't needed this work but they were installed with sl52. The RCS records suggest that I added it when we were still mainly using sl3.

e.g. on one recent box it logged:

...
Fix the network state
Found interface eth1   inet 131.111.17.208/16
 Found default route via 131.111.16.62
Interface eth1 addr=131.111.17.208 mask=255.255.0.0 network=131.111.0.0, brd=131.111.255.255
  Default route via 131.111.16.62 dev eth1
Bad/unacceptable hostname pollux looking up 131.111.17.208/16!!
hostname from gethostbyaddr is pollux.damtp.cam.ac.uk
hostname is pollux.damtp.cam.ac.uk
non-primary interface: eth0
Edit /etc/sysconfig/network-scripts/ifcfg-eth0
Content ok no need to rewriting /etc/sysconfig/network-scripts/ifcfg-eth0
Primary interface: eth1
Open /etc/sysconfig/network-scripts/ifcfg-eth1
Open /etc/sysconfig/network-scripts/route-eth1
Open /etc/sysconfig/static-routes
Open /etc/sysconfig/network
...

in this case eth1 is an onboard nic and eth0 is in a PCIE slot. The (perl) fragment to check a particular non-primary ifcfg file is:

# rewrite the ifcfg file to turn onboot to "no" (if it is "yes").
sub turnoff {
    my ($file)=...@_;
    my $info='';
    my $changed=0;

    open (IN, "<$file") || warn "Can't read $file: $!\n";
    while (<IN>) {
        if (/ONBOOT=y/) {
            s/=.*/=no/;
            $changed++;
        };
        $info.=$_;
    };
    close(IN);
    if ($changed) {
        print "Edited content, rewriting $file\n";
        open (OUT, ">$file.new") || warn "Can't write $file.new: $!\n";
        print OUT $info;
        close (OUT) || warn "close of $file.new failed: $!\n";
        rename("$file.new", $file) ||
            warn "rename $file.new -> $file failed: $!\n";
    } else {
        print "Content ok no need to rewriting $file\n";
    }
}

there are parts of this script which are much uglier than that and the primary function is to 'fix' the networking for the primary interface (ie turn off dhcp), which I assume most others wouldn't want...

 -- Jon

Reply via email to