[PVE 9.1] Smartest Way to Run Ethtool Commands on PVE Node Boot?

Sep 1, 2022
511
193
53
41
Hello,

I need to have ethtool manually set an advertising flag on my NIC on boot, since the specific settings I need don't persist on reboot.

In particular, without intervention, this NIC only advertises 1 and 10 Gbps speeds for autonegotiation, but with the command below, it advertises 1, 2.5, 5, and 10 Gbps for autonegotiation.

The manually-executed command looks like this.
ethtool -s [interface name] advertise 0x1800000001028

Question: What's the best/safest way to tell Proxmox (Debian) to execute this command on boot, as early as possible to effectively auto-negotiate 2.5 Gbps or 5 Gbps when plugged into switches that only advertise those, but not so early that I'm going to get cross-ways with the automatic network bring-up that happens when the system boots?

I'm guessing I need to write a SystemD service, but I'm really new to that and pretty lost on the best way to use SystemD to interact with default network bring-up behavior.

Thanks for any advise or suggestions. :)
 
Can't you add something like this to the NIC's stanza in the /etc/network/interfaces file?
Bash:
post-up /usr/sbin/ethtool -s $IFACE advertise 0x1800000001028
 
Last edited:
  • Like
Reactions: SInisterPisces
Can't you add something like this to the NIC's stanza in the /etc/network/interfaces file?
Bash:
post-up /usr/sbin/ethtool -s $IFACE advertise 0x1800000001028

… As long as I've been using Proxmox, and as often as I've had to tinker with the /etc/network/interfaces file to configure bonds and VLANs and everything else, you'd think I'd have realized it can actually be used to configure all of this sort of thing.

I'll look into this command and try to make it work. It sounds like exactly what I want.
EDIT: Useful documentation for ifupown2 here: https://cumulusnetworks.github.io/ifupdown2/ifupdown2/userguide.html

EDIT 2: A reminded for n00bs (hi, it me) learning how to do this: the command inside the file won't have any immediate effect until the interface is brought up. So, if the interface is down, or already up, you'll need to bring it up manually (ifup <interface>) to test your config.

Thanks. :)
 
Last edited: