# Problem with network usb interfaces



## rollomista (Dec 12, 2022)

Hi all, i'm newbie on freebsd system. 

I need to configure multiple usb network interfaces but any configuration failed. In other words, i would configure name for any interface usb using mac address to match.

I tried to configure /etc/devd.conf, adding these lines but didnt work:

```
attach 10 {
    device-name "ue0";
    match "mac" "a0:ce:c8:72:d2:fa";
    action "ifconfig_up";
};
```

Any suggestions?  My problem is on multiple network usb interfaces because for each reboot freebsd probe usb and change name


----------



## SirDice (Dec 12, 2022)

You don't know the device name, that's the one that keeps changing.

Not sure if this would work:

```
attach 10 {
  match "system"       "USB";
  match "subsystem" "INTERFACE";
  match "type"           "ATTACH";
  device-name "ue[0-9]+";
  action '/etc/myscript'; 
}
```
But then I don't know how you could match on the MAC address, "mac" doesn't seem like a variable you can use in a match. But you can `action` a script and do some further parsing there.


----------



## rollomista (Dec 12, 2022)

SirDice said:


> You don't know the device name, that's the one that keeps changing.


Really thanks for answer.

Yeah, I dont know the device name, but i would like setting it by MAC address. My idea is: when freebsd probe usb device and match with mac address, in that moment i would configure device name on usb interface. Is it possible?


----------



## rollomista (Dec 12, 2022)

SirDice said:


> You don't know the device name, that's the one that keeps changing.
> 
> Not sure if this would work:
> 
> ...


Nice idea. I'll try it and reply you.

Sorry for my stupid questions, but this problem hard trigger me


----------



## SirDice (Dec 12, 2022)

Not a stupid question, it's fairly complex. You're rather limited in what you can use to `match`, the card's MAC address just isn't there. See devd.conf(5).

I've used a custom devd.conf(5) to report the changing of the CARP state to Zabbix. And it took a bit of fiddling to get it working the way I wanted.


----------



## rollomista (Dec 13, 2022)

SirDice said:


> Not a stupid question, it's fairly complex. You're rather limited in what you can use to `match`, the card's MAC address just isn't there. See devd.conf(5).
> 
> I've used a custom devd.conf(5) to report the changing of the CARP state to Zabbix. And it took a bit of fiddling to get it working the way I wanted.



eheh i could only imagine 

Anyway i found a solution. I wrote a python's script that parse interfaces and set name and ip by mac address. It's not best solution (imho) but it works!

Thank you!


----------

