[Cialug] Raspbian (Debian) force eth port

Zachary Kotlarek zach at kotlarek.com
Mon Feb 20 14:26:44 CST 2017


On 20 Feb 2017, at 11:34, L. V. Lammert wrote:

> Have two USB NICs on a Pi (Jessie), .. and it seems like there are no udev
> rules to force that USB to a specific eth port.
>
> Has anyone dealt with this? How do I force the specific HW to a specific
> eth port so it configs correctly?


For network devices the rule would look something like this:
KERNEL=="eth*", ATTR{address}=="00:15:17:29:1f:b2", NAME="inet_a"

More generally you can see the attributes available for udev rules with something like:
udevadm info --attribute-walk --path=/sys/path/to/device

You can use attribute or set of attributes that are unique to the device you want to select. For things like NICs you should have access to a unique address/serial number/UID. Devices that don’t publish unique IDs still usually register vendor/model information, which might be enough. If your devices are identical you can always use the KERNEL attribute, which will include information about the location on the bus (i.e. identifies a physical USB port), though obviously that sort of ID is fragile against changes to your bus layout (or robust against changes to the device, depending on your point of view).

	Zach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2483 bytes
Desc: S/MIME digital signature
URL: <http://cialug.org/pipermail/cialug/attachments/20170220/082a6e9c/attachment.bin>


More information about the Cialug mailing list