Will Dyson on 5 Jun 2005 02:30:44 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Re: binding eth0 to a specific NIC


On 6/3/05, sean finney <seanius@seanius.net> wrote:

> so the problem is that unless i start mucking around with the initrd
> on the boot cd there's no way to get it to use eth2 (or have eth2 show
> up as eth0) with this same basic kickstart config.  so i guess my solution
> will be to either kickstart off of eth0, or burn a second kickstart disk
> with the eth2-using config.

I don't know if what I'm about to suggest is possible with kickstart,
as I haven't used it. But if you can have a kickstart CD run a script
to figure out the interface to start dhcpd on, this should work for
you.

In the multi-nic situation, it is hard to figure out what interface to
use in a completly generic way (probe for known MAC addresses on each
network... urgh). But if we make the simplifying assumption that the
NIC to use is the only one plugged into a switch during kickstart, it
becomes very easy (at least for a system based on a 2.6 kernel).

The following bash function will echo the name of the first ethernet
device that has an active link. You could have it run dhpcd directly,
or set an environment variable.

function active_nic {
  for i in /sys/class/net/eth*; do 
    if [ $(cat $i/carrier) -eq 1 ] ; then
      echo $(basename $i)
      return
    fi
  done
}

-- 
Will Dyson
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug