assign any usb ethernet adapter a certain static ip address

Started by charlieholimex, May 26, 2014, 05:51:27 AM

Previous topic - Next topic

charlieholimex

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?

charlieholimex

Actually, I don't care so much what the interface name, I just want any adapter to have the same IP address.

Chax

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.