On Wed Apr 02, 2003 at 01:41:24PM +0200, Martin Sjögren wrote:
> mån 2003-03-31 klockan 04.04 skrev Erik Andersen:
> > > udhcpc works, but it needs a script to operate correctly.
> > 
> > It works great.  Just drop this in as your
> > /usr/share/udhcpc/default.script file and you are good to go:
> 
> ...
> 
> And what would it be using the ip command instead? I don't know enough
> about this... :/

I think this this should work (entirely untested):

#!/bin/sh
# udhcpc script using iproute by Erik Andersen <[EMAIL PROTECTED]>

[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"


case "$1" in
        deconfig)
                /bin/ip link set $interface up
                ;;

        renew|bound)
                /bin/ip addr add $ip/$mask dev $interface

                if [ -n "$router" ] ; then
                        for i in $router ; do
                                /bin/ip route add default via $i dev $interface
                        done
                fi

                if [ -n "$hostname" ]; then
                        hostname $hostname
                fi

                echo "# Generated automatically by udhcpc" > $RESOLV_CONF
                echo "" >> $RESOLV_CONF
                if [ -n "$domain" ] ; then
                        echo search $domain >> $RESOLV_CONF
                fi
                for i in $dns ; do
                        echo nameserver $i >> $RESOLV_CONF
                done
                ;;  
esac
exit 0

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to