⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 network

📁 ARM7-S3C4510B 的源代码程序
💻
字号:
#! /bin/sh## network 1.10 1995/12/28 19:55:19 (David Hinds)## $Id: network,v 1.1.1.1 2002/04/02 06:54:31 wyliang Exp $## Initialize or shutdown a PCMCIA ethernet adapter## This script should be invoked with two arguments.  The first is the# action to be taken, either "start", "stop", or "restart".  The# second is the network interface name.## Changes by Yoichi# 09/12/96 added DHCP option# 05/17/97 added check if there is a network device or not#usage(){    echo "usage: network [action] [device name]"    echo "  actions: ident start check stop suspend resume"    exit 1}if [ $# -lt 2 ] ; then usage ; fiaction=$1device=$2# Load site-specific settings. /etc/pcmcia/network.optscase "$action" in'ident')    ADDR=`/sbin/ifconfig $device | sed -n -e 's/.*addr \(.*\)/\1/p'`    echo "Hardware address = $ADDR"    ;;'start')	if ! cat /proc/net/dev | egrep $device >/dev/null ; then		exit 1	fi    if [ "$DHCP" = "y" -o "$DHCP" = "Y" ] ; then        if [ "$DHCPSTF" ] ; then            /usr/sbin/dhcpcd -c $DHCPSTF ${device}        else            /usr/sbin/dhcpcd ${device}        fi    elif [ "$BOOTP" = "y" -o "$BOOTP" = "Y" ] ; then	/sbin/ifconfig $device up	/sbin/route add default dev $device	eval `/sbin/bootpc --bootfile '' --dev $device`	/sbin/route del default	if [ "$GATEWAYS" = "" ] ; then	    set - $GATEWAYS ; GATEWAY=$1	fi    fi    if [ "$IPADDR" != "" ] ; then	# Basic network setup	/sbin/ifconfig $device up $IPADDR broadcast $BROADCAST \            netmask $NETMASK	/sbin/route add -net $NETWORK netmask $NETMASK	if [ "$GATEWAY" != "" ] ; then	    /sbin/route add default gw $GATEWAY metric 1	fi	# Configure nameservers	if [ "$DNSSRVS $DNS_1 $DNS_2 $DNS_3" != "   " ] ; then	    cp /etc/resolv.conf /etc/resolv.new	    echo "# $device begin" >> /etc/resolv.new	    for DNS in $DNSSRVS $DNS_1 $DNS_2 $DNS_3 ; do		echo "nameserver $DNS" >> /etc/resolv.new	    done	    echo "# $device end" >> /etc/resolv.new	    mv /etc/resolv.new /etc/resolv.conf	fi    fi    ;;'stop')    if [ "$DHCP" = "y" -o "$DHCP" = "Y" ] ; then		`mount | awk '/type nfs/ { print "umount " $3 }'`        /usr/sbin/dhcpcd -k    elif [ "$IPADDR" != "" ] ; then	if [ "$GATEWAY" != "" ] ; then	    /sbin/route del default	fi	/sbin/route del $NETWORK	/sbin/ifconfig $device down	# Remove nameservers	awk "/# $device begin/ { p = 1 }		\	    { if (!p) print }				\	    /# $device end/ { p = 0 }"			\	    < /etc/resolv.conf > /etc/resolv.new &&	\	    mv /etc/resolv.new /etc/resolv.conf    fi    ;;'check')    # This is crude -- it checks for any external network activity    netstat -ntuw | tail +3 | awk '{ print $5 }' | \	grep -v 127.0.0.1 > /dev/null && exit 1    ;;'restart')    if [ "$IPADDR" != "" ] ; then	/sbin/ifconfig $device down up    fi    ;;'suspend'|'resume')    ;;*)    usage    ;;esacexit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -