What's the difference between ip4 and ipv4.address and ipv4.addresses?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 8

Issue

  • What's the difference between ip4 and ipv4.address and ipv4.addresses?
  • When modify NIC via ip4 and ipv4.address, it didn't change but add the new address.

Resolution

  • Using the "ipv4.addresses" parameter to modify the address as expected.

Root Cause

  • Those three parameters should be same as documented
#man nm-settings
ipv4 setting
       Properties:
       addresses
           Alias: ip4
  • But, it didn't worked as expected and hard to figure out the exact cause at this point.
#ip a

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:b6:f2:20 brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.23/24 brd 192.168.xx.255 scope global noprefixroute enp0s8

#nmcli connection down enp0s8
#nmcli connection modify enp0s8 ip4 192.168.xx.24/24 gw4 192.168.xx.1
#nmcli connection up enp0s8

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:b6:f2:20 brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.23/24 brd 192.168.xx.255 scope global noprefixroute enp0s8
       valid_lft forever preferred_lft forever
    inet 192.168.xx.24/24 brd 192.168.xx.255 scope global secondary noprefixroute enp0s8
       valid_lft forever preferred_lft forever   <-- added

#nmcli connection down enp0s8
#nmcli connection modify enp0s8 ip4 192.168.56.25/24 gw4 192.168.xx.1
#nmcli connection up enp0s8

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:b6:f2:20 brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.23/24 brd 192.168.xx.255 scope global noprefixroute enp0s8
       valid_lft forever preferred_lft forever
    inet 192.168.xx.24/24 brd 192.168.xx.255 scope global secondary noprefixroute enp0s8
       valid_lft forever preferred_lft forever
    inet 192.168.xx.25/24 brd 192.168.xx.255 scope global secondary noprefixroute enp0s8
       valid_lft forever preferred_lft forever   <-- added

#nmcli connection down enp0s8
#nmcli connection modify enp0s8 ipv4.address 192.168.xx.26/24 gw4 192.168.xx.1
or
#nmcli connection modify enp0s8 ipv4.addresses 192.168.xx.26/24 gw4 192.168.xx.1
#nmcli connection up enp0s8

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:b6:f2:20 brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.26/24 brd 192.168.xx.255 scope global noprefixroute enp0s8
       valid_lft forever preferred_lft forever   <-- 24,25 has gone even i didn't do something but just modify with ipv4.address or ipv4.addresses

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments