207 Commits

Author SHA1 Message Date
Beniamino Galvani
c70b4a98a3 core: use the sriov.preserve-on-down property 2025-06-18 13:20:49 +02:00
Beniamino Galvani
b571e2be5a man: fix syntax to match on connection-id
Fixes: 604c611cd0 ('core: add nm_utils_connection_match_spec_list()')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1746
2025-04-15 11:15:02 +02:00
Wen Liang
2ad5fbf025 policy: refresh IPv4 forwarding after connection activation and disconnection
Previously, IPv4 shared method will automatically enable the IPv4
global forwarding, all the per-interface level IPv4 forwarding settings
may be changed to match the global setting. Also, all the per-inteface
level forwarding settings can not be restored when deactivating the
shared connection. This is problematic as it may disrupt custom
configurations and lead to inconsistent forwarding behavior across
different network interfaces.

To address this, the implementation now ensures that the original
per-interface forwarding settings are preserved. Upon activating a
shared connection, instead of enabling IPv4 global forwarding
automatically, the per-interface forwarding is enabled on all other
connections unless a connection explicitly has the forwarding set to
"no" in its configuration. Upon deactivating all shared connection,
per-interface forwarding settings are restored to sysctl's default
value. Furthermore, deactivating any connection explicitly sets the
forwarding to sysctl's default value ensuring that network forwarding
behavior remains consistent.
2025-04-01 09:32:46 -04:00
Wen Liang
a8a2e6d727 ip-config: Support configuring per-device IPv4 sysctl forwarding option
Add support for configuring per-interface IPv4 sysctl forwarding setting
in NetworkManager. The feature allows users to configure the
net.ipv4.conf.<interface>.forward setting directly through
NetworkManager, enabling targeted forwarding configurations for
interfaces. This is particularly useful for cases such as enabling
forwarding for MetalLB load balancing without requiring a global
ip_forward=1 setting.

While forwarding setting can be managed via /etc/sysctl.conf,
configuring sysctl options for dynamically created or
software-configured interfaces (e.g., bridges) poses challenges. With
this feature, NetworkManager can configure these settings when
interfaces are created or updated, users no longer need to rely on
nm-dispatcher scripts for per-interface sysctl configuration, which can
be error-prone and complex. This feature ensures a more seamless and
integrated way to manage per-interface forwarding configurations,
reducing user overhead and improving usability in complex network
setups.

We do not support configuring per-device IPv6 sysctl forwarding because
in order to make per-device IPv6 sysctl forwarding work, we also need to
enable the IPv6 global sysctl forwarding setting, but this has potential
security concerns because it changes the behavior of the system to
function as a router, which expose the system to new risks and
unintended traffic flows, especially when enabling forwarding on the
interface the user previously explicitly disabled. Also enabling
per-device IPv6 sysctl setting will change the behavior of router
advertisement (accept_ra), which is not expected. Therefore, we
only support configuring per-device IPv4 sysctl forwarding option in
NetworkManager.

Resolves: https://issues.redhat.com/browse/RHEL-60237
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2071
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1833
2025-04-01 09:32:46 -04:00
Michael Biebl
0e83c595f3 Rephrase certain expressions to avoid the usage of the term "allows to" 2025-03-27 09:44:07 +01:00
Michael Biebl
898db303c3 typo fix: allow to -> allow one to
Detected by lintian:

Example:
I: network-manager: typo-in-manual-page "allow to" "allow one to" [usr/share/man/man5/NetworkManager.conf.5.gz:1392]
2025-03-26 19:22:56 +01:00
Michael Biebl
10e58f7c3c typo fix: allows to -> allows one to
Detected by lintian:

Example:
I: network-manager: typo-in-manual-page "allows to" "allows one to" [usr/share/man/man5/NetworkManager.conf.5.gz:1266]
2025-03-26 19:22:01 +01:00
Jan Vaclav
152d71a1f1 policy: accept localhost hostnames if static
Prevents NetworkManager from trying to determine the
transient hostname via DHCP or other means if "localhost"
is already configured as a static hostname, as the transient
hostname will be ignored by hostnamed if a static hostname
has already been set.
2025-03-11 09:26:20 +00:00
Dan Williams
22f5f71523 man: fix spelling in NetworkManager.conf connectivity response docs
specifid -> specified

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-02-05 17:50:04 +00:00
Tomas Korbar
c6e1925dec dns: Add dnsconfd DNS plugin
dnsconfd can now be used as DNS configuration plugin.

If ipvX.routed-dns is set to -1 and dnsconfd plugin is enabled then
routes are added by default.
2025-01-29 14:41:47 +01:00
Tomas Korbar
c08ecfd5fe dns: Add resolve-mode and certification-authority keys to global-dns
Resolve-mode allows user to specify way how the global-dns domains
and DNS connection information should be merged and used.

Certification-authority allows user to specify certification
authority that should be used to verify certificates of encrypted
DNS servers.
2025-01-29 14:41:47 +01:00
Beniamino Galvani
95ac6b71cb man: fix typo 2025-01-20 19:03:51 +01:00
Beniamino Galvani
d0330fb909 man: remove sentence about order of DHCP clients
The list describing the order of DHCP clients is confusing because it
doesn't take into account what clients are disabled at build
time. Instead, just show the available clients in the preferred order.
2025-01-20 19:03:49 +01:00
Beniamino Galvani
774484eed6 man: document which DHCP clients are enabled in this build
Describe in the NetworkManager.conf man page what DHCP clients the
user can set in this build, instead of showing a generic list and
letting the user try each one.
2025-01-20 19:02:06 +01:00
Beniamino Galvani
8416a58e26 core: accept DNS URIs in global configuration
Accept name servers specified with an URI syntax in the global
configuration. A plugin that doesn't support a specific scheme can
decide to ignore it and use only the servers it understands. At the
moment there is no plugin that supports DNS-over-TLS servers in the
global configuration.
2025-01-07 15:41:43 +01:00
Wen Liang
658aef0fa1 connection: Support connection.ip-ping-addresses
We have encountered multiple incidents where users face connectivity
issues after booting, particularly due to hardware like switches that do
not pass traffic for a few seconds after startup. And services such as
NFS fail to mount because they try to initiate before the network is
fully reachable. Therefore, we are supporting
`connection.ip-ping-addresses` and `connection.ip-ping-timeout` to
allow administrators to configure the network to verify connectivity to
a specific target(such as a service like NFS) instead of relying on
gateway reachability, which may not always be relevant in certain
network configurations.

Resolves: https://issues.redhat.com/browse/RHEL-21160
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2034
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1797
2024-11-05 14:04:26 -05:00
Wen Liang
51ea910cc2 device: Support configuring dhcp-send-hostname globally
The user does not want to send machine hostname to the DHCP server
globally by default to avoid ddns record getting created in IPAM.
otherwise, IPAM creates ddns records which might interfere with user's
regular host record. Thus, introduce the ternary property
dhcp_send_hostname_v2 to warrant this behavior.

Notice that we set the GSpec of dhcp-send-hostname-v2 to int, because
defining it as enum would make that it cannot be expanded in a backwards
compatible way if we need to add more values: old clients using libnm
would reject it due to the new value being unknown. Follow the same
strategy than _nm_setting_property_define_direct_enum, defining the
NMSettInfoPropertType as enum, but the glib's GSpec as int.

Resolves: https://issues.redhat.com/browse/RHEL-56565
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2029
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1765
2024-10-24 17:03:10 -04:00
Beniamino Galvani
5449b18a94 core: support automatically adding DNS routes
When the "ipvX.routed-dns" property is set to true, add a route for
each DNS server via the current interface. The feature works in the
following way.

A new routing rule is created ("priority $PRIO not fwmark $MARK lookup
$TABLE") where $PRIO, $MARK and $TABLE are fixed values and are the
same for all interfaces. This rule is evaluated before standard rules
and tries to look up routes in table $TABLE, where NM adds the routes
to DNS servers.

To determine the next-hop to the name server, NM issues a RTM_GETROUTE
netlink request to kernel, specifying to return the route via the
current interface. In order to avoid results from $TABLE, NM also sets
the fwmark as $MARK in the request.
2024-10-23 15:38:36 +02:00
Beniamino Galvani
03c01eae29 device: configure IPv6-only-preferred mode in the DHCP client
Configure the DHCP client to enable the IPv6-only-preferred mode based
on the content of the profile and on global configuration.
2024-10-23 15:01:20 +02:00
Fernando Fernandez Mancera
ad68b28843 config: parse autoconnect-ports value on config
As part of the conscious language effort we must provide an alternative
option to configure autoconnect-ports system-wide on NetworkManager
configuration file.
2024-08-09 15:47:32 +02:00
Fernando Fernandez Mancera
79221f79a2 src: drop most slave references from the code
While we cannot remove all the references to "slave" we can remove most
of them.
2024-08-09 15:47:32 +02:00
Fernando Fernandez Mancera
090d617017 src: drop most master references from the code
While we cannot remove all the references to "master" we can remove most
of them.
2024-08-09 15:47:32 +02:00
Lubomir Rintel
05b4610667 man: update dhcp client manual after dhclient deprecation
Reflect the change in priority and deprecation in the manual.
Hopefully make it slightly easier to read along the way.

https://issues.redhat.com/browse/RHEL-24622
2024-07-11 11:09:32 +02:00
Mary Strodl
ed318e8774 connectivity: Add a timeout option to connectivity checks
Adds an option in the connectivity section to change the timeout before
the interface is deemed "limited". Previously, it was hardcoded to
20 seconds, but for our usecase (failing over to cell modem if
hardwired ethernet drops), it's nice to be able to failover to another
interface more quickly.
2024-06-24 09:21:34 +00:00
Michael Biebl
e5bf2d24cd typo fix: overriden -> overridden
Detected by lintian:
I: network-manager: typo-in-manual-page overriden overridden [usr/share/man/man5/NetworkManager.conf.5.gz:396]
I: network-manager: typo-in-manual-page overriden overridden [usr/share/man/man5/nm-system-settings.conf.5.gz:396]
2024-05-23 10:22:33 +00:00
Íñigo Huguet
7ec363a79a ip6: revert to using sysctl ipv6.conf.default for ip6-privacy
Commit 797f3cafee ('device: fall back to saved use_tempaddr value
instead of rereading /proc') changed the behaviour of how to get the
last resort default value for ip6-privacy property.

Previously we read it from /proc/sys/net/ipv6/conf/default, buf after
this commit we started to read /proc/sys/net/ipv6/conf/<iface> instead,
because the user might have set a different value specific for that device.
As NetworkManager changes that value on connection activation, we used
the value read at the time that NetworkManager was started.

Commit 6cb14ae6a6 ('device: introduce ipv6.temp-valid-lifetime and
ipv6.temp-preferred-lifetime properties') introduced 2 new IPv6 privacy
related properties relying on the same mechanism.

However, this new behaviour is problematic because it's not predictable
nor reliable:
- NetworkManager is normally started at boot time. That means that, if a
  user wants to set a new value to /proc/sys/net/ipv6/conf/<iface>,
  NetworkManager is likely alread running, so the change won't take
  effect.
- If NetworkManager is restarted it will read the value again, but this
  value can be the one set by NetworkManager itself in the last
  activation. This means that different values can be used as default in
  the same system boot depending on the restarts of NetworkManager.

Moreover, this weird situation might happen:
- Connection A with ip6-privacy=2 is activated
- NetworkManager is stopped. The value in
  /proc/sys/net/ipv6/conf/<iface>/use_tempaddr remains as 2.
- NetworkManager starts. It reads from /proc/sys/... and saves the value
  '2' as the default.
- Connection B with no ip6-privacy setting is activated. The '2' saved
  as default value is used. The connection didn't specify any value for
  it, and the value '2' was set by another connection for that specific
  connection only, not manually by a user that wanted '2' to be the
  default.

A user shouldn't have to think on when NetworkManager starts or restarts
to known in an easy and predictable way what the default value for
certain property is. It's totally counterintuitive.

Revert back to the old behaviour of reading from
/proc/sys/net/ipv6/conf/default. Although this value is used by the
kernel only for newly created interfaces, and not for already existing
ones, it is reasonable to think on these settings as "systemwide
defaults" that the user has chosen.

Note that setting a different default in NetworkManager.conf still takes
precedence.
2024-05-10 12:01:08 +00:00
Tomasz Kłoczko
20677c175d update DocBook DTD version to latest stable 4.5
Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
2024-04-22 12:06:16 +00:00
Alex Henrie
6cb14ae6a6 device: introduce ipv6.temp-valid-lifetime and ipv6.temp-preferred-lifetime properties
When IPv6 privacy extensions are enabled, by default temporary addresses
have a valid lifetime of 1 week and a preferred lifetime of 1 day.
That's far too long for privacy-conscious users, some of whom want a new
address once every few seconds. Add connection options that correspond
to /proc/sys/net/ipv6/conf/*/temp_valid_lft and
/proc/sys/net/ipv6/conf/*/temp_prefered_lft to allow configuring the
address rotation time on a per-connection basis.

The new properties are defined as 32-bit signed integers to match the
sysctl parameters which are also signed, although currently only
positive numbers are valid.
2024-03-20 23:46:32 -06:00
Alex Henrie
797f3cafee device: fall back to saved use_tempaddr value instead of rereading /proc
There may be a per-interface default set by the sysctl
net.ipv6.conf.<iface>.use_tempaddr that is different than
net.ipv6.conf.default.use_tempaddr.
2024-03-20 23:42:22 -06:00
Fernando Fernandez Mancera
ac4e63ddda ip: support dhcp-send-release in NMSettingIpConfig
Introduce a new option to NMSettingIpConfig. The new option is ternary
type being the default value set to disabled. When enabled,
NetworkManager will instruct the DHCP client to send RELEASE message
when IP addresses are being removed.
2024-03-06 11:14:16 +01:00
Fernando Fernandez Mancera
bd38a19832 connection: add support to down-on-poweroff
The new option at NMSettingConnection allow the user to specify if the
connection needs to be down when powering off the system. This is useful
for IP address removal prior powering off. In order to accomplish that,
we listen on "Shutdown" systemd DBus signal.

The option is set to FALSE by default, it can be specified globally on
configuration file or per profile.
2024-03-04 18:16:54 +00:00
Beniamino Galvani
010c54dce9 macsec: support the offload property 2024-02-21 10:51:57 +01:00
Beniamino Galvani
3cf6a805ba device: support the DHCP DSCP property 2024-02-06 14:24:39 +01:00
Thomas Haller
1128bceab9 doc: clarify limitation of parsing values in "NetworkManager.conf"
This really should be fixed, because it's a non-obvious limitation.
Anyway, document it for now.
2024-01-29 09:50:37 +01:00
Thomas Haller
fa503e402d doc: clarify default for "connection.mdns" in manual
The default in systemd-resolved is nowadays "yes". In any case, since
the setting is configurable systemd-resolved, don't describe it in the
manual page.

Instead, clarify the behavior and try to improve the documentation.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1467
2024-01-29 09:50:29 +01:00
Fernando Fernandez Mancera
6576ddc532 config: drop slaves-order config option
This option was only introduced only to allow keeping the old behavior
in RHEL7, while the default order was changed from 'ifindex' to 'name'
in RHEL8. The usefulness of this option is questionable, as 'name'
together with predictable interface names should give predictable order.
When not using predictable interface names, the name is unpredictable
but so is the ifindex.

https://issues.redhat.com/browse/NMT-926

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1814
2023-12-12 15:28:52 +01:00
Íñigo Huguet
5481ba1568 Add more detailed explanations for users, contributors and maintainers
README.md:

As this document is mainly for normal users, and in Gitlab it's
displayed by default, it's the main entry point to get information when
someone get into the repo, either via web or cloned.

Added explanations about how to install and use NM and how to find the
documentation for users. Added brief info about how to report issues
and ask for help, with links to CONTRIBUTING.md to get more details.

Added brief link for potential contributors to read CONTRIBUTING.md.
People not familiar with open source projects might not be aware of it.

Deleted the "moved to freedesktop" message. After 15 years, people might
know yet.

Added brief explanation about the free software license.

CONTRIBUTING.md:

Added a link to the list of all communication channels, only mailing
list and IRC were listed.

Added detailed explanation about how to report issues and attach logs.
It also references the new tool anonymize-logs.py.

Added brief guidelines about how to start contributing choosing issues
from the tracker.

Fixed some small formatting issues and added a reference to nm-in-vm,
fixing the link to nm-in-container too.

MAINTAINERS.md:

Added explanation about how to triage and properly label the issues.
This is basically based on the kind-of-workflow that we already have,
but maybe it's a good time to check that it's correct or to propose
small changes (so, please propose changes in review).
2023-11-24 07:40:08 +00:00
Beniamino Galvani
7a07a0b92d man: replace license blurb with SPDX tag 2023-10-06 13:27:59 +02:00
Fernando Fernandez Mancera
4b78778e8b man: update default carrier-wait-timeout in NetworkManager.conf
The default value was updated to 6 seconds in
156344b8be.
2023-08-30 17:20:33 +02:00
Fernando Fernandez Mancera
a44f20c985 man: adjust references of nm-settings to nm-settings-nmcli
nm-settings was renamed to nm-settings-nmcli therefore we should rename
all the references to nm-settings-nmcli.
2023-08-01 14:21:23 +02:00
Thomas Haller
ad6064e4e8 man: fix typo in "NetworkManager.conf" manual 2023-07-27 21:37:22 +02:00
Thomas Haller
bba0d553b1 man: clarify relation of "dns.systemd-resolved" setting with "dns" 2023-07-27 21:10:11 +02:00
Beniamino Galvani
52cca91dd2 build,core: add a "main.migrate-ifcfg-rh" configuration option
The option enables automatic migration of ifcfg-rh connection profiles
to keyfile. The default value can be configured at build time.
2023-07-25 15:39:06 +02:00
Thomas Haller
e9426e6d07 keyfile: add a NetworkManager.conf option "keyfile.rename"
The default behavior is not to rename profiles. I guess, that makes
sense, as renaming a file when changing the "connection.id" could break
users who rely on the name.

My use case is the following. When I connect a Wi-Fi hotspot I use
`nmcli device wifi connect $SSID`, which -- as expected -- persists the
profile to "/etc/NetworkManager/system-connections/$SSID.nmconnection".
Later, I always update the profile's name to "w_$SSID" so I can see on
the name that this is wireless profile. I also want the filename to
reflect that change of name.

Add a configuration option for that. All the infrastructure
("force_rename" parameter) already exists.
2023-06-29 14:05:27 +02:00
Beniamino Galvani
3ad7e4b7e6 build,man: document ifcfg-rh as deprecated
Document the ifcfg-rh settings plugin as deprecated, as announced in:

https://lists.freedesktop.org/archives/networkmanager/2023-May/000103.html
2023-06-29 10:15:48 +02:00
qyecst
7aebda5631 man: fix description of environment variable NM_CONFIG_ENABLE_TAG
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1670
2023-06-26 09:09:53 +02:00
Thomas Haller
7f9db1a290 man: minor rewording in "NetworkManager.conf" manual
Just a comma actually.
2023-06-05 20:59:39 +02:00
Beniamino Galvani
f57a848da5 man: update documentation about global DNS configuration
Now the settings in the [global-dns] section are used *in addition* to
connection-specific ones. Only the global domains sections, when
valid, override connection settings. Update the man page to clarify
that.

Fixes: 1f0d1d78d2 ('dns-manager: always apply options from [global-dns]')
2023-03-03 14:06:24 +01:00
Wen Liang
e8618f03d7 support loopback interface
Support managing the loopback interface through NM as the users want to
set the proper mtu for loopback interface when forwarding the packets.
Additionally, the IP addresses, DNS, route and routing rules are also
allowed to configure for the loopback connection profiles.

https://bugzilla.redhat.com/show_bug.cgi?id=2060905
2022-11-23 20:51:22 +01:00
Thomas Haller
56d0d35516 mptcp: rework "connection.mptcp-flags" for enabling MPTCP
1) The "enabled-on-global-iface" flag was odd. Instead, have only
and "enabled" flag and skip (by default) endpoints on interface
that have no default route. With the new flag "also-without-default-route",
this can be overruled. So previous "enabled-on-global-default" now is
the same as "enabled", and "enabled" from before behaves now like
"enabled,also-without-default-route".

2) What was also odd, as that the fallback default value for the flags
depends on "/proc/sys/net/mptcp/enabled". There was not one fixed
fallback default, instead the used fallback value was either
"enabled-on-global-iface,subflow" or "disabled".
Usually that is not a problem (e.g. the default value for
"ipv6.ip6-privacy" also depends on use_tempaddr sysctl). In this case
it is a problem, because the mptcp-flags (for better or worse) encode
different things at the same time.
Consider that the mptcp-flags can also have their default configured in
"NetworkManager.conf", a user who wants to switch the address flags
could previously do:

  [connection.mptcp]
  connection.mptcp-flags=0x32   # enabled-on-global-iface,signal,subflow

but then the global toggle "/proc/sys/net/mptcp/enabled" was no longer
honored. That means, MPTCP handling was always on, even if the sysctl was
disabled. Now, "enabled" means that it's only enabled if the sysctl
is enabled too. Now the user could write to "NetworkManager.conf"

  [connection.mptcp]
  connection.mptcp-flags=0x32   # enabled,signal,subflow

and MPTCP handling would still be disabled unless the sysctl
is enabled.

There is now also a new flag "also-without-sysctl", so if you want
to really enable MPTCP handling regardless of the sysctl, you can.
The point of that might be, that we still can configure endpoints,
even if kernel won't do anything with them. Then you could just flip
the sysctl, and it would start working (as NetworkManager configured
the endpoints already).

Fixes: eb083eece5 ('all: add NMMptcpFlags and connection.mptcp-flags property')
(cherry picked from commit c00873e08f)
2022-08-25 23:12:53 +02:00