在Linux下等待以太网电缆插件/插件事件?

我知道我可以通过SIOCETHTOOL / ETHTOOL_GLINK ioctl轮询链接状态,但这需要无休止地请求状态.解析/ var / log / messages也是如此.所以我的任务是,在Linux下有什么方法可以等待用户空间的以太网电缆的状态更改?

解决方法:

ifplugd怎么样?

ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected.

(还有netplugd,但它是discontinued.)

上一篇:linux – 如何为网络设备创建别名?


下一篇:linux – 改变网络接口的名称,debian wheezy