There is already by default, and it works (Win 7):

::1             localhost

This also works (testing with ping):

::1             hosta

But when I'm trying to add something non-loopback, it doesn't resolve:

fe80::215:afff:fec6:ea64 realhost

So that I can do:

C:>ping fe80::215:afff:fec6:ea64
Reply from fe80::215:afff:fec6:ea64: time=2ms

But can't go with hostname that I put in hosts:

C:>ping realhost
Ping request could not find host realhost. ...

Any way to add an IPv6 address to hosts in Windows?

  • Is that LL address on the same network? Feb 12, 2011 at 12:29
  • Yes, as you may have noticed fe80:: in it. Ping just cant find IP for realhost.
    – Evgenyt
    Feb 12, 2011 at 12:30
  • Hold on a moment. If you can't ping that ip address then fiddling about with hosts files isn't going to help you.
    – Rob Moir
    Feb 12, 2011 at 12:34
  • There's nothing stopping someone from SSHing to a remote host, reading the LL address there, and putting it in their hosts file. Except that won't work, because it's a LL address. Feb 12, 2011 at 12:37
  • 1
    I can ping fe80::215:afff:fec6:ea64 directly. But can't ping realhost. This is the problem. System cannot resolve realhost using hosts record.
    – Evgenyt
    Feb 12, 2011 at 12:38

4 Answers 4


Finally, I've found the way. I speicied zone ID (11 in my case) in hosts:

fe80::215:afff:fec6:ea64%11 realhost

Which I've got using

netsh interface ipv6 show addresses

With help of http://technet.microsoft.com/en-us/library/bb726995.aspx

  • 1
    Hey, that command... did you have to run it on the realhost machine? Asking because I got an IPv4 IP for that realhost, but we cannot connect to it and we don't even know where it's hosted. So trying to find out that %11 or similar in any other way... :S
    – mickael
    Feb 21, 2018 at 23:57

Try like this is host file of window. Hope it can help


[2001:db8::10:2aa:ff:fe21:5a88] tsrvv6.wcoast.example.com
  • it doesn`t work
    – tcma13
    Mar 4, 2021 at 20:34

According to a Microsoft TechNet article from 2005/2006:

You should not place entries for link-local addresses in the Hosts file because you cannot specify the zone ID for those addresses. This concept is similar to using the Ping tool to ping a link-local destination without specifying the zone ID. Therefore, entries in the Hosts file are useful only for global or site-local IPv6 addresses.


  • If I put what they do 2001:db8::10:2aa:ff:fe21:5a88 tsrvv6.wcoast.example.com ts1. It doesn't get resolved when I try to ping tsrvv6.wcoast.example.com. Does it work for you?
    – Evgenyt
    Feb 12, 2011 at 13:58

I don't have Win7 nearby so can't test it, but I got caught by the hosts.sam file once. Windows Explorer will hide extensions by default, so I spent a day editing the "hosts" file but it was actually the hosts.sam file. Make sure you are editing the real hosts file.

And antispyware programs will block changes to the hosts file. Malware will add hosts entries to redirect bank websites to fake sites.

Adding ipv6 addresses to the hosts file does work on W2K8, I did it last week.

  • The hosts.sam file is the real hosts file. You need to remove the .sam extension when you use it. The same goes for the lmhosts.sam file.
    – joeqwerty
    Feb 12, 2011 at 14:17
  • maybe on some systems. usually i've seen a hosts file and a hosts.sam file. But i'm usually fixing other people's boxes.
    – jqa
    Feb 12, 2011 at 18:46
  • 3
    ".sam" is ".sample" in 8.3 dos compatible file names :-) Apr 24, 2018 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.