These are opinions, brought forward by those advocating for iwd.
iwd is not the default on many systems, because other people hold different opinions. It's not as clear as you present it.
The reason NetworkManager uses wpa_supplicant by default is because ultimately nobody is investing the necessary (large) effort to move away from wpa_supplicant. Which is probably because those who contribute upstream don't agree with that assessment that wpa_supplicant is unfixable and iwd just better.
For example, NetworkManager has a huge test suite that tests wpa_supplicant, but unfortunately no tests for iwd. It would be larger effort to bring that on par (Patches welcome).
you don't need sudo nmcli because usually a non-root user has permissions to control NetworkManager. This is controlled via policykit rules. You can see your user's permissions with nmcli general permissions
when you add a profile with autoconnect enabled (the default), then the profile will start autoconnecting right away. So after nmcli connection add type bridge, the profile is already up, but with incomplete settings. So it's better to specify all parameters of a profile in one go. nmcli connection add and nmcli connection modify accept the same parameters so you can completely specify the profile while creating it.
A crash is almost always a bug in an application (or a library that the application uses). You can investigate a crash by looking at the backtrace/coredump.
You should see the crash in coredumpctl. As root, run coredumpctl to get a list of all crashes. Then run coredumpctl show $PROCESS_ID, where $PROCESS_ID is the process ID you see listed before.
Make sure to have debugging symbols installed, otherwise the backtrace is not very helpful. I don't know how to do that on Arch.
Or -- assuming this is due to a DHCP timeout -- you may want to increase ipv4.dhcp-timeout property... of course, the timeout indicates a bigger problem, and just increasing the timeout might not solve the problem.
NetworkManager can use dnsmasq for two separate purposes, as local caching DNS server (with [main].dns= setting in man NetworkManager.conf) and as DHCP+DNS server for a subnet by setting ipv4.method=shared in the connection profile.
Basically, all you need is to set ipv4.method shared and reactivate the profile. See nmcli connection for all profiles. Check the settings of a profile with nmcli -o connection show "$PROFILE" or nmcli connection show "$PROFILE". Modify the profile with nmcli connection modify "$PROFILE" ipv4.method shared $OTHER_OPTIONS.
See man nm-settings about the settings of a profile.
Depending on your configuration ([main].dns and [main].rc-manager in man NetworkManager.conf), NetworkManager will also configure resolved.
NetworkManager only configures your system. So the first thing to check when something doesn't work, is to look at the system. For example, when DNS is not working (and you are using systemd-resolved), then check what resolvectl says. It should show the information that NetworkManager pushed there, when you activated the profile in NetworkManager...
NetworkManager does only have limited capabilities for this.
You can configure a profile with ipv4.method=shared and/or ipv6.method=shared. In the IPv4 case, NetworkManager will run dnsmasq as DHCP+DNS server on the interface and setup nft/iptables rules for NAT. In the IPv6, it will do prefix delegation.
That works well for simple cases, like if you want to make a Wi-Fi hotspot.
It's however not as flexible as other solutions. In particular, it does IPv4 NAT and not routing.
NetworkManager has options like ipv4.ignore-auto-{dns,routes} to ignore parts of the information from DHCP. However, that does not exist for the IP address.
But what is the problem with having the DHC IP address there? Just configure your additional static IP address as nmcli connection modify "$PROFILE" ipv4.method auto ipv4.addresses 192.168.5.55/24. Sure, then you'll have two IP addresses, but that may be no problem.
If you want to ensure that the static address is also preferred for outgoing addresses, then you might also need to add a route like ipv4.routes '0.0.0.0/0 192.168.5.1 10 src=192.168.5.55'.
This is a "captive portal", like often in hotels or public places.
You connect to the Wi-Fi (e.g. nmcli device wifi connect "$SSID" or by clicking the network in the GUI). This network is usually unencrypted and open. But you are not really on the internet yet.
Then, if you had connectivity check enabled in NetworkManager, it can detect that you don't have real internet but are behind such a captive portal. Then your desktop environment (like GNOME) can pick that up, and present you a browser window to login.
But that is only convenience. You don't need connectivity check or the desktop environment to present you a browser to login. Just open a webbrowser yourself, and try to access any website. The portal would redirect you to the login page, where you can login. You don't need any commands, enter your login data in the browser.
Actually, take care to use HTTP and not HTTPS, otherwise the redirect won't work properly. While you can try to open any wesite via HTTP, try for example this one: http://fedoraproject.org/static/hotspot.txt
Btw, your browser might also do captive portal detection. So maybe when you open the browser it will also tell you and redirect you to the login page.
nmcli is provided by the same package as NetworkManager. You can't have NetworkManager running without having nmcli too (unless you uninstall the package while it's running, it's not clear to me that this would stop the daemon).
Anyway, as you found out, NetworkManager doesn't support such IP ranges.
The workaround would be:
for i in {1..5}; do
nmcli connection modify +ipv4.addresses 192.168.5.$i/24;
done
you could replace /etc/resolv.conf with a symlink (NetworkManager defaults to [main].rc-manager=symlink which will not touch symlinks). This seems the simplest, because your act of creating a symlink is taken as configuration and nothing else is needed.
you could chattr +i the file to make it immutable.
you could configure either [main].dns=none or [main].rc-manager=unmanaged in NetworkManager.conf. Best by dropping a snippet to /etc/NetworkManager/conf.d/90-my-resolvconf.conf. See man NetworkManager.conf.
(after doing 2) or 3), issue a systemctl reload NetworkManager).
restarting NetworkManager.service is almost always the wrong thing to do. The only reasons to ever do that is updating the package, changing certain options in NetworkManager.conf (most can be reloaded without restart) or a bug (in which case, restart is only a workaround and not the solution).
If you want to (re)activate a profile/device, use `nmcli connection up` / `nmcli device connect` (or whatever client tool to NetworkManager you are using).
To keep things relatively fair, I installed network-manager-applet (the default from Gnome) in each.
GNOME3 and KDE/plasma have their own implementations (gnome-shell and plasma-nm, respectively). On those, a user usually wouldn't want to run network-manager-applet (or nm-connection-editor).
That's certainly a valid opinion. Note that RHEL uses NetworkManager, and that has primarily server use cases. So, there are other opinions.
If you run a container, you often don't run neither NetworkManager nor systemd-networkd. It's the container runtime that sets up networking, as also that configuration is rather static (does not change while the container is running), but also ephemeral (the network configuration is not relevant after the container quits).
netplan is "only" a configuration layer on top of NetworkManager/systemd-networkd. When something does not work, the first step to debug that is to look what configuration netplan generated. For example nmcli connection, nmcli device or networkctl).
NetworkManager/systemd-networkd are "only" a management layer of various OS interfaces about networking. Additionally they also run DHCP and other services, but the result of that is again to configure IP addresses in kernel and setup DNS in /etc/resolv.conf (or systemd-resolved). When something does not work, the first step is to look what the actually configured, by looking at your system. For example, ip link, ip addr, ip route, /etc/resolv.conf or resolvectl (if you use systemd-resolved).
In my personal opinion, I don't understand why one would use netplan, when both underlying backends have their perfectly sensible and documented ways to configure them already. But hey, clearly there are people who see that differently.
If you use NetworkManager, you don't use iproute2 to setup things. Otherwise, it wouldn't "manage" very much. Use basically nmcli connection to manage the connection profiles, use nmcli device to see which profiles are currently activated, and activate the right profiles with nmcli connection up. That's about it. Of course, iproute2 is still useful to see what NetworkManager did. For example, to see the actually configured IP addresses on an interface. You could also see that with nmcli -f all device show $IFNAME, but one would probably want to ask kernel what IP addresses are configured, instead of asking NetworkManager what kernel told which addresses are configured. Point is, iproute2 is still useful for inspecting the configuration.
NetworkManager also has other clients (like nmtui or GUI or cockpit). They all configure the same thing, so there is no fundamental difference which NetworkManager tool you use. For example, if you create a profile with nm-connection-editor, you can later modify or activate it with nmcli.
See man systemd-resolved, especially the "/ETC/RESOLV.CONF" section. Configure /etc/resolv.conf correctly (usually that means, to symlink it as documented).
When you are using NetworkManager, you would not configure IP addresses (with ip tool) directly. Instead, configure "connection profiles" in NetworkManager with the desired settings and activate them.
See the profiles you have with nmcli connection and see the activated profiles with nmcli device.
If you use GNOME, you usually would use GNOME's integration with NetworkManager. That is, use gnome-control-center to configure the profiles and activate them via gnome-shell. Whether you use the GUI, nmcli or other NetworkManager client tools is up to you (the underlying thing that they configure is the same: profiles in NetworkManager).
If you use firewalld, then you also would not call iptables/nft directly. Instead, you configure zones in firewalld and put the interface in that zone. If you use NetworkManager and firewalld, you would set connection.zone in the NetworkManager connection profile. If you don't use firewalld, I guess you need some form of scripting. A NetworkManager dispatcher script comes to mind (man NetworkManager). But really any script you like and I guess iptables come with some ways how to configure them (e.g. a script that runs iptables-restore).
if you have a sensible configuration of systemd-resolved (where /etc/resolv.conf is a symlink as explained in man systemd-resolved), and if your distro compiled NetworkManager with rc-manager=symlink, then you need zero configuration for NetworkManager to automatically use systemd-resolved. The claim "they aren't aimed to work together" is wrong.
You say systemd-networkd is supposed to work with systemd-resolved, as if NetworkManager is not supposed. That is not correct.
Which is this documentation that read? It would be more useful to link to it or quote it, instead of paraphrasing.
Fedora uses NetworkManager and systemd-resolved by default. They work together out of the box (although, you can certainly configure both differently).
When you install a distribution, it's the distribution's job to configure your system in a way that works. There are many way how DNS can be configured, and your distro might default to different network management tools. If your distro doesn't give you a sensible out of the box behavior, then consider reporting a bug. But no need to assume that would be the general case or "common".
the way is to disable autoconnect by setting
connection.autoconnect=no.that excludes the interface form activating automatically at boot. It's anyway not working, unless you also autoconnect port interfaces.
nmcli connection modify "$PROFILE_NAME" ipv6.method disabledman nm-settingsnmcli connectionandnmcli device.These are opinions, brought forward by those advocating for iwd. iwd is not the default on many systems, because other people hold different opinions. It's not as clear as you present it.
The reason NetworkManager uses wpa_supplicant by default is because ultimately nobody is investing the necessary (large) effort to move away from wpa_supplicant. Which is probably because those who contribute upstream don't agree with that assessment that wpa_supplicant is unfixable and iwd just better.
For example, NetworkManager has a huge test suite that tests wpa_supplicant, but unfortunately no tests for iwd. It would be larger effort to bring that on par (Patches welcome).
Very nice, thank you. Two minor comments:
you don't need
sudo nmclibecause usually a non-root user has permissions to control NetworkManager. This is controlled via policykit rules. You can see your user's permissions withnmcli general permissionswhen you add a profile with autoconnect enabled (the default), then the profile will start autoconnecting right away. So after
nmcli connection add type bridge, the profile is already up, but with incomplete settings. So it's better to specify all parameters of a profile in one go.nmcli connection addandnmcli connection modifyaccept the same parameters so you can completely specify the profile while creating it.A crash is almost always a bug in an application (or a library that the application uses). You can investigate a crash by looking at the backtrace/coredump.
You should see the crash in
coredumpctl. As root, runcoredumpctlto get a list of all crashes. Then runcoredumpctl show $PROCESS_ID, where$PROCESS_IDis the process ID you see listed before.Make sure to have debugging symbols installed, otherwise the backtrace is not very helpful. I don't know how to do that on Arch.
A core dump is a crash of a program. It's always a bug. The solution is to fix the bug and to get a new NetworkManager package.
The workaround is to downgrade the package to a working version, or to find a configuration that does not exhibit the crash.
Might be the same issue as https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1204 ...
Find out why it fails.
Check the
level=TRACElogs. See for example https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html#id-1.2.3.10 how to enable debug logging.Or -- assuming this is due to a DHCP timeout -- you may want to increase
ipv4.dhcp-timeoutproperty... of course, the timeout indicates a bigger problem, and just increasing the timeout might not solve the problem.NetworkManager can use dnsmasq for two separate purposes, as local caching DNS server (with
[main].dns=setting inman NetworkManager.conf) and as DHCP+DNS server for a subnet by settingipv4.method=sharedin the connection profile.Basically, all you need is to set
ipv4.method sharedand reactivate the profile. Seenmcli connectionfor all profiles. Check the settings of a profile withnmcli -o connection show "$PROFILE"ornmcli connection show "$PROFILE". Modify the profile withnmcli connection modify "$PROFILE" ipv4.method shared $OTHER_OPTIONS.See
man nm-settingsabout the settings of a profile.Depending on your configuration (
[main].dnsand[main].rc-managerinman NetworkManager.conf), NetworkManager will also configure resolved.NetworkManager only configures your system. So the first thing to check when something doesn't work, is to look at the system. For example, when DNS is not working (and you are using systemd-resolved), then check what
resolvectlsays. It should show the information that NetworkManager pushed there, when you activated the profile in NetworkManager...NetworkManager does only have limited capabilities for this.
You can configure a profile with
ipv4.method=sharedand/oripv6.method=shared. In the IPv4 case, NetworkManager will run dnsmasq as DHCP+DNS server on the interface and setup nft/iptables rules for NAT. In the IPv6, it will do prefix delegation.That works well for simple cases, like if you want to make a Wi-Fi hotspot.
It's however not as flexible as other solutions. In particular, it does IPv4 NAT and not routing.
Call
nmcli connectionto see all profiles.Activate the one with
nmcli connection up "$PROFILE"(replace$PROFILEwith the name of the profile).Check that the desired profiles are active with
nmcli device.NetworkManager has options like
ipv4.ignore-auto-{dns,routes}to ignore parts of the information from DHCP. However, that does not exist for the IP address.But what is the problem with having the DHC IP address there? Just configure your additional static IP address as
nmcli connection modify "$PROFILE" ipv4.method auto ipv4.addresses 192.168.5.55/24. Sure, then you'll have two IP addresses, but that may be no problem.If you want to ensure that the static address is also preferred for outgoing addresses, then you might also need to add a route like
ipv4.routes '0.0.0.0/0 192.168.5.1 10 src=192.168.5.55'.This is a "captive portal", like often in hotels or public places.
You connect to the Wi-Fi (e.g.
nmcli device wifi connect "$SSID"or by clicking the network in the GUI). This network is usually unencrypted and open. But you are not really on the internet yet.Then, if you had connectivity check enabled in NetworkManager, it can detect that you don't have real internet but are behind such a captive portal. Then your desktop environment (like GNOME) can pick that up, and present you a browser window to login.
But that is only convenience. You don't need connectivity check or the desktop environment to present you a browser to login. Just open a webbrowser yourself, and try to access any website. The portal would redirect you to the login page, where you can login. You don't need any commands, enter your login data in the browser.
Actually, take care to use HTTP and not HTTPS, otherwise the redirect won't work properly. While you can try to open any wesite via HTTP, try for example this one: http://fedoraproject.org/static/hotspot.txt
Btw, your browser might also do captive portal detection. So maybe when you open the browser it will also tell you and redirect you to the login page.
nmcliis provided by the same package as NetworkManager. You can't have NetworkManager running without havingnmclitoo (unless you uninstall the package while it's running, it's not clear to me that this would stop the daemon).Anyway, as you found out, NetworkManager doesn't support such IP ranges.
The workaround would be:
There are several ways.
/etc/resolv.confwith a symlink (NetworkManager defaults to[main].rc-manager=symlinkwhich will not touch symlinks). This seems the simplest, because your act of creating a symlink is taken as configuration and nothing else is needed.chattr +ithe file to make it immutable.[main].dns=noneor[main].rc-manager=unmanagedinNetworkManager.conf. Best by dropping a snippet to/etc/NetworkManager/conf.d/90-my-resolvconf.conf. Seeman NetworkManager.conf.(after doing 2) or 3), issue a
systemctl reload NetworkManager).Maybe just do 1).
restarting NetworkManager.service is almost always the wrong thing to do. The only reasons to ever do that is updating the package, changing certain options in NetworkManager.conf (most can be reloaded without restart) or a bug (in which case, restart is only a workaround and not the solution).
If you want to (re)activate a profile/device, use `nmcli connection up` / `nmcli device connect` (or whatever client tool to NetworkManager you are using).
maybe it's the issue fixed by https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/80ced3f1fb4754558aa19f257a1ad921e0f92616 ?
If yes, you could avoid that by using a different dhcp plugin, e.g.
dhcp=internal. Seeman Networkmanager.conf(and restart NetworkManager).GNOME3 and KDE/plasma have their own implementations (gnome-shell and plasma-nm, respectively). On those, a user usually wouldn't want to run network-manager-applet (or nm-connection-editor).
That's certainly a valid opinion. Note that RHEL uses NetworkManager, and that has primarily server use cases. So, there are other opinions.
If you run a container, you often don't run neither NetworkManager nor systemd-networkd. It's the container runtime that sets up networking, as also that configuration is rather static (does not change while the container is running), but also ephemeral (the network configuration is not relevant after the container quits).
netplan is "only" a configuration layer on top of NetworkManager/systemd-networkd. When something does not work, the first step to debug that is to look what configuration netplan generated. For example
nmcli connection,nmcli deviceornetworkctl).NetworkManager/systemd-networkd are "only" a management layer of various OS interfaces about networking. Additionally they also run DHCP and other services, but the result of that is again to configure IP addresses in kernel and setup DNS in /etc/resolv.conf (or systemd-resolved). When something does not work, the first step is to look what the actually configured, by looking at your system. For example,
ip link,ip addr,ip route,/etc/resolv.conforresolvectl(if you use systemd-resolved).In my personal opinion, I don't understand why one would use netplan, when both underlying backends have their perfectly sensible and documented ways to configure them already. But hey, clearly there are people who see that differently.
If you use
NetworkManager, you don't useiproute2to setup things. Otherwise, it wouldn't "manage" very much. Use basicallynmcli connectionto manage the connection profiles, usenmcli deviceto see which profiles are currently activated, and activate the right profiles withnmcli connection up. That's about it. Of course,iproute2is still useful to see what NetworkManager did. For example, to see the actually configured IP addresses on an interface. You could also see that withnmcli -f all device show $IFNAME, but one would probably want to ask kernel what IP addresses are configured, instead of asking NetworkManager what kernel told which addresses are configured. Point is,iproute2is still useful for inspecting the configuration. NetworkManager also has other clients (like nmtui or GUI or cockpit). They all configure the same thing, so there is no fundamental difference which NetworkManager tool you use. For example, if you create a profile withnm-connection-editor, you can later modify or activate it withnmcli.I think this is the right question!
See
man systemd-resolved, especially the "/ETC/RESOLV.CONF" section. Configure /etc/resolv.conf correctly (usually that means, to symlink it as documented).When you are using NetworkManager, you would not configure IP addresses (with
iptool) directly. Instead, configure "connection profiles" in NetworkManager with the desired settings and activate them.See the profiles you have with
nmcli connectionand see the activated profiles withnmcli device.If you use GNOME, you usually would use GNOME's integration with NetworkManager. That is, use gnome-control-center to configure the profiles and activate them via gnome-shell. Whether you use the GUI, nmcli or other NetworkManager client tools is up to you (the underlying thing that they configure is the same: profiles in NetworkManager).
If you use firewalld, then you also would not call iptables/nft directly. Instead, you configure zones in firewalld and put the interface in that zone. If you use NetworkManager and firewalld, you would set
connection.zonein the NetworkManager connection profile. If you don't use firewalld, I guess you need some form of scripting. A NetworkManager dispatcher script comes to mind (man NetworkManager). But really any script you like and I guess iptables come with some ways how to configure them (e.g. a script that runsiptables-restore).if you have a sensible configuration of systemd-resolved (where /etc/resolv.conf is a symlink as explained in
man systemd-resolved), and if your distro compiled NetworkManager with rc-manager=symlink, then you need zero configuration for NetworkManager to automatically use systemd-resolved. The claim "they aren't aimed to work together" is wrong.You say systemd-networkd is supposed to work with systemd-resolved, as if NetworkManager is not supposed. That is not correct.
Which is this documentation that read? It would be more useful to link to it or quote it, instead of paraphrasing.
Fedora uses NetworkManager and systemd-resolved by default. They work together out of the box (although, you can certainly configure both differently).
When you install a distribution, it's the distribution's job to configure your system in a way that works. There are many way how DNS can be configured, and your distro might default to different network management tools. If your distro doesn't give you a sensible out of the box behavior, then consider reporting a bug. But no need to assume that would be the general case or "common".
OP mentions ifcfg, so they are on Fedora or RHEL. netplan is not available there.
create a file /etc/NetworkManager/conf.d/99-unmanaged-all.conf with content:
you can also specify the
match-devicekey to select only some devices. All explained inman NetworkManager.conf.Note that you still can override this temporarily, with
nmcli device set $IFNAME managed yes(which only is honored until reboot).