The nmcli connection show command can be used to list your network interfaces.
~]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
Specifying a connection will show the settings for the connection.
]# nmcli connection show eth0 | grep -i ipv4
ipv4.method: manual
ipv4.dns: 10.11.12.13,10.11.12.14
ipv4.dns-search: example.com
ipv4.dns-options: timeout:2
ipv4.dns-priority: 0
ipv4.addresses: 10.11.12.15/22
ipv4.gateway: 10.0.0.1
ipv4.routes: --
ipv4.route-metric: -1
ipv4.route-table: 0 (unspec)
ipv4.routing-rules: --
ipv4.replace-local-rule: -1 (default)
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-iaid: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.dhcp-hostname-flags: 0x0 (none)
ipv4.never-default: no
ipv4.may-fail: yes
ipv4.required-timeout: -1 (default)
ipv4.dad-timeout: -1 (default)
ipv4.dhcp-vendor-class-identifier: --
ipv4.link-local: 0 (default)
ipv4.dhcp-reject-servers: --
ipv4.auto-route-ext-gw: -1 (default)
Likewise, the ip address command should show the IP address bound to the interface.
~]# ip address | grep inet
inet 10.11.12.15/22 brd 10.1.2.3 scope global noprefixroute eth0
The nmcli connection modify <interface name> command can be used to add one or more secondary IP addresses to the interface.
nmcli connection modify eth0 +ipv4.addresses 10.11.12.16/22
Now, the nmcli connection show command should show the secondary IP addresses that were added.
]# nmcli connection show eth0 | grep -i ipv4.addresses
ipv4.addresses: 10.11.12.15/22, 10.11.12.16/22
But the ip address command should not yet include the secondary IP addresses.
~]# ip address show eth0 | grep inet
inet 10.11.12.15/22 brd 10.1.2.3 scope global noprefixroute eth0
The nmcli device reapply <interface name> command must be used for this change to take effect on the interface.
]# nmcli device reapply eth0
Connection successfully reapplied to device 'eth0'.
But the ip address command should not yet include the secondary IP addresses.
~]# ip address | grep inet
inet 10.11.12.15/22 brd 10.1.2.3 scope global noprefixroute eth0
inet 10.11.12.16/22 brd 10.1.2.3 scope global secondary noprefixroute eth0
Did you find this article helpful?
If so, consider buying me a coffee over at