Ping and FTP Resolve IP Address with Leading Zero as OctalLast reviewed: March 25, 1997Article ID: Q115388 |
The information in this article applies to:
SUMMARYWindows for Workgroups with TCP/IP-32 and Windows NT Ping and FTP accept Internet Protocol (IP) addresses comprised of decimal, octal, or hexadecimal numbers as command line parameters. This can cause confusion if you unintentionally use a leading zero in a decimal octet. With a leading zero, the number is resolved by these utilities as an octal number, thus specifying the wrong IP address. This results in Ping verifying an address that you do not intend to ping or FTP trying to connect to an address that you do not intend to connect to.
MORE INFORMATIONMany TCP/IP programs such as Ping and FTP use the inet_addr() sockets function to translate IP address strings into 4-byte addresses. This function accepts an IP address in standard decimal, octal, and hexadecimal notation, such that the following IP address examples are acceptable to Ping and FTP and resolve to the same IP address:
22.101.31.153 (decimal) 026.101.31.153 (octal) 0x16.101.31.153 (hexadecimal) 0x16.101.037.153 (a combination of all three number systems)If you unintentionally enter a leading zero in an octet, the IP address that Ping and FTP resolve is not the same as you intended, as in the following example (using Ping):
In Windows NT 3.1: c:\>ping 022.101.31.153 Pinging host 022.101.31.153 (unnamed) : 18.101.31.153 ICMP Echo Reply:TTL 32 ICMP Echo Reply:TTL 32 ICMP Echo Reply:TTL 32 ICMP Echo Reply:TTL 32 Host 022.101.31.153 replied to all 4 of the 4 pings In Windows NT 3.5: c:\>ping 022.101.31.153 Pinging 18.101.31.153 with 32 bytes of data: Ping succeeded: 32 bytes time=10ms TTL=32 Ping succeeded: 32 bytes time=10ms TTL=32 Ping succeeded: 32 bytes time=10ms TTL=32 Ping succeeded: 32 bytes time=10ms TTL=32NOTE: In this example, 022.101.31.153 is resolved by Ping to be 18.101.31.153 decimal, not 22.101.31.153 decimal. This results in either a successful (shown above) or unsuccessful verification of the wrong IP address, depending on whether the resolved IP address is a valid IP address in your network environment. To avoid an address being incorrectly resolved by Ping or FTP as illustrated above, it is recommended that you check for and remove leading zeros in the IP address entered on the command line, unless an octal number is intended.
|
Additional query words: prodnt
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |