In my network I have a server known by the IP address By accident, I discovered that the command: ping 10.0.15 results in

64 bytes from icmp_seq=1 ttl=64 time=9.09 ms

...so the correct server responds to the ping. Even when I try: ping 10.15I get a comparable result. Also, telnet to the partial addresses works as expected. However, SSH fails. Why do packets sent to a partial address arrive at the correct server?

  • it's not a partial address... so the title is a bit misleading here...
    – Rory Alsop
    Jan 27, 2018 at 13:16
  • 1
    ssh should be able to connect to such an address (because it maps to the same value actually passed to socket calls) but it won't recognize the host key as matching a known_hosts entry for the 'proper' address, with result depending on how you (or your admin) has configured host key checking. Jan 27, 2018 at 13:19
  • For additional fun on text representations of IP addresses, see my older, related answer on serverfault: serverfault.com/a/837667/355827
    – ilkkachu
    Jan 27, 2018 at 14:28

1 Answer 1


That is an allowed form according to the inet_aton(3) function docs:

       inet_aton() converts the Internet host address cp from  the  IPv4  num‐
       bers-and-dots  notation  into  binary  form (in network byte order) and
       stores it in the structure that inp  points  to.   inet_aton()  returns
       nonzero  if the address is valid, zero if not.  The address supplied in
       cp can have one of the following forms:

       a.b.c.d   Each of the four  numeric  parts  specifies  a  byte  of  the
                 address;  the  bytes  are  assigned in left-to-right order to
                 produce the binary address.

       a.b.c     Parts a and b specify the  first  two  bytes  of  the  binary
                 address.   Part  c  is  interpreted  as  a  16-bit value that
                 defines the rightmost two bytes of the binary address.   This
                 notation  is  suitable for specifying (outmoded) Class B net‐
                 work addresses.

       a.b       Part a specifies the first byte of the binary address.   Part
                 b is interpreted as a 24-bit value that defines the rightmost
                 three bytes of the binary address.  This notation is suitable
                 for specifying (outmoded) Class C network addresses.

       a         The  value  a is interpreted as a 32-bit value that is stored
                 directly into the binary address without any byte  rearrange‐


$ perl -MSocket=inet_aton,inet_ntoa -E 'say inet_ntoa(inet_aton("10.0.15"))'
$ perl -MSocket=inet_aton,inet_ntoa -E 'say inet_ntoa(inet_aton("10.15"))'

However these days it would likely be better to instead use the getaddrinfo or inet_ntop calls for IPv6 support. The "Class B" stuff became legacy back in 1994 or so now that we have CIDR and /24...

Hey you can also give it a big old integer (but please don't)

$ perl -MSocket=inet_aton,inet_ntoa -E 'say inet_ntoa(inet_aton("2130706433"))'
$ getent hosts 2130706433       2130706433
$ ssh 2130706433
The authenticity of host '2130706433 (' can't be established.

(This may not be portable to other unix; in particular OpenBSD cannot resolve 2130706433...)

  • 1
    For even more fun, as the next para of the doc should say (and POSIX does), each number is parsed like C source where leading 0 means octal and 0x or 0X means hex, so is actually the address usually written as Phishers used to do this to 'hide' the host identity in malicious URLs; I haven't looked recently to see if they still do. Jan 27, 2018 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .