Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
AFAIK, there is no modification. You have to delete and add. –  Zoredache May 20 '13 at 23:01
    
How about to use ip link set dev <interface> name eth0:1 but says interface is in use. –  spendyala May 20 '13 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 May 20 '13 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 May 21 '13 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 May 21 '13 at 1:28
show 1 more comment

1 Answer

for IPv4, this works:

ip addr add 10.10.10.17/32 dev eth0 label eth0:1
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.