Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set ipv4.may-fail / ipv6.may-fail #735

Open
Hoeze opened this issue Sep 19, 2024 · 11 comments
Open

Allow to set ipv4.may-fail / ipv6.may-fail #735

Hoeze opened this issue Sep 19, 2024 · 11 comments
Assignees

Comments

@Hoeze
Copy link

Hoeze commented Sep 19, 2024

Hi, I am trying to setup a persistent bridge with networkmanager but the bridge connection gets deactivated once it fails to configure IPv4.
Networkmanager allows to set "ipv4.may-fail" and "ipv6.may-fail" to keep the connection up even when the ip configuration fails.
Is it possible to set these options with this role?
If not, would it be possible to add these options?

@Hoeze
Copy link
Author

Hoeze commented Sep 20, 2024

I just realized that this is the wrong setting to change.
What I actually would need to keep the device up is setting connection.autoconnect-retries=0.

@liangwen12year
Copy link
Collaborator

In NetworkManager, ipv4.may-fail allows the connection to remain active even if it fails to configure an IP address (e.g., if IPv4 configuration fails). When may-fail is set to yes, NetworkManager will not deactivate the connection due to IP configuration failure. If your goal is to keep the bridge connection active even when IPv4 fails, setting may-fail to yes is the more appropriate solution. If you need NetworkManager to keep retrying until it successfully configures IPv4, you can use autoconnect-retries with an appropriate value. We can support the connection.autoconnect-retries in the network role, I will implement it asap, but if you would like to implement this feature, patch is welcomed.

@liangwen12year liangwen12year self-assigned this Sep 25, 2024
@liangwen12year
Copy link
Collaborator

The PR for supporting autoconnect_retries is #737 .

@Hoeze
Copy link
Author

Hoeze commented Oct 4, 2024

Amazing! Thanks a lot @liangwen12year 🎉
Given your previous answer, it would then make sense to have ipv4.may-fail=yes and autoconnect_retries=0, if I want to keep the connection up until it obtains an IP, right?

@liangwen12year
Copy link
Collaborator

@Hoeze , ipv4.may-fail=yes tells NetworkManager that the connection should still be considered "up" even if it fails to configure IPv4. In your situation, I honestly think that it would then make sense to have ipv4.may-fail=no and autoconnect_retries=0.

@Hoeze
Copy link
Author

Hoeze commented Oct 4, 2024

Oh, I see, then I misunderstood this option. Thank you for the explanation.

Would you be able to also support the ipv[4|6].may-fail option in this role?

@liangwen12year
Copy link
Collaborator

liangwen12year commented Oct 4, 2024

yes, I can support it. By the way, ipv[4|6].may-fail is already supported in network_state variable but autoconnect-retries setting is not supported in network_state variable. But the backend of network_state variable- nmstate has the mechanism for retrying to apply the desired state a few times before giving up when encountering the applying failure.

@liangwen12year
Copy link
Collaborator

The property in network_state variable corresponds to may-fail: no is wait-ip, the setting can be set to the following options:

     * "any": System will consider interface activated when any IP stack is
              configured(neither static or automatic).
     * "ipv4": System will wait IPv4 been configured.
     * "ipv6": System will wait IPv6 been configured.
     * "ipv4+ipv6": System will wait both IPv4 and IPv6 been configured.

Here is an example:

network_state:
  interfaces:
    - name: eth1
      type: ethernet
      state: up
      wait-ip: ipv4+ipv6
      ipv4:
        enabled: true
        dhcp: true
        auto-dns: true
        auto-gateway: true
        auto-routes: true
      ipv6:
        enabled: true
        dhcp: true
        autoconf: true
        auto-dns: true
        auto-gateway: true
        auto-routes: true

@Hoeze , can you try out the network_state variable? I think that this already fulfill your needs by configuring wait-ip proprety.

@liangwen12year
Copy link
Collaborator

@Hoeze , this is the PR for may fail support in the network role, #741.

@Hoeze
Copy link
Author

Hoeze commented Oct 17, 2024

Thanks a lot @liangwen12year! It's amazing to have these features so fast available :)

Reguarding your suggestion, I did not have time to test it yet. But #741 makes it unnecessary, right?

@liangwen12year
Copy link
Collaborator

Thanks a lot @liangwen12year! It's amazing to have these features so fast available :)

Reguarding your suggestion, I did not have time to test it yet. But #741 makes it unnecessary, right?

Right. you can achieve the similar effect by using the may_fail4 or may_fail6 in the network_connections variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants