Is there a way to run a script when an interface comes up when using NetworkManager? The post-up hook in interfaces is great, but I'm trying to run
an ethtool command when I plug into my docking station and suddenly it's ethernet interface is available.
Hello,
Is there a way to run a script when an interface comes up when using NetworkManager? The post-up hook in interfaces is great, but I'm trying to run
an ethtool command when I plug into my docking station and suddenly it's ethernet interface is available.
Mike
What is the reason in your case?The interface is screwing up autonegotiation and falling back to 10mbits. It's a
Maybe NM can handle that with a setting.
You can put any command in post-up or if you prefer you can add a scriptI didn't think that would run on a NetworkManager-managed interface. NetworkManager.conf says ifupdown support is disabled.
in /etc/network/if-up.d such this one:
$ cat /etc/network/if-up.d/postfix
#! /bin/sh
# update postfix copy of resolv.conf (picked up automatically); only default instance is handled
[ lo != "$IFACE" ] && cp -pLu /etc/resolv.conf /var/spool/postfix/etc/resolv.conf 2>/dev/null || :
On 08/01/26 Michel Verdier said:
You can put any command in post-up or if you prefer you can add a script
in /etc/network/if-up.d such this one:
$ cat /etc/network/if-up.d/postfix
#! /bin/sh
# update postfix copy of resolv.conf (picked up automatically); only default instance is handled
[ lo != "$IFACE" ] && cp -pLu /etc/resolv.conf /var/spool/postfix/etc/resolv.conf 2>/dev/null || :
I didn't think that would run on a NetworkManager-managed interface. NetworkManager.conf says ifupdown support is disabled.
On 08.01.2026 15:20 Michael P. Soulier wrote:
The interface is screwing up autonegotiation and falling back to
10mbits. It's a Gigabit interface. So I force it to Gigabit using
ethtool.
You should then check the logs and also check the cabling etc. to
verify it is not a hardware issue.
The driver of one of the sides might also be faulty, which should be excluded.
On 08/01/26 Marco Moock said:It's a
What is the reason in your case?
Maybe NM can handle that with a setting.
The interface is screwing up autonegotiation and falling back to 10mbits.
Gigabit interface. So I force it to Gigabit using ethtool.
another ethernet port on the machine. You may need to add an ethernet
card to replace the port.
Forcing the port to 1 Gbps or 10 Gbps using software is one of the
last things I would try. The problem lies elsewhere.
I have the same problem with a RTL8411b. I use the right driver and I
don't find another driver to set this device up. It start with
10Mbps. I solved this with
Is there a way to run a script when an interface comes up when using NetworkManager? The post-up hook in interfaces is great, but I'm trying to run
an ethtool command when I plug into my docking station and suddenly it's ethernet interface is available.
Is that a problem with this driver, so does autonegotiation work in
other operating systems?
Is that a problem with this driver, so does autonegotiation work in
other operating systems?
However, I do have to wonder: why is the OP using network manager forPerhaps because NetworkManager is used on multiple distributions and is now the de facto standard. And since it's a laptop it makes sense to have a dynamic configuration that I can control from once place, instead of part of my config in NM and part in interfaces, in a file format that only Debian-based distros care about. Since on any given day I could be on a variety of systems.
this interface, if they already know how to solve the problem using
ifupdown? Why not simply configure this interface in
/etc/network/interfaces and be done with it?
On 08/01/26 Greg Wooledge said:
However, I do have to wonder: why is the OP using network manager for
this interface, if they already know how to solve the problem using ifupdown? Why not simply configure this interface in /etc/network/interfaces and be done with it?
Perhaps because NetworkManager is used on multiple distributions and is now the
de facto standard.
And since it's a laptop it makes sense to have a dynamic
configuration that I can control from once place, instead of part of my config
in NM and part in interfaces, in a file format that only Debian-based distros care about. Since on any given day I could be on a variety of systems.
I am unsure if you really need a hook. Have you had a look into nm-settings(5)?
In addition I would evaluate if it can be done by setting driver parameters or by a udev rule.
On 08/01/26 Greg Wooledge said:
However, I do have to wonder: why is the OP using network manager
for this interface, if they already know how to solve the problem
using ifupdown? Why not simply configure this interface in /etc/network/interfaces and be done with it?
Perhaps because NetworkManager is used on multiple distributions and is now the
de facto standard.
on any given day I could be on a variety of systems.
On Thu, Jan 08, 2026 at 05:19:27PM -0500, Michael P. Soulier wrote:
on any given day I could be on a variety of systems.
The thing is, when you attach to your docking station that is kind of
"one place" no matter where you are at the time. I'm guessing it makes
an Ethernet device appear [...]
I interpreted Michael's text to mean "I want all of my Linux
distributions, of which I use a wide variety, to be configured using
the same tools".
He's rejecting ifupdown solutions because he wants everything to look
like a Red Hat system.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 5 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 19:03:30 |
| Calls: | 117 |
| Calls today: | 117 |
| Files: | 367 |
| D/L today: |
540 files (253M bytes) |
| Messages: | 70,845 |
| Posted today: | 26 |