Introduction
In today's world, having multiple identical devices connected to a computer is a common scenario. One such example is having two Huawei E3372-325 modems connected to a Debian 12 system. By default, these modems are identified by their MAC addresses. However, it is essential to assign them human-readable, persistent names for easier management.
Prerequisites
Before we begin, ensure the following:
- Two identical Huawei E3372-325 modems are connected to your Debian 12 system.
- Both modems are configured and working correctly.
Renaming the Modems
To assign persistent names to the modems, we will use the /etc/udev/rules.d directory. This directory contains rules that allow us to define custom names for devices based on specific criteria.
Step 1: Identify the Device Names
First, we need to identify the names of the modems as assigned by the system. Run the following command:
$ ls /dev/cdc*
This command will list all the available modem devices. Identify the names of the two Huawei E3372-325 modems.
Step 2: Create the Rules File
Create a new file in the /etc/udev/rules.d directory with a name that includes the modem's persistent name. For example, create a file named 51-huawei-modem.rules. Open the file using your favorite text editor:
$ sudo nano /etc/udev/rules.d/51-huawei-modem.rules
Step 3: Define the Rules
Add the following lines to the file, replacing DEVNAME with the actual device names identified in step 1:
ACTION=="add", SUBSYSTEM=="tty", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1446", KERNEL=="ttyUSB*", SYMLINK+="huawei_modem%k"
ACTION=="add", SUBSYSTEM=="tty", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1447", KERNEL=="ttyUSB*", SYMLINK+="huawei_modem1%k"
Save and exit the file.
Step 4: Reload the Udev Rules
To apply the new rules, reload the udev rules:
$ sudo udevadm control --reload-rules
Verification
To verify that the modems have been renamed, run the following command:
$ ls /dev/huawei_modem*
In this article, we learned how to assign persistent names to identical Huawei E3372-325 modems connected to a Debian 12 system. We used the /etc/udev/rules.d directory to define custom names based on the device's MAC address.