Linux – Change ip addr label in Linux

linuxnetworking

How can I change the eth0 zero to eth0:1 using ip addr without deleting.
When I run

ip addr show eth0

Here is the output

2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether ff:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff
    inet X.X.X.Y/24 brd X.X.X.255 scope global eth0
    inet 10.10.10.17/32 scope global eth0
    inet6 XX::XX:XX:XX:XX/64 scope link 
       valid_lft forever preferred_lft forever

I want this to look like without deleting interface.

2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether ff:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff
    inet X.X.X.Y/24 brd X.X.X.255 scope global eth0
    inet 10.10.10.17/32 scope global eth0:1
    inet6 XX::XX:XX:XX:XX/64 scope link 
       valid_lft forever preferred_lft forever

How can I just change label?

Best Answer

for IPv4, this works:

ip addr add 10.10.10.17/32 dev eth0 label eth0:1
Related Question