On Wed, 15 Sep 2010, C. V. wrote:

> most of my servers have more than one network card. In some cases I have
> to use eth devices which are not assigned as eth0 by linux. Sadly that
> does not seem to work out of the box since FAI always tries to use eth0.
> So, the boot stops when trying to mount nfs-root because eth0 is not
> able to find it. It is connected to different Network.
>
> Is there a way to assign a specific eth device for this or at least to
> tell FAI that he should look on all eth devices? I did not find anything
> about this problem.

Maybe this (or some similar script) can help:

---8<---
#!/bin/sh

set -e

if=
status=
while read if rest; do
        case $if in
                eth[0-9]*)
                        if=${if%:*}
                        while read l d status; do
                                case $l in
                                        Link)
                                                case $d in
                                                        detected:)
                                                                [ $status != 
yes ] || break
                                                                ;;
                                                esac
                                                ;;
                                esac
                        done <<-EOF
                                $(ethtool $if)
                        EOF
                        [ "$status" != yes ] || break
                        ;;
        esac
done < /proc/net/dev

[ "$if" ] && [ "$status" = yes ] || exit 1
echo $if
--->8---

It returns to stdout the name of the 1st found interface with:

        Link detected: yes

or error status code.


Cheers,

-- 
Cristian

Antwort per Email an