How do I get rc.inet1 to run when usb dev plugged in?
Hi slackers,
I'm trying to get slack to configure my usb1000 ethernet device. So far I've got it to load the right module (asix) automatically when the dev is plugged in. And made a udev rule to make sure it gets the if number that I want a'la: KERNEL=="eth?", ATTR{address}=="00:12:17:f2:21:0c", NAME="eth1" Now I want dhcpcd to run and grab an ip for the if. Is adding a udev rule the only way to do this? That is, adding a rule for the device that runs rc.inet1 when the "add" action for the device fires? Any help? Thanks M |
Udev does have an option to run a command specified in the device rule. That might be what you're looking for. From my favorite udev rules howto:
Quote:
This is the howto: http://reactivated.net/writing_udev_rules.html I found it VERY useful and printed it for my own reference. |
If you plug in a USB device that has a driver in the kernel, then the default UDEV rules will load the driver and run "/etc/rc.d/rc.inet1 <interfacename>_start" if you plug it in. No custum UDEV rules required.
For instance, after I installed a package for the rt73 driver (RaLink based USB wireless dongle) and added configuration for the rausb0 device in rc.inet1.conf , plugging in the USB device was enough to bring the wireless interface up and configure it automatically. Eric |
Thanks for the replies but...no joy
Hi,
so...heres what's happening: plug in the device and udev loads up the driver...great! I have an entry for the if in rc.inet1.conf: # Config information for eth1: IFNAME[4]="eth1" IPADDR[1]="" NETMASK[1]="" USE_DHCP[1]="yes" DHCP_HOSTNAME[1]="" I also make sure that the device always gets the same name in /etc/udev/rules.d/75-network-devices.rules: KERNEL=="eth?", ATTR{address}=="00:1c:23:2a:52:1b", NAME="eth0" KERNEL=="wlan?", ATTR{address}=="00:1c:bf:62:21:66", NAME="wlan0" KERNEL=="eth?", ATTR{address}=="00:12:17:f2:21:0c", NAME="eth1" It appears as tough rc.inet1 is not running when I plug in the device BUT...don't believe everything you don't see. /var/log/messages shows me that in fact rc.inet1 does run: Jan 16 09:36:48 charger kernel: usb 1-4: new high speed USB device using ehci_hcd and address 4 Jan 16 09:36:48 charger kernel: usb 1-4: configuration #1 chosen from 1 choice Jan 16 09:36:49 charger kernel: eth1: register 'asix' at usb-0000:00:1a.7-4, ASIX AX88178 USB 2.0 Ethernet, 00:12:17:f2:21:0c Jan 16 09:36:49 charger logger: /etc/rc.d/rc.inet1: /sbin/dhcpcd -d -t 30 eth1 Jan 16 09:36:49 charger kernel: eth1: link down Jan 16 09:36:49 charger kernel: ADDRCONF(NETDEV_UP): eth1: link is not ready Jan 16 09:36:51 charger kernel: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready Jan 16 09:36:51 charger kernel: eth1: link up, 100Mbps, full-duplex, lpa 0x41E1 The problem seems to be that the link takes a couple of seconds to come up and rc.inet1 runs before the interface is ready. How to fix? I was thinking maybe add some sleeps to rc.inet1 but this just doesn't sit well with me. Is there some hook I can use to prevent rc.inet1 from running until the interface is ready? Thanks M |
All times are GMT -5. The time now is 04:28 AM. |