Bind USB Ethernet Adapter to Specific Port

Is there a way to bind a USB Ethernet adapter to a specific port/interface? I have 4 USB to Ethernet adapters on a test PC (Lenovo ThinkCenter SFF) and when I reboot, what I configured as eth2 may end of being swapped around to eth4 or something else and in doing so, uses a different network address.

I know in Linux you can bind a USB device to something like /dev/ttyUSB0, but I don't see how to do this in OpenWRT.

There is no udev on OpenWrt, making interface renaming a little more complex.

1 Like

i believe post 17-ish has the most current revision of a working solution... ( bobafetts )

I got half way through rewriting a hotplug variant that supports mac override but lost-interest/started mangling too much code again...

if you need mac override/hotplug... have shell skills and want to spend a few days testing... I can probably dig out what I was working on...

@anon50098793 Where in the filesystem would I place that script? Not in the /etc/rc.local, correct? Another thing I have noticed, and which has complicated this, is that when I run the command dmesg | grep tty I see nothing that shows the dongles attached.

that is an initscript so;

  • goes in /etc/init.d...
  • with chmod +x

please provide more information about your device(s if different)

  • model / manufacturer / product link
  • device files it creates when initializes /dev/xxx
  • protocols it uses ( when functional ) i.e. mbim, cdc, slip or whatever
  • /etc/config/network samples
  • lsusb and dmesg | grep YOURDEVICESTUFF

the guide i've referenced is for ethX usb dongles... (although can be adapted for other stuff depending on what exactly you are doing)

there are existing guides in the wiki for tty devices... ( which are hotplug based )

They are adapters I bought off Amazon that use the Realtek chip:

UNI USB to Ethernet Adpater

I have several of them and have never had an issue with them.

Bus 002 Device 003: ID 0bda:8153 Realtek USB 10/100/1000 LAN
config device
        option name 'eth2'
        option ipv6 '0'

config interface 'wireless'
        option proto 'static'
        option device 'eth2'
        option ipaddr ''
        option netmask ''
        option delegate '0'
        option ipv6 '0'

ok good... straight eth devices... the linked init.d script is valid then...

have a good read of that thread...

(note: if you don't have a keyboard and monitor or serial hooked up to your router... I highly advise you to do so you will need it while initially implementing and testing these script/s... also familiarize yourself with the ifstatus and ifconfig -a and dmesg commands... )

good to find another quality rtl8153 usb3.0 model...

tplink ue-300 might dry out... and their 350 is using another chipset...

In response to your question about the device files it creates when it initializes, that is part of the issue that I am running into, I don't know and cannot tell at all. There's no ttyUSB*, ttyACM*, nothing like that.

1 Like

Okay, will do, thank you

1 Like

I actually have a couple UE-300's and they are good, but the short and somewhat inflexible cable on them made them hard to deal with on this device. The longer tail on the UNI devices made it easier to deal with the cable connections to my Cisco 3850's.

1 Like

An Ethernet interface usually shouldn't have a device node starting with tty (teletype) this is usually used for serial connections nowadays. Unfortunately I have no clue what name it will show up under and have no way of testing, so maybe see what dmesg says once you plug one in

That makes sense, however, even when I check dmesg with dmesg | grep usb all I can see is the event where the adapters were plugged in or loaded. For example

usb 2-4: reset SuperSpeed Gen 1 USB device number 3 using xhci_hcd


That didn't let me go... So I tried googling a bit:

[    1.910578] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[    1.933004] usb 2-1: New USB device found, idVendor=0bda, idProduct=8153, bcdDevice=30.00
[    1.933008] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[    1.933011] usb 2-1: Product: USB 10/100/1000 LAN
[    1.933013] usb 2-1: Manufacturer: Realtek
[    1.933015] usb 2-1: SerialNumber: 000001000000

So definitely there should be slightly more, but your adapters are working right?

Sorry too long I didn't dig knee-deep into Linux' guts, it's nowadays just working too well for my needs :wink: