nmcli

Tom H tomh0665 at gmail.com
Fri Feb 19 13:54:54 UTC 2021


On Fri, Feb 19, 2021 at 1:51 PM Jerry Geis <jerry.geis at gmail.com>
wrote:
> On Fri, Feb 19, 2021 at 6:47 AM Tom H <tomh0665 at gmail.com> wrote:
>> On Thu, Feb 18, 2021 at 9:38 PM Jerry Geis <jerry.geis at gmail.com>
>> wrote:
>>> On Thu, Feb 18, 2021 at 3:30 PM Tom H <tomh0665 at gmail.com> wrote:
>>>> On Thu, Feb 18, 2021 at 5:32 PM Jerry Geis <jerry.geis at gmail.com>
>>>> wrote:
>>>>>
>>>>> When I do nmcli everything works except updating the
>>>>> /etc/resolv.conf
>>>>>
>>>>> nmcli connection modify "Wired Connection 1" ipv4.method manual
>>>>> ipv6.method ignore autoconnect yes ipv4.addr 192.168.1.2/23 gw4
>>>>> 192.168.1.1 ipv4.dns 8.8.8.8
>>>>>
>>>>> How do I update /etc/resolv.conf ?
>>>>
>>>> ls -l /etc/resolv.conf ?
>>>> cat /etc/resolv.conf ?
>>>
>>> # Dynamic resolv.conf(5) file for glibc resolver(3) generated by
>>> resolvconf(8)
>>> #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE
>>> OVERWRITTEN
>>> # 127.0.0.53 is the systemd-resolved stub resolver.
>>> # run "systemd-resolve --status" to see details about the actual
>>> nameservers.
>>> nameserver 127.0.0.53
>>>
>>> I have tried to install resolvconf, I put "nameserver 8.8.8.8" >
>>> /etc/resolvconf/resolv.conf.d/head  but I cannot get it to reload.
>>>
>>> I tried systemctl restart resolvconf - but not updating
>>
>> Please bottom-post.
>>
>> So "/etc/resolv.conf" is provided by resolved and is a symlink to
>> "/run/systemd/resolve/stub-resolv.conf".
>>
>> If you really want to use "resolvconf", you have to change
>> "/etc/resolv.conf" to be a symlink to "/run/resolvconf/resolv.conf".
>>
>> But I wouldn't use "resolvconf" if I were you. Ubuntu already has
>> a more multi-layered network setup than other dostros, and adding
>> "resolvconf" to the mix can only be a source of head-scratching.
>> I've tested using "resolvconf" in the past and I've found that
>> the integration with resolved isn't full. "resolvectl" lists the
>> resolvconf nameserver for "global" and MetworkManager/networkd
>> nameserver for "link", and, it's the "global" value that's queried
>> when you run "dig".
>>
>> It looks to me that you're using "netplan" and that you should
>> edit "/etc/netplan/<yaml>" to change NIC's setup. The "nmcli"
>> command that you ran wrote the config to
> "/etc/NetworkManager/system-connections/<conn>" and, apart from the
>> fact that the dns settings are listed in "nmcli c sh id <conn>",
>> they aren't taken into account; and they're ignored after a reboot.
>
> You right: netplan says use NetworkManager
> /etc/netplan/00-installer-config.yaml
> # This is the network config written by 'subiquity'
> network:
>   version: 2
>   renderer: NetworkManager
>
> I removed resolvconf - but now I'm back to /etc/resolv.conf not
> getting updated.

:(

What's "etc/resolv.conf" symlinked to?

Does one of "/run/NetworkManager/resolv.conf" or
"/run/systemd/resolve/resolv.conf" have a nameserver that you want to
use?


> Your correct that the dns settings were saved to the
> /etc/NetworkManager path file - but how do I get that to be part
> of /etc/resolv.conf ?

Two ways.

1) Change "/etc/netplan/00-installer-config.yaml" to

network:
    ethernets:
        <your_nic>:
            addresses:
                - 192.168.1.2/23 ## is "23" a typo?
            dhcp4: false
            gateway4: 192.168.1.1
            nameservers:
                addresses:
                    - 8.8.8.8
    renderer: NetworkManager
    version: 2

2) Delete "/etc/netplan/00-installer-config.yaml" and let your config
under "/etc/NetworkManager/system-connections" set up NM. (I'm
assuming that NM's enabled systemd-wise, which it should be by
default.]




More information about the ubuntu-users mailing list