+ -
当前位置:首页 → 问答吧 → ifplugd 设定问题 (己解决)

ifplugd 设定问题 (己解决)

时间:2009-01-22

来源:互联网

本来按手册这好象是很容易的事,但到我机上好象不太好使。请问大家是怎么设定的?

按照手册, 在/etc/conf.d/net中我是这样写的。
~ $ cat /etc/conf.d/net
#DHCP
# eth0 setting
config_eth0=( "noop""dhcp")
dhcpcd_eth0="-t 10"
fallback_eth0=("null""apipa")
dhcp_eth0="release nodns nontp nonis"

#Wlan0 setting
modules=("iwconfig")
config_wlan0=("noop""dhcp")
fallback_wlan0=("null""apipa")
dhcp_wlan0="release nodns nontp nonis"
preferred_aps=("MyNet")
associate_order=("preferredonly")
#associate_order=("any" "preferredonly" forceprefered forcepreferredonly forceany")
#===========================================
#Monitoring
ifplugd_eth0="..."
ifplugd_wlan0="--api-mode=wlan"
#===========================================

但是这个ifplugd好象根本不起作用. 对eth0它是:

~ $ sudo /etc/init.d/net.eth0 restart
* Bringing down interface eth0
* Loaded modules: ip6to4 dhcpcd udhcpc dhclient system pppd iproute2 ifconfig ssidnet wpa_supplicant iwconfig ipppd ifplugd netplugd macnet macchanger ccwgroup tuntap br2684ctl bonding arping apipa adsl
* Stopping ifplugd on eth0...
/usr/sbin/ifplugd' [ ok ]
* Bringing up interface eth0
* Loaded modules: adsl apipa arping bonding tuntap ccwgroup macchanger macnet ifplugd iwconfig ssidnet iproute2 pppd system dhcpcd ip6to4
* Configuring eth0 for MAC address 11:22:33:44:55:66... [ ok ]
* Starting ifplugd on eth0...
* Detaching to start `/usr/sbin/ifplugd'... [ ok ]
* Backgrounding ...
* WARNING: net.eth0 has started, but is inactive

对元线网卡它是:

~ $ sudo /etc/init.d/net.wlan0 restart
* Bringing down interface wlan0
* Loaded modules: ip6to4 dhcpcd udhcpc dhclient system pppd iproute2 ifconfig ssidnet wpa_supplicant iwconfig ipppd ifplugd netplugd macnet macchanger ccwgroup tuntap br2684ctl bonding arping apipa adsl
* Stopping dhcpcd on wlan0... [ ok ]
* Bringing up interface wlan0
* Loaded modules: adsl apipa arping bonding tuntap ccwgroup macchanger macnet ifplugd iwconfig ssidnet iproute2 pppd system dhcpcd ip6to4
* Configuring wlan0 for MAC address AA:BB:CCD:EE... [ ok ]
* ifplugd does not work with wireless
* Configuring wireless network for wlan0
* Scanning for access points
* Found "MyNet" at AA:BB:CCD:EE, managed
* Connecting to "MyNet" in managed mode (WEP Disabled)... [ ok ]
* wlan0 connected to SSID "MyNet" at AA:BB:CCD:EE
* in managed mode (WEP disabled)
* Configuring wlan0 for SSID MyNet... [ ok ]
* noop... [ ok ]
* dhcp...
* Running dhcpcd...
wlan0: dhcpcd 4.0.7 starting
wlan0: broadcasting for a lease
wlan0: timed out
wlan0: trying to use old lease in `/var/lib/dhcpcd/dhcpcd-wlan0.lease'
wlan0: checking 169.254.54.25 is available on attached networks
wlan0: using IPv4LL address 169.254.54.25 [ ok ]
* received address 169.254.54.25/16
....

作者: cliffordli   发布时间: 2009-01-22

无线网络我现在用wicd,挺好用的。

作者: zhou3345   发布时间: 2009-01-22

我没有装wicd, 在/etc/conf.d/net里面设定好就能连上了,这个ifplugd使用应该与wicd无关吧。

这个ifplugd让我每次开机都要等十来秒,很不爽。

作者: cliffordli   发布时间: 2009-01-22

研究了一圈回来,查了几篇wiki. 改了一下/etc/conf.d/net 和 /etc/ifplugd/ifplugd.action, 无线网卡终于不再时断时续了, 现在emerge -uDN的下载速度可达220k/s以上.

/etc/conf.d/net改成了:
=========================
#Wlan0 setting
modules=("iwconfig")
rate_wlan0=("5.5M auto") #此句新加
config_wlan0=("noop""dhcp")
fallback_wlan0=("null""apipa")
dhcp_wlan0="release nodns nontp nonis"
preferred_aps=("MyNet")
associate_order=("preferredonly")

ifplugd_eth0="..."
ifplugd_wlan0="--api-mode=wlan"
plug_timeout="10" #此句新加

把/etc/ifplugd/ifplugd.action里面这段改成
case "$2" in
up)
if [ "${INITNG}" = "yes" ]
then
ARGS="-u net/$1"
else
/etc/init.d/net.wlan0 --quiet stop #此句新加
ARGS="--quiet start"
fi
;;
down)
if [ "${INITNG}" = "yes" ]
then
ARGS="-d net/$1"
else
/etc/init.d/net.wlan0 --quiet start #此句新加
ARGS="--quiet stop"
fi
;;
*)
echo "$0: wrong arguments" >&2
echo "Call with <interface> <up|down>" >&2
exit 1
;;
esac

现在看ifplugdstatus的输出是
~ $ sudo ifplugstatus
lo: link beat detected
eth0: unplugged
tunl0: unplugged
gre0: unplugged
sit0: unplugged
wmaster0: link beat detected
wlan0: link beat detected
ppp0: link beat detected

作者: cliffordli   发布时间: 2009-01-22