LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 877|回复: 1

文件/etc/init.d/networking中好像有点问题??

[复制链接]
发表于 2005-5-22 22:26:24 | 显示全部楼层 |阅读模式
Linux debian 2.6.8-2-686 的内核

关闭了ipv6模块
每次开机都不能上网,用dpkg-reconfigure etherconf 配置一下就行了

在/etc/network/interfaces设了ip后
## etherconf DEBCONF AREA. DO NOT EDIT THIS AREA OR INSERT TEXT BEFORE IT.
auto lo

iface lo inet loopback

iface eth0 inet static
        address 211.83.149.178
        netmask 255.255.254.0
        broadcast 211.83.149.255
        gateway 211.83.149.254


### END OF DEBCONF AREA.  PLACE YOUR EDITS BELOW; THEY WILL BE PRESERVED.
用/etc/init.d/networking restart
debian:~# /etc/init.d/networking restart
Setting up IP spoofing protection: rp_filter.
Reconfiguring network interfaces...ifup: interface lo already configured
done.
debian:~# ping 211.83.149.254
connect: Network is unreachable

networking中的内容:
#!/bin/sh
#
# manage network interfaces and configure some networking options

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

if ! [ -x /sbin/ifup ]; then
    exit 0
fi

spoofprotect_rp_filter () {
    # This is the best method: turn on Source Address Verification and get
    # spoof protection on all current and future interfaces.
   
    if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]; then
        for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
            echo 1 > $f
        done
        return 0
    else
        return 1
    fi
}

spoofprotect () {
    echo -n "Setting up IP spoofing protection: "
    if spoofprotect_rp_filter; then
        echo "rp_filter."
    else
        echo "FAILED."
    fi
}

ip_forward () {
    if [ -e /proc/sys/net/ipv4/ip_forward ]; then
        echo -n "Enabling packet forwarding..."
        echo 1 > /proc/sys/net/ipv4/ip_forward
        echo "done."
    fi
}

syncookies () {
    if [ -e /proc/sys/net/ipv4/tcp_syncookies ]; then
        echo -n "Enabling TCP/IP SYN cookies..."
        echo 1 > /proc/sys/net/ipv4/tcp_syncookies
        echo "done."
    fi
}

doopt () {
    optname=$1
    default=$2
    opt=`grep "^$optname=" /etc/network/options`
    if [ -z "$opt" ]; then
        opt="$optname=$default"
    fi
    optval=${opt#$optname=}
    if [ "$optval" = "yes" ]; then
        eval $optname
    fi
}

case "$1" in
    start)
        doopt spoofprotect yes
        doopt syncookies no
        doopt ip_forward no

        echo -n "Configuring network interfaces..."
        ifup -a
        echo "done."
        ;;
    stop)
        if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
          grep -q "^/ nfs$"; then
            echo "NOT deconfiguring network interfaces: / is an NFS mount"
        elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |  
          grep -q "^/ smbfs$"; then
            echo "NOT deconfiguring network interfaces: / is an SMB mount"
        elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts |
          grep -qE '^(nfs[1234]?|smbfs|ncp|ncpfs|coda|cifs)$'; then
            echo "NOT deconfiguring network interfaces: network shares still mounted."
        else
            echo -n "Deconfiguring network interfaces..."
            ifdown -a --exclude=lo
            echo "done."
        fi
        ;;
    force-reload|restart)
        doopt spoofprotect yes
        doopt syncookies no
        doopt ip_forward no
        echo -n "Reconfiguring network interfaces..."
        ifdown -a --exclude=lo
        ifup -a
        echo "done."
        ;;
    *)
        echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0

问题出在哪???
发表于 2005-5-23 09:51:39 | 显示全部楼层
/etc/network/interfaces
的auto lo 改成auto lo eth0
44看.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表