Is there a maximum number of hostname aliases per line in a Windows hosts file?

I have a hosts file on Windows 7 that has an IP address followed by 10 different hostname aliases. I can ping the first nine, but if I try to ping the tenth, I get:

Ping request could not find host tenth. Please check the name and try again.

I've tried switching the ninth and tenth entry in case it was something to do with the specific hostname, in each case it is the tenth listed that I can't contact.

Is there a limit to the number of hostnames that can be listed on a line? If so, is there a way around this restriction?

EDIT: The length of this line of the hosts file is less than 150 characters.


Solution 1:

Windows allows up to nine aliases per line. For more, add another line.

Before (h10 and h11 do not resolve):

127.0.0.1  h01 h02 h03 h04 h05 h06 h07 h08 h09 h10 h11

After (h10 and h11 resolve):

127.0.0.1  h01 h02 h03 h04 h05 h06 h07 h08 h09
127.0.0.1  h10 h11

I confirmed this behavior and workaround on Windows 7, Windows 10, and Windows Server 2008 R2.

While I cannot find a Microsoft citation, the following article claims the third-party utility Hosts Optimizer puts "a maximum of nine host names in a single line if they point to the same IP address."

http://www.ghacks.net/2010/05/23/windows-hosts-file-optimizer

Solution 2:

Looks like Microsoft has inconsistent handling of the hosts file. While you can't ping past the ninth hosts item, you can still navigate to hosts past the tenth in the browser.

Documentation found related: https://technet.microsoft.com/en-us/library/bb727005.aspx?f=255&MSPPError=-2147217396#EDAA

You can just add additional lines.

127.0.0.1 myreallylonghostname
127.0.0.1 myotherreallylonghostname