During an experiment, I need to use three WiFi interfaces on a Raspberry Pi running Ubuntu 20.04.
In addition to Raspberry Pi's internal WiFi interface, I added two USB WiFi adapters.
Three network interfaces showed up in the system (
ip link command), and they are named wlan0, wlan1, and wlan2 by default.
I often need to capture packets with
tcpdump, and I often have to be type these interface names manually.
It isn't easy to remember the purpose of each network interface, so I wanted to rename the interfaces to reflect their role in my application.
However, this isn't as easy as it sounds.
Ubuntu 20.04 configures network interfaces using Netplan, so my first thought was: I can write a Netplan configuration that matches network interfaces with their MAC addresses, and assigns the desired name to each network interface.
The config file would look like this: