[2025-jun-17] The SlackDocs mailing lists at https://lists.alienbase.nl/mailman/listinfo have been retired. No one has been using these lists for years and it's time to say goodbye. The list archives remain available at https://scalzi.slackware.nl/mailman/listinfo/slackdocs

[2025-jun-17] The SlackDocs Wiki has moved to a new server, in order to make it more performant.

Welcome to the Slackware Documentation Project

Simple way to set up USB ethernet device


Introduction

If you have a USB ethernet compatible device, you can set up your internet connection to a USB device with a few simple steps. Mainly you need to map your USB device MAC address as a network interface with udev, reboot or run some specific udev commands to make the change effective, and that's it. You can then use your USB device like any other network interface (like eth0 or wlan0). The Slackware Kernel comes with the necessary modules to make this work in most cases, but if you have some exotic device, you might need to add some relevant modules. The relevant search term is “cdc”.

Summary:

lsusb
lsusb -v -s 001
nano /etc/udev/rules.d/70-persistent-net.rules
udevadm control --reload-rules && udevadm trigger
(or reboot)
ip link list
ifconfig usb0 up
dhcpcd usb0

Preparations

If your USB device is connected, you should be able to find it using the command lsusb. Simply type the command, find your device and note down the device number, like for example 001.

lsusb
There are two things you need to do, you need to find your device MAC address and if you don't know you can also check if the USB device is ethernet compatible.

To check if the device is ethernet compatible, study lsusb -v output or run something like this (with the correct device number).

lsusb -v -s 001 | grep -i ethernet

If you get some output about ethernet, provided you used the correct device number, you are good to go, if not your device is probably not ethernet compatible!

To get the mac address, find it under lsusb -v or run something like this:

lsusb -v -s 001 | grep -i mac

You should find the correct MAC address for your USB ethernet device. You can note it down or pipe and append it into the file by adding “» file” to the command above.

Mapping your USB device as a network device

You need to add an entry into /etc/udev/rules.d/70-persistent-net.rules to map your USB device as a USB ethernet network device. This file already contains an entry as part of Slackware, the best idea is to follow this example and make a similar entry.

nano /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:yy:zz:xx:yy:zz", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="usb0"
ctrl+x (and save the file)
In the “ATTR{address}==“xx:yy:zz:xx:yy:zz” section, add the MAC address you found with lsusb -v two letters/digits at a time in the same format as in the udev file. You don't need capitalized letters.

Once this file is changed, you need to make the changes effective. There are two simple ways of doing that, you can reboot your computer or you can use the following command to update the state of udev:

udevadm control --reload-rules && udevadm trigger

Once this is done, your USB device should be mapped as usb0 and you can proceed to do any of the normal network setups with this device.

Check available devices (hopefully it's there as usb0)

ip link show

Bring the device up

ifconfig usb0 up

Set up dhcp

dhcpcd usb0


Additional info

The relevant Kernel modules for this is usbnet, cdc_ether, mii and other device specific drivers, they can be found here:

Location:                                                                                                                                                                                                                       
-> Device Drivers    
   -> Network device support (NETDEVICES [=y])
      -> USB Network Adapters (USB_NET_DRIVERS [=y])

and …

Location: 
-> Device Drivers
   -> Network device support (NETDEVICES [=y])
      -> USB Network Adapters (USB_NET_DRIVERS [=y])
        -> Multi-purpose USB Networking Framework (USB_USBNET [=m])


Sources

* Originally written by zeebra

QR Code
QR Code howtos:hardware:usb_ethernet_simple (generated for current page)