2009/10/22 James Cheng <jcheng@xxxxxxxx>: > Hi, > > I am on an embedded system. I'd like to receive notification of when a network interface has become available. This is to handle the case when the system is booted up without any network plugged in, and then someone plugs in a network at some point later. Ideally, I'd like to be notified when the interface actually receives a DHCP address, but if that's not possible, then a notification on the network being plugged in would work as well. I do all that. My network devices work exactly like a Windows machine - but a lot faster. I use this netplugd to detect plug/unplug events. http://www.red-bean.com/~bos/ I've had no problems with it. It calls a script when an event occurs. Your script is called with the device name and the "action" (in, out, probe). For example, when I plug in the ethernet cable my netplugd script restarts the DHCP client for eth0. But when my usb0 network device is created (modprobe g_ether) the script configures and starts a DHCP server for the connecting device (usually a Windows PC) For DHCP I use udhcpc, and it has a script which is called when the address on the interface changes states: leasefail, renew, bound. For example, when I get a "leasefail" on eth0, my scripts starts zcip which allocates a "link-local" address for eth0. But if I later get a "renew/bound" on eth0, it will stop the zcip daemon because a DHCP server has been discovered. Remember that if I unplug/plug the eth0 cable, it will restart the DHCP client? So when/if you plug a different network cable into your device, it will check for a DHCP server ASAP. With these two systems in place, my networking "just works" and has been reliable and fast. > Can udev help me with this? Can I write a rule that runs some sort of program when this happens? I saw references on the mailing list to ethtool or some other things, but I wasn't sure what the latest status was. If you want to know if udev will help you, run the monitor, create the event, and see if anything is printed out. # udevadm monitor --env --udev regards, Aras Vaichas -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html