Re: Overriding IP4.DNS values on an interface

On Tue, 2021-12-14 at 23:53 +0100, Juan A. Rubio via networkmanager-
list wrote:

I'm using Network Manager v1.22.16

I've got an eth0 connection profile configured for DHCP ([ipv4] ->

When the connection profile is enabled, two DNS servers are received
on that particular interface, e.g.:

$ nmcli dev show eth0

All good.

Let's say that now I want to override the DNS server list on that
interface and remove those two DNS servers to add my own DNS server,
e.g. I want this scenario:

$ nmcli dev show eth0

Is there a way to do this with nmcli or the DBUS apis?

Thanks in advance


NetworkManager is all about configuring profiles ("connections") and
activating them.

Hence, you configure the corresponding profile with the DNS setting.

- See all profiles with `nmcli connection`.
- See the setting of a profile with `nmcli connection show "$PROFILE"`.
- Modify a profile with `nmcli connection modify "$PROFILE" ipv4.dns ipv4.ignore-auto-dns yes`.
- (Re-)Activate the profile with `nmcli connection up "$PROFILE"`.
- See activated devices with `nmcli device`

See `man nm-settings` or `man nm-settings-nmcli`.

nmcli only talks to the public D-Bus API. So of course all these steps
could also be done by using the D-Bus API directly.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]