views:

499

answers:

7

Is 0.0.0.0 a valid IP address? I want my program to be able to store it as an indication that no address is in use, but this won't work if it's actually valid.

A: 

for all intents and purposes, yes. Each of the four numbers separated by the period have a value ranging from 0-255, so 0.0.0.0 is technically valid.

I don't think that there would be anyone in the world who actually has that IP though.

EDIT: okay, it is reserved for the default route, but it is still valid.

Alexander Rafferty
It's reserved for the default route.
jer
+18  A: 

It's valid inasmuch as it contains four octets, each within the range 0 through 255 inclusive. However, it's not usable as a real IP address.

RFC1700 states that 0.0.0.0/8 (0.<anything>.<anything>.<anything>) is reserved as a source address only. You can get into situation where it appears you have this address but that's normally because no address has been assigned to you (by DHCP, for example).

See also Wikipedia entry on IPv4.

paxdiablo
for what?......
Robert Harvey
For chuck norris. All attempts to Ping will be swiftly roundhouse kicked.
TerrorAustralis
I may be wrong, but it is in fact an IP address -- it's just reserved. Just because it's reserved does not mean it's not an IP address.
CD Sanchez
Well, I took "valid" to mean usable. It's certainly a legal IP address since each of the octets are in the range 0 thru 255. Adjusting answer to clarify.
paxdiablo
@Terror, it's a pity your funniest comment with the Chuck Norris meme ('General Failure' is the message you get when you try to Ping chuck norris. He roundouse kicked your Ping so hard it turned into a Pong and your computer couldnt make sense of it) was deleted with the answer. Putting here for prosperity :-)
paxdiablo
@James, right you are, I forgot the bitcount came from the "left" rather than the "right" - fixed.
paxdiablo
I wanted to make sure my previous comment was correct so I did some reading. RFC 1700 states: "There are five classes of IP addresses: Class A through Class E." In RFC 790, it states 0.rrr.rrr.rrr is under the "Class A Network." Therefore, since 0.0.0.0 is a Class A address, it is an IP address. If any of these statements are wrong feel free to correct me.
CD Sanchez
@Daniel, I don't think _any_ of your statements are wrong, we just had different ideas as to what "valid" meant, which is why I clarified.
paxdiablo
Lol, thanks pax!
TerrorAustralis
+2  A: 

A list of reserved IP addresses is here.

hlynur
One word with a link doesn't make for a very informative answer.
Seth
@Seth - True. And what about using SO as Google substitute? What's your opinion on that? - http://tinyurl.com/36fddp3 - poor questions - poor answers
hlynur
@hlynur Not everyone is a master of google-fu.
Seth
@Seth - Not everyone should start to learn it then, or quit computers and switch to embroidery.
hlynur
+3  A: 

It's reserved as the default route address.

It's common to see this via ipconfig when no address has been assigned to you.

Rob
+2  A: 

Yes, it is an IP address but it is reserved.

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

CD Sanchez
+1  A: 

0.0.0.0 is used to bind all interfaces. So it's a special value just like 127.0.0.1.

Novikov
All IPv4 interfaces. It won't bind to IPv6 or other protocols.
Bert Huijben
A: 

You can use it in your application to represent that it does not have an IP address, Microsoft also uses 0.0.0.0 when the machine has no IP address.

the "Valid" scenarios talked about above are dependent on the specific scenarios where they have nothing to do with your application.

Martin