Skip to content

u/thom311

In this archive from Nov 2018 to Dec 2023

0
posts
45
comments
0
media
109
score

nmcli connection modify "$PROFILE_NAME" ipv6.method disabled

  • instead of "disabled", maybe "manual" or "link-local". See man nm-settings
  • as always, changes to a profile only take effect by activating the profile. Have the modification followed by `nmcli connection up "$PROFILE_NAME"
  • find the profile name by looking at nmcli connection and nmcli device.
2 points

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).

1 points

Very nice, thank you. Two minor comments:

  • 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.

3 points

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.

3 points
Nov 07 20:46:32 archbox NetworkManager[123177]: <info>  [1667850392.9442] device (eno1): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Nov 07 20:46:32 archbox NetworkManager[123177]: <warn>  [1667850392.9447] device (eno1): Activation: failed for connection 'Wired connection 1'

Find out why it fails.

Check the level=TRACE logs. 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-timeout property... of course, the timeout indicates a bigger problem, and just increasing the timeout might not solve the problem.

1 points

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.

2 points

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...

1 points

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.

1 points

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'.

2 points

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.

11 points

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
2 points

There are several ways.

  1. 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.
  2. you could chattr +i the file to make it immutable.
  3. 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).

Maybe just do 1).

5 points

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).

1 points

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).

1 points

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.

1 points

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).

2 points

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".

1 points

create a file /etc/NetworkManager/conf.d/99-unmanaged-all.conf with content:

[device-unmanaged-all]
managed=0

you can also specify the match-device key to select only some devices. All explained in man NetworkManager.conf.

Note that you still can override this temporarily, with nmcli device set $IFNAME managed yes (which only is honored until reboot).

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.