Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
net.eth0 script missing
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Chickpea
l33t
l33t


Joined: 03 Jun 2002
Posts: 846
Location: Vancouver WA

PostPosted: Sun Jul 21, 2002 12:53 am    Post subject: net.eth0 script missing Reply with quote

For some reason which I do not know my net.eth0 script is missing. Where can I get another one? I tried to do an update on the system and other config files were updated but not the net.eth)

Help!!!

Thanks
C
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Sun Jul 21, 2002 1:11 am    Post subject: Reply with quote

well ... you could always do your own script ... the following is a copy of mine (which should be the same everybody has) ...

Code:
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.eth0,v 1.15 2002/05/10 21:57:44 azarah Exp $

#NB: Config is in /etc/conf.d/net


#for pcmcia users. note that pcmcia must be added to the same
#runlevel as the net.* script that needs it.
depend() {
        use pcmcia
}

checkconfig() {
        if [ -z "$(eval echo \$\{iface_${IFACE}\})" ]
        then
                eerror "Please make sure that /etc/conf.d/net has \$iface_$IFACE set"
                return 1
        fi
}

start() {
        checkconfig || return 1
        local iface_args="$(eval echo \$\{iface_${IFACE}\})"
        local dhcp_args="$(eval echo \$\{dhcpcd_${IFACE}\})"
        local retval=0
        ebegin "Bringing ${IFACE} up"
        if [ "$(eval echo \$\{iface_${IFACE}\})" != "dhcp" ]
        then
                /sbin/ifconfig ${IFACE} ${iface_args} >/dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
                }
        else
                /sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
                }
        fi
        eend 0

        if [ -n "$(eval echo \$\{alias_${IFACE}\})" ]
        then
                local x=""
                local num=0
                local aliasbcast=""
                local aliasnmask=""

                if [ -n  "`eval echo \$\{broadcast_${IFACE}\}`" ]
                then
                        aliasbcast="broadcast `eval echo \$\{broadcast_${IFACE}\}`"
                fi

                if [ -n  "`eval echo \$\{netmask_${IFACE}\}`" ]
                then
                        aliasnmask="netmask `eval echo \$\{netmask_${IFACE}\}`"
                fi

                ebegin "  Adding aliases"
                for x in $(eval echo \$\{alias_${IFACE}\})
                do
                        ebegin "    ${IFACE}:${num}"
                        /sbin/ifconfig ${IFACE}:${num} ${x} \
                                ${aliasbcast} ${aliasnmask} >/dev/null
                        num=$((num + 1))
                        eend 0
                done
                save_options "alias" "$(eval echo \$\{alias_${IFACE}\})"
        fi

        if [ -n "${gateway}" ] && [ "${gateway%/*}" = "${IFACE}" ]
        then
                ebegin "  Setting default gateway"
                /sbin/route add default gw ${gateway#*/} dev ${gateway%/*} \
                        netmask 0.0.0.0 metric 1 >/dev/null || {

                        local error=$?
                        ifconfig ${IFACE} down &>/dev/null
                        eend ${error} "Failed to bring ${IFACE} up"
                        return ${error}
                }
                eend 0
        fi

        #enabling rp_filter causes wacky packets to be auto-dropped by
        #the kernel

        if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ]
        then
                echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
        fi
}

stop() {
        local myalias="$(get_options alias)"
        ebegin "Bringing ${IFACE} down"
        #do some cleanup in case the amount of aliases change
        if [ -n "${myalias}" ]
        then
                local x=""
                local num=0
                for x in ${myalias}
                do
                        /sbin/ifconfig ${IFACE}:${num} down &>/dev/null
                        num=$((num + 1))
                done
        fi

        if [ "$(eval echo \$\{iface_${IFACE}\})" == "dhcp" ]
        then
                /sbin/dhcpcd -k ${IFACE} &>/dev/null

                # Give dhcpcd time to properly shutdown
                local count=0
                einfon "  Waiting for dhcpcd to shutdown"
                while [ "${count}" -lt 5 ]
                do
                        echo -n "."
                        sleep 1
                        count=$((count + 1))
                done
                echo "done"
        else
                /sbin/ifconfig ${IFACE} down &>/dev/null
        fi
        eend 0
}


# vim:ts=4

_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
Chickpea
l33t
l33t


Joined: 03 Jun 2002
Posts: 846
Location: Vancouver WA

PostPosted: Sun Jul 21, 2002 1:33 am    Post subject: Reply with quote

Thank you kindly...as I am not a script writer. It worked beautifully now on to the firewall portion of the program.

:lol:

Chickpea
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum