RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1482772 - Cannot specify multiple ip addresses with nmcli con add
Summary: Cannot specify multiple ip addresses with nmcli con add
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Beniamino Galvani
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-18 05:29 UTC by Venkatesh Kavtikwar
Modified: 2021-06-10 12:50 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 13:29:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0778 0 None None None 2018-04-10 13:30:48 UTC

Description Venkatesh Kavtikwar 2017-08-18 05:29:33 UTC
Description of problem:

Cannot specify multiple ip addresses with nmcli con add in RHE 7.3 (Documentation update)


Version-Release number of selected component (if applicable):

NetworkManager-1.4.0-12.el7 and later


How reproducible:

Cu was using below command to add multiple IP's at the time of creating a new connection in order NetworkManager version like NetworkManager-1.0.4.-9.el7

/bin/nmcli con add type team autoconnect false con-name team0 ifname team0 config '{"device":"team0","runner":{ "fast_rate":true,"name":"lacp" }}' ip4 10.64.32.98/24 ip4 10.64.32.56/24 gw4 10.64.32.1

Where CU was Using "ip4" parameter to add multiple IP's and was working.

While modifying the connection they were using ipv4.address or +ipv4.address to  modify or add new IP.

In later upgrades from NetworkManager-1.4.0-12.el7 and ahead, I think as a part of improvement and to match parameters, we have started to use both ip4 & ipv4.address to add IP address while creating a new connection but this fails when we add multiple IP's for new connection.

Below commands will assign only one IP (mentioned in last) instead of multiple.

========================

/bin/nmcli con add type team autoconnect false con-name team0 ifname team0 config '{"device":"team0","runner":{ "fast_rate":true,"name":"lacp" }}' ip4 10.64.32.98/24 ip4 10.64.32.56/24 gw4 10.64.32.1

/bin/nmcli con add type team autoconnect false con-name team0 ifname team0 config '{"device":"team0","runner":{ "fast_rate":true,"name":"lacp" }}' ipv4.address 10.64.32.98/24 ipv4.address 10.64.32.56/24 gw4 10.64.32.1

========================

We have a solution for this, that we need to either of the syntax to add multiple IP's in latest versions of NetworkManager


========== O/P from my local system ==============


# nmcli connection add type ethernet con-name ens9 ifname ens9 ipv4.addresses "10.0.0.8/24, 10.0.0.9/24"

# nmcli connection add type ethernet con-name ens9 ifname ens9 ipv4.method manual ipv4.addresses 10.0.0.1/24 +ipv4.address 10.0.0.2/24

==================================================


The main concern here is that, in "man nmcli" we have mentioned below things, which incorrectly says that we can use "ipv4.address" multiple times (without providing +) to add multiple IP's while creating new connection.


The man page states:
       Table 22. IPv4 options
       ┌──────┬────────────────┬──────────────────────────────────┐
       │Alias │ Property       │ Note                             │
       ├──────┼────────────────┼──────────────────────────────────┤
       │ip4   │ ipv4.addresses │ This option can be specified     │
       │      │                │ multiple times.  It's equivalent │
       │      │                │ of using +ipv4.addresses syntax. │
       ├──────┼────────────────┼──────────────────────────────────┤
       │gw4   │ ipv4.gateway   │                                  │
       └──────┴────────────────┴─────────────────────────────────┘

It says ipv4.address is equivalent to "+ipv4.address" and that's where CU has raised the concern.

So with we need to correct the documentation in order to match with current settings we have with nmcli or we have to make changes to nmcli code to add multiple IP address using below queries


========================

/bin/nmcli con add type team autoconnect false con-name team0 ifname team0 config '{"device":"team0","runner":{ "fast_rate":true,"name":"lacp" }}' ip4 10.64.32.98/24 ip4 10.64.32.56/24 gw4 10.64.32.1

/bin/nmcli con add type team autoconnect false con-name team0 ifname team0 config '{"device":"team0","runner":{ "fast_rate":true,"name":"lacp" }}' ipv4.address 10.64.32.98/24 ipv4.address 10.64.32.56/24 gw4 10.64.32.1

========================


Please let us know further on this.

Comment 2 Beniamino Galvani 2017-08-30 12:36:09 UTC
This:

  nmcli con add type team ... ip4 10.64.32.98/24 ip4 10.64.32.56/24

is correct because 'ip4' is an alias for '+ipv4.address'. This syntax
didn't work on RHEL 7.3 but does work on RHEL 7.4.

On the other hand, this:

  nmcli con add type team ... ipv4.address 10.64.32.98/24 ipv4.address 10.64.32.56/24

is not intended to work as you expect because if you specify a
property multiple times only the last occurrence is considered. In the
man page snippet you mentioned, "It's equivalent of using
+ipv4.addresses syntax" refers to the "ip4" alias only.

For these reason, I propose to close this bug as CURRENTRELEASE.

Venkatesh, what do you think?

Comment 3 Venkatesh Kavtikwar 2017-09-11 16:41:45 UTC
Hello,

Thanks for your inputs.

Glad that it's been introduced back again in RHEL 7.4 and the same can be updated to CU. 


The only thing which is misleading here is "This" in the notes part. Can we change it to "ip4" instead so as to eliminate confusion? Please share your thoughts.



       Table 22. IPv4 options
       ┌──────┬─────────────────────────────────────────┬────────────────────────────┐
       │Alias │ Property                                │ Note                       │
       ├──────┼─────────────────────────────────────────┼────────────────────────────┤
       │ip4   │ ipv4.addresses                          │ This option can be         │
       │      │                             ipv4.method │ specified multiple times.  │
       │      │                                         │ It's equivalent of using   │
       │      │                                         │ +ipv4.addresses syntax and │
       │      │                                         │ setting ipv4.method to     │
       │      │                                         │ manual.                    │
       ├──────┼─────────────────────────────────────────┼────────────────────────────┤
       │gw4   │ ipv4.gateway                            │                            │
       └──────┴─────────────────────

────────────────────┴────────────────────────────┘

Comment 4 Beniamino Galvani 2017-09-13 12:24:14 UTC
How about the following?

┌─────┬──────────────┬──────────────────────────────────────────────────────────┐
│Alias│Property      │ Note                                                     │
├─────┼──────────────┼──────────────────────────────────────────────────────────┤
│ip4  │ipv4.addresses│ The alias is equivalent to the +ipv4.addresses syntax and│
│     │ipv4.method   │ also sets ipv4.method to manual. It can be specified     │
│     │              │ multiple times.                                          │
├─────┼──────────────┼──────────────────────────────────────────────────────────┤
│gw4  │ipv4.gateway  │                                                          │
└─────┴──────────────┴──────────────────────────────────────────────────────────┘

Table 24. IPv6 options
┌─────┬──────────────┬──────────────────────────────────────────────────────────┐
│Alias│Property      │ Note                                                     │
├─────┼──────────────┼──────────────────────────────────────────────────────────┤
│ip6  │ipv6.addresses│ The alias is equivalent to the +ipv6.addresses syntax and│
│     │ipv6.method   │ also sets ipv6.method to manual. It can be specified     │
│     │              │ multiple times.                                          │
├─────┼──────────────┼──────────────────────────────────────────────────────────┤
│gw6  │ipv6.gateway  │                                                          │
└─────┴──────────────┴──────────────────────────────────────────────────────────┘

I think we should also add a test to our CI to check that the syntax keeps working in future NM versions:

    @ipv4
    @ipv4_multiple_ip4
    @ver+=1.4.2
    Scenario: nmcli - ipv4 - method - static using multiple "ip4" options
    * Add a new connection of type "ethernet" and options "ifname eth1 con-name ethie ip4 192.168.124.1/24 ip4 192.168.125.1/24"
    * Bring "up" connection "ethie"
    Then "192.168.124.1/24" is visible with command "ip a s eth1"
    Then "192.168.125.1/24" is visible with command "ip a s eth1"


After the documentation fix is merged, I'll move this bug to MODIFIED so that QE will add the test to CI.

Comment 5 Venkatesh Kavtikwar 2017-09-13 13:55:51 UTC
Hello,

Thanks for the reply.

Yes, this is more clear now. Thanks. 

Please let us know further, meanwhile, I will provide an update to the CU.

Comment 8 Vladimir Benes 2018-01-31 15:05:26 UTC
working well in CI

Comment 11 errata-xmlrpc 2018-04-10 13:29:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0778


Note You need to log in before you can comment on or make changes to this bug.