1

I've recently picked up Rocky Linux 9.1 and am trying to get the basic networking to work correctly using netplan and networkmanager. There must be something simple missing here...

I have a very simple NetPlan yaml:

network:
  version: 2
  renderer: NetworkManager
    eno5:
      dhcp4: true

Simple - just want an automatic DHCP IP address on eno5 when it is plugged in. If the network cable is plugged in on boot, or I manually run the following, it works.

sudo netplan generate
sudo nmcli conn reload

However - if I just unplug the ethernet cable and plug it into my second home network, I don't get a new DHCP address on the second network. The NIC link goes down and back up, but no new connection AND the existing connection doesn't get shut down - it still shows the old IP address, etc... while the cable is unplugged.

How do I get the link coming up to trigger a new connection? I've found some info on the NetworkManager Dispatcher, but nothing with a simple answer for a basic connection.

Even with a fresh install of Rocky 9.1 with an ethernet connection configured and working during the install - how can it not do something as fundamental as disconnect and reconnect to a network?

Joe Bauman
  • 21
  • 1
  • 6

2 Answers2

1

I was able to get this working - it looks like it was a combination of things.

  1. Disable SELinux (or there may be more limited allow options here).
  2. Delete the generic NetworkManager port descriptions in /etc/NetworkManager/system-connections/*. New one(s) will be generated in step 3.
  3. Add the netplan yaml to describe the desired port config(s) - example above in the question. Run sudo netplan generate to generate the port config(s) in /run/NetworkManager/system-connections/*.
  4. Add /etc/NetworkManager/conf.d/99-carrier.conf with the following and restart NetworkManager so it takes effect:
[main]
ignore-carrier=no

[device] match-device=interface-name:en* carrier-wait-timeout=1000

The first section tells NetworkManager to monitor the port carrier for connects/disconnect. Without this, it wouldn't even disable the connection when the cable was unplugged. The second section is from a previous answer.

Joe Bauman
  • 21
  • 1
  • 6
0

How do I get the link coming up to trigger a new connection?

Wait longer before connecting the cable. NetworkManager has a deliberate delay of 5 seconds after link-down before it starts to deconfigure the interface.

This can be adjusted through NetworkManager.conf:

[device]
match-device=interface-name:en*
carrier-wait-timeout=1000
grawity
  • 501,077