Re: multiple profiles
- From: Abu Rasheda <rcpilot2010 gmail com>
- To: Thomas Haller <thaller redhat com>
- Cc: networkmanager-list gnome org
- Subject: Re: multiple profiles
- Date: Mon, 19 Apr 2021 10:32:36 -0700
Thanks, for the reply!
So I have to check manually? no way nmcli saying file exits and quit. (because it will still make a file with name ifcfg-xxx-1 if ifcfg-xxx exist).
On Fri, 2021-04-16 at 17:57 -0700, Abu Rasheda via networkmanager-list
wrote:
> E.g. running the following command multiple times
>
> nmcli conn add type ethernet
>
> will create multiple files
>
> -rw-r--r--. 1 root root 270 Apr 16 20:53 ifcfg-ethernet
> -rw-r--r--. 1 root root 272 Apr 16 20:54 ifcfg-ethernet-1
>
> Is it possible for nmcli to see that ifcfg-ethernet already exist and
> not create ifcfg-ethernet-1
>
> How can I pass this message to nmcli
>
> Thanks
Hi,
The NetworkManager client tool (like nmcli, or a GUI) in general does
not know which file name will be chosen. In the NetworkManager API you
can see the file name (like
- `nmcli -f all connection`
- `nmcli connection up filename "$FILENAME"`
- `nmcli connection load "$FILENAME"`
but the client tool cannot pre-determine which file name will be used
when adding a profile.
If you care about the filename, create the file instead of using `nmcli
connection add` (followed by `nmcli connection reload`)
But is your problem really the filename here? It seems, when you add a
new profile, it would be good to choose a name for it, and don't let
nmcli automatically choose "ethernet" and "ethernet-1". Just do:
nmcli connection add type ethernet con-name xxx
"con-name" is an alias for "connection.id", and contrary to what one
might reasonably expect, the "id" is not enforced to be unique:
$ nmcli connection add type ethernet con-name xxx
Connection 'xxx' (7f23f5cd-90f3-4cd8-8612-cf5d0856b130) successfully added.
$ nmcli connection add type ethernet con-name xxx
Warning: There is another connection with the name 'xxx'. Reference the connection by its uuid '8811722f-d662-48c5-9271-c8aa764d8f4a'
Connection 'xxx' (8811722f-d662-48c5-9271-c8aa764d8f4a) successfully added.
It's a good idea to ensure yourself that the connection.id is unique.
That means, before you add a new profile, check the existing names in
`nmcli connection` output and choose a different name.
best,
Thomas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]