Is there a maximum number of hostname aliases per line in a Windows hosts file?
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