Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 0.0.0.0. They should have put it in the man

share|improve this question
1  
Hi. Why do you want to set the IP address to 0.0.0.0? –  Andy Jun 17 '10 at 9:27
1  
@Andy: I think you misunderstood the question. @jackhab wants to unassign an address from the interface, not set it to 0.0.0.0 -- 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
add comment

4 Answers 4

iproute2 with accurate prefix length:

ip addr del 1.2.3.4/32 dev eth0

To remove all addresses:

ip addr flush dev eth0
share|improve this answer
add comment

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

share|improve this answer
add comment

Things you should know about IP address 0.0.0.0.

RFC 5735 -- Special Use IPv4 Addresses

0.0.0.0/8 - Addresses in this block refer to source hosts on "this" network. Address 0.0.0.0/32 may be used as a source address for this host on this network; other addresses within 0.0.0.0/8 may be used to refer to specified hosts on this network

What is an IP address? at HowStuffWorks.

Out of the almost 4.3 billion possible combinations, certain values are restricted from use as typical IP addresses. For example, the IP address 0.0.0.0 is reserved for the default network and the address 255.255.255.255 is used for broadcasts.

IP address 0.0.0.0 at About.com

Computers normally show an address of 0.0.0.0 when they are not connected to a TCP/IP network. Having this address, a computer cannot be reached or communicate with any other devices over IP.

And, this can be confusing sometimes -- but, all it means is
when you see packets with source IP 0.0.0.0, just assume it means 'Null',
and, if you see it being used to match IP addresses, take it as a 'wildcard'.

TCP/IP software applications also use 0.0.0.0 as a programming technique to monitor network traffic from any valid IP address. While connected computers do not use this address, messages carried over IP sometimes include 0.0.0.0 inside the header when the source of the message is unknown.

share|improve this answer
1  
I am not trying to assign 0.0.0.0 to an interface. I removing existing IP address from it. –  jackhab Jun 18 '10 at 16:37
add comment

For the folks who google these things such as myself a special note is helpful: Mac OS X does not behave the same as Linux in this regard. I doubt that any of the BSDs do. This is an interesting edge case for the ifconfig authors because apperantly the two most widely used implementations of ifconfig handle this differently.

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.