6

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?

6
  • AFAIK, there is no modification. You have to delete and add.
    – Zoredache
    Commented May 20, 2013 at 23:01
  • How about to use ip link set dev <interface> name eth0:1 but says interface is in use.
    – spendyala
    Commented May 20, 2013 at 23:05
  • 3
    What are you really trying to do? Why do you think you need to to be eth0:1 anyway? I am not aware of any advantage to doing this.
    – Zoredache
    Commented May 20, 2013 at 23:13
  • I have virtual ip assigned to eth0 using ip addr, trying to make it compatible. So that, I can use the ifconfig down and up for that. With out causing any outage.
    – spendyala
    Commented May 21, 2013 at 0:14
  • If you use ifconfig down it is going to stop the device, not just one pseudo-interface with a particular address. So lets dig deeper, why do you think you need to regularly stop & start an interface?
    – Zoredache
    Commented May 21, 2013 at 1:28

1 Answer 1

3

for IPv4, this works:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .