Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A10 => Topic started by: charlieholimex on May 26, 2014, 05:51:27 AM

Title: assign any usb ethernet adapter a certain static ip address
Post by: charlieholimex on May 26, 2014, 05:51:27 AM
Using the Debian image, what I actually want to do is, any time any USB ethernet adapter is plugged in, I want it assigned the same static IP address. The way it works now, the first one I plug in comes up as eth2, then I plug a different adapter in and it comes up as eth3.

Is there some way to make it so that any usb ehternet adapter will always come up as the same interface, and with the same static IP address?

Any way to hook a script into the process which assigns the interface name?
Title: Re: assign any usb ethernet adapter a certain static ip address
Post by: charlieholimex on May 26, 2014, 05:56:25 AM
Actually, I don't care so much what the interface name, I just want any adapter to have the same IP address.
Title: Re: assign any usb ethernet adapter a certain static ip address
Post by: Chax on May 27, 2014, 08:47:04 PM
I don't know exactly how to realise that any adapter will get a specific IP address (given that you won't plug in multiple adapters at the same time).

But I do know that in Debian this is controlled in the '/etc/udev/rules.d/70-persistent-net.rules' file. This file is updated when a new MAC address of an ethernet device is found. So you'll probably see many devices in there now. Each device will get the names as specified in this file (e.g. put 'rm /etc/udev/rules.d/70-persistent-net.rules' in de '/etc/rc.local' file)

Maybe you can just delete this file on every reboot and then use '/etc/network/interfaces' to setup the IP address for eth0.