2

I'm trying to figure out how to automatically setup an zeroconfig network address on a RNDIS Usb Gadget.

currently when i plug in the device, on the device i have to

$ modprobe g_ether
$ ifconfig usb0 up
$ avahi-autoipd usb0 &

and on the host i have to

$ avahi-autoipd usb0 &

they'll both get a 169.x.x.x number and I can ping, sometimes it doesn't work though. The device does not have a NetworkManager, we use busy box to start, I'm sort of looking at this as a possible solution Static Host RNDIS IP by linux based USB Gadget device, but I'd prefer to use local ip's.

A long time ago i some vague instructions on how to set a script to run in /etc/network/interfaces when a interface becomes available, but i'm having a hard time finding that again.

Thanks!

Community
  • 1
  • 1
Kevin
  • 320
  • 5
  • 17
  • Isn't there an Avahi service that runs and listens on the net interfaces? I did maintenance on a daemon that used Avahi and would get notified of interfaces coming up or becoming available on the net via Avahi notifications. I think the Avahi project server has some sample code for this. – Peter L. Nov 22 '13 at 23:32

1 Answers1

1

I figured it out, in /etc/network/interfaces

allow-hotplug usb0
iface usb* inet manual
   up /usr/sbin/avahi-autoipd --force-bind -D $IFACE
   down /usr/sbin/avahi-autoipd --kill $IFACE
Kevin
  • 320
  • 5
  • 17