# USB ethernet not named eth1 on rpi4

**URL:** <https://forums.balena.io/t/usb-ethernet-not-named-eth1-on-rpi4/50611>\
**Category:** Product support\
**Created:** [December 11, 2019, 7:25pm UTC](https://forums.balena.io/t/usb-ethernet-not-named-eth1-on-rpi4/50611 "2019-12-11T19:25:14Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![pdcastro](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pdcastro/32/1264_2.png) [@pdcastro](https://forums.balena.io/u/pdcastro)\
**Post date:** [December 12, 2019, 1:40am UTC](https://forums.balena.io/t/usb-ethernet-not-named-eth1-on-rpi4/50611/7 "2019-12-12T01:40:08Z")

</div>

@xyala, I’ve now successfully tested the udev method as follows.

First, I was able to reproduce the `enp1s0u2` interface name with a USB-Ethernet adapter, using an RPi4 device running balenaOS 2.44.0+rev3:

```nohighlight
$ dmesg
...
[394.126615] ax88179_178a 2-2:1.0 eth1: register 'ax88179_178a' at usb-0000:01:00.0-2, ASIX AX88179 USB 3.0 Gigabit Ethernet, 00:0e:c6:aa:cb:79
[394.154992] ax88179_178a 2-2:1.0 enp1s0u2: renamed from eth1

```

Note the last line above: `enp1s0u2: renamed from eth1`. Colleagues have pointed out that this appears to be the “Predictable Network Interface Names” feature; some references: [ref1](https://wiki.debian.org/NetworkInterfaceNames), [ref2](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/), [ref3](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-understanding_the_predictable_network_interface_device_names).

Then I edited the `config.json` file (on the root of the SD card) to add an udev rule to rename the interface to `newname1`:

```json
  "os":{
   "udevRules": { "10" : "SUBSYSTEM==\"net\", ACTION==\"add\", ATTR{address}==\"00:0e:c6:aa:cb:79\", NAME=\"newname1\"" }
  },

```

This rule matches on the MAC address of my network interface (`00:0e:c6:aa:cb:79`), but it should be possible to write a rule that matches on vendor and product IDs listed with `lsusb -v`, in case you wanted to write a single rule for all devices in your fleet. More on udev rules: [ref4](http://reactivated.net/writing_udev_rules.html), [ref5](https://medium.com/swlh/hot-plugging-usb-devices-in-balenaos-5dca4b05ca7e), [ref6](https://forums.balena.io/t/custom-udev-rules/2415).

Then I created a single-container (‘main’) balena app with this trivial Dockerfile:

```auto
FROM balenalib/raspberrypi3:stretch
ENV UDEV=1
CMD ["/bin/bash"]

```

In my experiment, it was important to use a balenalib base image (in the `FROM` Dockerfile line) because then my Dockerfile “inherits” the default `ENTRYPOINT ["/usr/bin/entry.sh"]` instruction; references: [ref7](https://www.balena.io/docs/reference/base-images/base-images/#how-the-images-work-at-runtime), [ref8](https://hub.docker.com/r/balenalib/raspberrypi3).

Then after pushing the app and rebooting the device, the interface was renamed to `newname1`, as per udev rule:

```auto
$ dmesg
[7.996531] ax88179_178a 2-2:1.0 eth1: register 'ax88179_178a' at usb-0000:01:00.0-2, ASIX AX88179 USB 3.0 Gigabit Ethernet, 00:0e:c6:aa:cb:79
[8.103277] ax88179_178a 2-2:1.0 newname1: renamed from eth1

$ ifconfig
...
newname1 Link encap:Ethernet HWaddr 00:0E:C6:AA:CB:79
          UP BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

```

---

_[View the full topic](https://forums.balena.io/t/usb-ethernet-not-named-eth1-on-rpi4/50611)._
