Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the Linux command to clear IP address of an interface without bringing it down and/or restarting network services. Seems strange ifconfig is able to change IP address but has no option to clear it, or am I wrong?

EDIT: As simple as ifconfig eth0 They should have put it in the manual.

share|improve this question
Hi. Why do you want to set the IP address to – Andy Jun 17 '10 at 9:27
@Andy: I think you misunderstood the question. @jackhab wants to unassign an address from the interface, not set it to -- it's just how it is done with ifconfig. – grawity Jun 17 '10 at 10:36
@grawity Cheers. Unassigning an address is switching the NIC off to all intents and purposes? – Andy Jun 17 '10 at 11:03
@Andy: Not necessarily. One could still watch incoming packets. Also, a NIC can have multiple addresses (though it doesn't apply in this case). – grawity Jun 17 '10 at 21:33
@grawity Thanks again – Andy Jun 18 '10 at 8:46

Use ip from iproute2. (You need to also specify the prefix length though.)

ip addr del dev eth0

To remove all addresses (in case you have multiple):

ip addr flush dev eth0
share|improve this answer

As simple as ifconfig eth0 They should have put it in the manual.

share|improve this answer

To remove all adreses from all interfaces i used for loop:

for i in $(ls /sys/class/net/) ; do
    /usr/sbin/ip addr flush $i &
share|improve this answer

protected by Community Sep 5 '15 at 16:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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