AnsweredAssumed Answered

Monitoring gadget events or g_ether events to run custom ifup script

Question asked by kevin.chaves on Apr 21, 2014
Latest reply on May 6, 2014 by jamesbone

I'm trying to find where in linux i would be able to setup the network interface for g_ether. Basically I want to run avahi-autoipd and dhcpd on the usb0 interface when it comes up. The problem is that linux isn't as transparent about how all this things are supposed to work. I worked with wince previously and what I want to do was really simple registry options...


So in my /etc/network/interfaces I have set usb0 as manual with custom scripts for up/down.


allow-howplug usb0

iface usb0 inet manual

     up /path/to/script

     down /path/to/script


When I plug in my device to a host pc, neither is run. I guess i don't really understand how g_ether acts as a network interface since it doesn't seem to know its available, and doesn't run ifup for it. If i run ifup usb0 the scripts will run.


I'm thinking i can create a udev rule, when the usb is plugged in, to run ifup usb0 and ifdown usb0 depending on the state.


Any help would be much appreciated.