使用mpd做的PPPoE的Server,一台新机器用是FreeBSD10,查看日志,会发现大量的:
Sep 3 06:26:06 vpn devd: Executing '/etc/pccard_ether ng2 start'
Sep 3 07:08:19 vpn devd: Executing '/etc/pccard_ether ng42 start'
Sep 3 07:15:22 vpn devd: Executing '/etc/pccard_ether ng43 start'
Sep 3 07:29:42 vpn devd: Executing '/etc/pccard_ether ng1 start'
由于本机需要开启vlan,所以也有几百个vlan,/var/log/message中,每一个vlan也对应一条日志:
Aug 30 23:04:29 vpn devd: Executing '/etc/rc.d/dhclient quietstart vlan567'
Aug 30 23:04:29 vpn devd: Executing '/etc/rc.d/dhclient quietstart vlan669'
Aug 30 23:04:29 vpn devd: Executing '/etc/rc.d/dhclient quietstart vlan728'
Aug 30 23:04:29 vpn devd: Executing '/etc/rc.d/dhclient quietstart vlan532'
同时,mpd在每天都会自动重启一下,其他FreeBSD9的机器都正常,这台机器时间一长就会出现不重启卡住的情况,导致无法接入PPPoE的拨入。
顺着/etc/pccard_ether和dhclient查找,终于找到产生这些消息的原因是因为devd,devd是一个守护程序,只要硬件发生变化,就会运行相应的程序。
在/etc/devd中,对网卡界面连接消息的配置是:
# NB: DETACH events are ignored; the kernel should handle all cleanup
# (routes, arp cache). Beware of races against immediate create
# of a device with the same name; e.g.
# ifconfig bridge0 destroy; ifconfig bridge0 create
notify 0 {
match "system" "IFNET";
match "subsystem" "!usbus[0-9]+";
match "type" "ATTACH";
action "/etc/pccard_ether $subsystem start";
};
看上面的解释,所有虚拟界面产生时都会匹配这条项目,所以就会在日志���产生那一大批的pccard_ether。
你可能会比较奇怪为什么叫这个名字,为什么网卡跟pccard发生了关系,注意上面还有一句,说明为什么叫pccard_ether:由于历史的原因,因为最早能热拨插的网卡只有pccard网卡,usb那是后来的事了。
日志中的dhclient呢?在devd.conf后面有定义:
# Try to start dhclient on Ethernet-like interfaces when the link comes
# up. Only devices that are configured to support DHCP will actually
# run it. No link down rule exists because dhclient automatically exits
# when the link goes down.
#
notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "ethernet";
action "/etc/rc.d/dhclient quietstart $subsystem";
};
注意这可能有个bug,给vlan定义了ip,也会产生这个消息,可能是因为ifconfig vlan create的时候,就已经触发了这个消息,然后再ifconfig vlanxx,那就是后来的事了。
禁用devd的方法就简单了,在/etc/rc.conf中添加一行:
devd_enable=”NO”
同时鄙视一下动不动就修改:/etc/default/rc.conf中项目的人。
该贴由hui.chen转至本版2014-11-5 17:04:54