Discussion:
Ping - strange problem (10.10.10.10. != 10.10.10.010?)
(too old to reply)
Sponegbob
2004-11-04 13:49:36 UTC
Permalink
Hi everybody,

i have a problem with the Windows utillity PING.

if i try to ping an ip-adress (i.e 10.10.10.10) everything works
correct: the host with the ip adress 10.10.10.10 answers.

now i try to ping the adress 10.10.10.010 -> this should be the same
host as the one mentioned above. But in this case the host with the
ip-adress 10.10.10.8 (!!!) answers!

My Question: what is the difference between 10.10.10.10 and
10.10.10.010?

This problem appears with multiple ip-adresses: have a try?

Thx,

Chris
Johan van Selst
2004-11-04 13:54:18 UTC
Permalink
Once upon a newsgroup, Sponegbob claimed:
] now i try to ping the adress 10.10.10.010 -> this should be the same
] host as the one mentioned above. But in this case the host with the
] ip-adress 10.10.10.8 (!!!) answers!
] My Question: what is the difference between 10.10.10.10 and
] 10.10.10.010?

Numbers starting with '0' are interpreted as octal numbers (base 8)
rather than decimal numbers (base 10). '10' is the octal representation
for decimal '8'. So 0377 corresponds to 255 decimal, etc.


Greetings,
Johan
--
Why do we always come here - I guess we'll never know.
It's like a kind of torture to have to watch the show.
Bulent Murtezaoglu
2004-11-04 13:57:25 UTC
Permalink
[...]
S> now i try to ping the adress 10.10.10.010 -> this should be the
S> same host as the one mentioned above. But in this case the host
S> with the ip-adress 10.10.10.8 (!!!) answers! [...]

The 0 is causing the last octet to be read in octal (base-8) where 010
is decimal 8. This bites everyone at one time, and baffles
non-programmers. Don't use leading 0's and you'll be fine.

cheers,

BM
glen herrmannsfeldt
2004-11-06 08:49:23 UTC
Permalink
Sponegbob wrote:

(snip)
Post by Sponegbob
now i try to ping the adress 10.10.10.010 -> this should be the same
host as the one mentioned above. But in this case the host with the
ip-adress 10.10.10.8 (!!!) answers!
And you can put a 0x prefix on hex numbers.

Also, there are rules for dotted IP addresses with fewer than
four components, including writing the whole thing as a
single 32 bit number. 0x0a0a0a0a will also find your
10.10.10.10 server, as will 10.10.2570, 10.0xa0a0a
and 0xa.657930 and 10.02405012

-- glen

Continue reading on narkive:
Loading...