[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 73-usb-net-by-mac.rules is no longer used in Bullseye for USB ethernet devices?



On Wed, Feb 16, 2022 at 05:30:17PM +0300, Reco wrote:
> 	Hi.
> 
> On Wed, Feb 16, 2022 at 03:55:21AM -0600, Flacusbigotis wrote:
> > Back in Debian Buster, I learned that the "predictive" naming of this USB
> > ethernet interface would be governed by "73-usb-net-by-mac.rules" and so I
> > had it configured accordingly with a config file in
> > /etc/network/interfaces.d/... Namely that the device name would basically
> > be its MAC.
> 
> It's still true in Bullseye, but the implementation has changed
> somewhat.
> Instead of /lib/udev/rules.d/73-usb-net-by-mac.rules now systemd uses
> /lib/systemd/network/73-usb-net-by-mac.link.
> 
> 
> > Well, I just upgraded to Bullseye, and I can't bring up the darn
> > interface.  I have tried fiddling around with the device name in my config
> > file in /etc/network/interfaces.d/ directory, but it just won't come up.
> > The Networking.service also fails during bootup.
> 
> A straightforward approach would be to learn the actual name of the
> device via "ip a"/"ifconfig -a", and then using that name in /e/n/i.

I don't use a USB ethernet device.  I use the one that's inside my
computer.  Here's how I configure it.  First, I figured out what its MAC
address is.  Then, I decided what *name* I wanted it to have.  I chose
"lan0".

I created this file to assign that name to that interface, based on its
MAC address:

unicorn:~$ cat /etc/systemd/network/10-lan0.link 
[Match]
MACAddress=18:60:24:77:5c:ec

[Link]
Name=lan0


Next, I told interfaces(5) to configure it with DHCP:

unicorn:~$ cat /etc/network/interfaces
[...]
auto lan0
iface lan0 inet dhcp
[...]


Finally, I configured my router (which is also my DHCP server) to assign
the IP address I want, based on the MAC address.  In my case, it makes
the most sense to do this at the DHCP server, because I *also* configure
some IP port forwardings from the Internet to my computer in that same
router.  Keeping the IP assignment and the port forwardings all together
in the same device makes sense.

If you don't need to worry about port forwarding or other special Internet
configurations, then you might choose to assign the IP address statically
in interfaces(5) instead of using DHCP.  Both ways have their merits.


Reply to: