Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How do I add IPv6 address into System32\drivers\etc\hosts?

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

This also works (testing with ping):

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

So that I can do:

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

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

  • domain-name-system

JdeBP's user avatar

  • Is that LL address on the same network? –  Ignacio Vazquez-Abrams 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. –  Ignacio Vazquez-Abrams 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:

Which I've got using

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

Oliver Vogel's user avatar

  • 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

C:\Windows\System32\drivers\etc :

Long Pham's user avatar

  • 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.

http://technet.microsoft.com/en-us/library/bb727005.aspx

joeqwerty's user avatar

  • 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.

jqa's user avatar

  • 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 :-) –  MarkusSchaber Apr 24, 2018 at 6:43

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged windows ipv6 hosts-file domain-name-system ..

  • The Overflow Blog
  • Spreading the gospel of Python
  • OverflowAI and the holy grail of search
  • Featured on Meta
  • Our Partnership with OpenAI
  • What deliverables would you like to see out of a working group?

Hot Network Questions

  • Is Matthew 24:40 mistranslated in most English translations?
  • Story about someone selling his soul to the Devil and losing...with a twist
  • Law of the unconscious statistician for conditional expectation and pushforward measure of conditional distribution
  • How do you respond to this common critique of American Pragmatism?
  • Examples where a derived noun and a passive form in '-or' are unrelated
  • Is this a school badge?
  • How to draw Pascal's Triangle mod 3 with Tikz
  • Ozone from 10um IR?
  • Karatsuba algorithm in C
  • How does a guitar string produce sound?
  • Retrieve Custom URL for the Experience Community in Apex: how can I do that?
  • How many Friends are there in the circle?
  • If a Latin sentence cannot end in a preposition, how would you say "I have never seen that before." in Latin?
  • "the girl with the red dress on" — What licenses the preposition "on"? What does it function as?
  • Is spin a fundamental property of QFT?
  • Is a dome really the most efficient way to contain gas in a vacuum?
  • How to improve code finding x+y+z+w=40 to generate numbers 1 through 40?
  • Why do we want to normalize the solar abundance of elements to Si?
  • How to insert a pex segment with sharkbite/ push-to-fit connectors in an existing [copper] line
  • What does "attic access required" mean in the context of a bathroom exhaust fan?
  • Exclude certain filename suffixes when searching using glob qualifiers
  • Construct a uInt from an array of bits
  • Can White still castle?
  • The older, the smarter. Is the wisdom of time a scientifically proven fact or just human prejudices?

how to add ipv6 address in hosts file

  • OSPFv2 Route Summarization in Packet Tracer
  • OSPFv2 Route Filtering in Packet Tracer
  • OSPFv2 NSSA Areas in Packet Tracer
  • OSPFv2 Stub Areas in Packet Tracer
  • OSPFv2 Path Cost in Packet Tracer
  • OSPFv2 Virtual Links Implementation in Packet Tracer

CCNA TUTORIALS

A perfect guide to getting ccna certified.

  • IPv6 Internet Protocol Version6

IPv6 Address Configuration on Hosts

IPv6 Address Configuration on Hosts, ccna, ccna tutorials

Contents of this article

In this article, I describe IPv6 Address Configuration on Hosts via two types to understand it better. IPv6 Address Configuration on Hosts is a fundamental step in enabling communication over IPv6 networks. IPv6 offers two primary methods of address configuration: Stateless Address Autoconfiguration (SLAAC) and Dynamic Host Configuration Protocol for IPv6 (DHCPv6). In this guide, we’ll walk through the process of configuring IPv6 addresses using both SLAAC and DHCPv6 on hosts.

1. Stateless Address Autoconfiguration (SLAAC):

SLAAC is a simple and automated method for configuring IPv6 addresses on hosts. It allows devices to generate their own IPv6 addresses based on the network’s prefix and other information obtained from Router Advertisement (RA) messages. IPv6 Address Configuration on Hosts by using SLAAC.

SLAAC-based configuration works:

1. router advertisement (ra) messages:.

Routers periodically send RA messages to announce network parameters, including the IPv6 prefix and other configuration information. These messages are essential for SLAAC-based address configuration.

2. Generation of Interface Identifier:

Hosts use their MAC address or an alternative method, such as Privacy Extensions, to generate a unique interface identifier.

3. Combining Prefix and Interface Identifier:

Hosts combine the network prefix from the RA message with the generated interface identifier to create a complete IPv6 address.

4. Address Validity and Lifetime:

RA messages also provide information about the validity and preferred lifetime of the address. Hosts use this information to manage their addresses.

Configuring SLAAC on Hosts:

Enabling SLAAC-based configuration on hosts is often straightforward:

1. Ensure IPv6 is enabled on the host’s network interface.

2. Configure the network interface to use “SLAAC” or “Automatic” address assignment mode.

3. Hosts will listen for RA messages from routers and automatically configure their IPv6 addresses based on the provided information.

2. IPv6 Address Configuration on Hosts  by Dynamic Host Configuration Protocol for IPv6 (DHCPv6):

DHCPv6 is another method for configuring IPv6 addresses on hosts. It provides centralized control over address allocation and allows administrators to assign other network parameters, such as DNS server addresses. IPv6 Address Configuration on Hosts by using DHCPv6.

Here’s how DHCPv6-based configuration works:

1. dhcpv6 server:.

A DHCPv6 server is set up on the network to manage address assignments and configuration parameters.

2. Host Request:

Hosts send a DHCPv6 request to the server to request an IPv6 address and other configuration information.

3. Address Assignment:

The DHCPv6 server assigns an IPv6 address to the requesting host based on available address pools.

4. Additional Configuration:

Along with the address, the DHCPv6 server can provide DNS server addresses, domain names, and other network parameters.

Configuring DHCPv6 on Hosts:

To configure DHCPv6-based address assignment on hosts:

1. Enable IPv6 on the network interface.

2. Set the network interface to use “DHCP” or “Automatic (DHCP)” address assignment mode.

3. Hosts will send DHCPv6 requests to the DHCPv6 server, which will respond with an assigned IPv6 address and other configuration details.

Selection of SLAAC and DHCPv6 for IPv6 Address Configuration on Hosts:

The choice between SLAAC and DHCPv6 depends on network requirements and policies:

– SLAAC is suitable for networks where automated address assignment is preferred, and additional configuration parameters are not required.

– DHCPv6 is beneficial when centralized control over address assignment and additional configuration parameters is necessary.

In many scenarios, networks use a combination of both methods to achieve a balance between automation and control.

IPv6 Address Configuration on Hosts: Second approach to explain

IPv6 Address Configuration on Hosts involves enabling IPv6 on the network interface and selecting an address assignment method. Let’s see the IPv6 Address Configuration on Hosts using both Stateless Address Autoconfiguration (SLAAC) and Dynamic Host Configuration Protocol for IPv6 (DHCPv6) methods, along with examples for each for IPv6 Address Configuration on Hosts.

1. Stateless Address Autoconfiguration (SLAAC) for IPv6 Address Configuration on Hosts:

SLAAC allows hosts to automatically configure their IPv6 addresses based on Router Advertisement (RA) messages from routers on the network. Here’s how to configure SLAAC on hosts:

Step 1: Enable IPv6 on the Network Interface:

In most modern operating systems, IPv6 is enabled by default. However, you can check and enable IPv6 if needed:

Example (Linux):

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0

Step 2: Configure Network Interface for SLAAC:

Configure the network interface to use SLAAC for IPv6 address assignment:

sudo ip -6 addr add <prefix>::<interface_identifier>/64 dev <interface_name>

Replace `<prefix>` with your network’s IPv6 prefix and `<interface_identifier>` with the unique interface identifier of the host. Replace `<interface_name>` with the name of the network interface (e.g., eth0, ens33).

2. Dynamic Host Configuration Protocol for IPv6 (DHCPv6) IPv6 Address Configuration on Hosts:

DHCPv6 allows centralized control over IPv6 address assignment and additional configuration parameters. Here’s how to configure DHCPv6 on hosts:

If IPv6 is not already enabled, follow the same step as shown in SLAAC configuration.

Step 2: Install DHCPv6 Client Software (if not installed):

Ensure the DHCPv6 client software is installed on the host:

sudo apt-get install dhcpv6-client   # For Debian/Ubuntu

sudo yum install dhcpv6-client       # For CentOS/RHEL

Step 3: Configure Network Interface for DHCPv6:

Configure the network interface to use DHCPv6 for IPv6 address assignment:

sudo dhclient -6 <interface_name>

Replace `<interface_name>` with the name of the network interface (e.g., eth0, ens33).

Example Scenarios:

Let’s consider two scenarios where we configure IPv6 on hosts using SLAAC and DHCPv6.

Scenario 1: SLAAC Configuration

Assuming we have a network with the prefix `2001:db8:1234::/64`, and the host’s MAC address is `00:11:22:33:44:55`. We’ll use SLAAC to configure the host’s IPv6 address.

sudo ip -6 addr add 2001:db8:1234::11:22ff:fe33:4455/64 dev eth0

Scenario 2: DHCPv6 Configuration

In this scenario, we’ll configure the host’s IPv6 address using DHCPv6.

sudo dhclient -6 eth0

Note: The above examples are provided for Linux-based systems. The steps may vary slightly for different operating systems.

IPv6 Address Configuration on Hosts, ccna, ccna tutorials

Configuring IPv6 on Hosts: Examples of SLAAC and DHCPv6

Configuring IPv6 addresses on hosts is essential for enabling communication within IPv6 networks. Hosts can be configured using two primary methods: Stateless Address Autoconfiguration (SLAAC) and Dynamic Host Configuration Protocol for IPv6 (DHCPv6). In this guide, we’ll walk through step-by-step instructions and examples for configuring IPv6 on hosts using both SLAAC and DHCPv6.

SLAAC is a straightforward method for configuring IPv6 addresses on hosts. Let’s go through the process using an example:

Example: Configuring IPv6 Address Using SLAAC

Assume you have a host with a network interface named “eth0” and the router on the network sends Router Advertisement (RA) messages.

1. Enable IPv6 on the Interface:

   Open the terminal and run the following command to enable IPv6 on the “eth0” interface:

   sudo sysctl net.ipv6.conf.eth0.disable_ipv6=0

2. Configure Interface for SLAAC:

   Run the following command to configure the “eth0” interface for SLAAC:

   sudo ip -6 addr add 2001:0db8:1234:abcd::/64 dev eth0

   Replace `2001:0db8:1234:abcd::/64` with the appropriate IPv6 prefix and prefix length.

3. Listen for RA Messages:

   Once the interface is configured, the host will listen for RA messages sent by routers. The RA messages will contain the prefix information that hosts need for SLAAC-based address configuration.

2. Dynamic Host Configuration Protocol for IPv6 (DHCPv6):

DHCPv6 provides centralized control over IPv6 address assignment and configuration parameters. Let’s see how to configure IPv6 addresses using DHCPv6:

Example: Configuring IPv6 Address Using DHCPv6

Assume you have a DHCPv6 server set up on the network, and the host’s network interface is “eth0.”

   Use the following command to enable IPv6 on the “eth0” interface:

2. Configure Interface for DHCPv6:

   Configure the “eth0” interface to use DHCPv6 for IPv6 address assignment:

   sudo dhclient -6 -v eth0

   This command requests an IPv6 address from the DHCPv6 server for the “eth0” interface.

3. DHCPv6 Server Response:

   The DHCPv6 server will respond with an assigned IPv6 address and other configuration parameters, such as DNS server addresses and domain names.

Choosing the Configuration Method:

The choice between SLAAC and DHCPv6 depends on your network’s requirements:

– SLAAC is suitable for networks where automation and simplicity are prioritized.

– DHCPv6 is beneficial when centralized control over address assignment and additional configuration parameters is needed.

Conclusion for IPv6 Address Configuration on Hosts:

Configuring IPv6 addresses on hosts is crucial for establishing communication within IPv6 networks. By following the steps and examples provided for both SLAAC and DHCPv6 configuration methods, network administrators can ensure that hosts are properly configured to leverage the benefits of the IPv6 protocol. IPv6 Address Configuration on Hosts involves enabling IPv6 on the network interface and choosing an address assignment method (SLAAC or DHCPv6). Depending on your network requirements, you can automate address assignment with SLAAC or opt for centralized control with DHCPv6.

By following these steps and examples, you can successfully configure IPv6 on your hosts and ensure seamless communication in IPv6-enabled networks. Configuring IPv6 addresses on hosts is a pivotal step in establishing connectivity over IPv6 networks. The choice between SLAAC and DHCPv6 depends on factors such as automation, control, and additional configuration needs. By correctly implementing these configuration methods, network administrators ensure seamless communication and efficient utilization of the expansive IPv6 address space. I hope you found this article helpful and useful, you may contact us or comment below for any query or suggestions related to this article.

Other Related posts:

  • IPv6 Address Configuration on Routers
  • IPv6 Stateless Address Autoconfiguration (SLAAC)
  • IPv6 Link-Local Addresses
  • IPv6 Unique Local Addresses (ULA)
  • IPv6 Global Unicast Addresses
  • Working of IPv6 in Internetwork
  • Stateless Autoconfiguration SLAAC
  • IPv6 Address system in computer networking

Related Posts

IPv6 Future Trends and Developments, ccna, ccna tutorials

IPv6 Future Trends and Developments

IPv6 and Internet Exchange Points (IXPs), ccna, ccna tutorials

IPv6 and Internet Exchange Points (IXPs):

IPv6 and Autonomous Systems, ccna, ccna tutorials

IPv6 and Autonomous Systems

IPv6 in Mobile Networks, ccna, ccna tutorials

IPv6 in Mobile Networks

IPv6 in Cable and Broadband Networks, ccna, ccna tutorials

IPv6 in Cable and Broadband Networks

IPv6 and Global Internet Governance , ccna, ccna tutorials

IPv6 and Global Internet Governance 

Leave a reply.

Your email address will not be published. Required fields are marked *

How-To Geek

How to edit the hosts file on windows 10 or windows 11.

The hosts file can be used to block access to specific websites.

Quick Links

What does the hosts file do, the windows hosts file location, how to edit the windows hosts file, if you can still connect to blocked addresses, key takeaways.

  • The hosts file is the first place Windows checks for IP addresses when connecting to websites and can be manually edited to block access to specific websites.
  • The hosts file is located in "C:\Windows\system32\drivers\etc" on both Windows 10 and 11, and you need administrative permissions to edit it.
  • To block a website with the hosts file, direct the URL to either 0.0.0.0 or 192.168.0.1.

The hosts file is the first place Windows checks when connecting to a website. You can edit it manually to block access to specific websites. Find out what and where it is, and how to edit it.

When you type in a regular web address to access a website, like google.com, your PC doesn't automatically know how to connect. It needs the correct IP address associated with the web address in order to make a connection.

The hosts file is the first place your PC will check to find an IP address for a website, but by default, the hosts file doesn't contain any. If your PC can't find an IP address in the hosts file, it checks the DNS cache or connects to a DNS server . When a web address and an IP are inserted into the hosts file, it will provide that information to your computer any time you try to connect to that web address.

If the hosts file tells your computer to find a web address at an IP address that won't connect — like 0.0.0.0 — it blocks access to the website.

The hosts file is located in "C:\Windows\system32\drivers\etc" on both Windows 10 and 11. You need administrative permissions to edit it, which means that you can't just open it in a normal Notepad window.

You can edit the hosts file with any text editor. There are a variety available, but both Windows 10 and 11 come with Notepad. Avoid using a word processor — the differences between Notepad and a word processor like Wordpad can sometimes cause problems.

You'll need to run Notepad as administrator to edit the hosts file. To do this on Windows 10, click the start button, type "notepad" into the search bar, and then on the right, click "Run as administrator."

Running Notepad on Windows 11 is the same process as Windows 10, except "Run as administrator" is not displayed immediately. Click on the start button, and then type "Notepad" into the search bar. On the right-hand side, click the small downward-facing arrow to reveal more options.

Then click "Run as administrator."

Once Notepad is open, click on File > Open, and navigate to "C:\Windows\System32\drivers\etc"

Notepad is set to look for ".txt" files by default, so you'll need to set it to look for "All Files" in the drop down menu instead. Then, click the hosts file and hit open.

Once the hosts file is open, you can start adding lines to block websites. The lines that go into the hosts file can be broken up into three basic components, each separated by at least one space.

  • The IP Address - This tells your PC where to look for a website.
  • The Web Address - This is the website address you want to block.
  • The Comment - Where you describe what the line does. The comment must have a hashtag preceding it.

It isn't necessary to include the comment for the hosts file to work, but commenting files when you edit them is an excellent habit.

Once you're done adding lines, click File > Save to save your changes. There shouldn't be a popup after you click save. If there is, it means Notepad does not have administrative access, and that you need to close Notepad and run it as administrator. Once you've saved successfully, go ahead and exit Notepad.

There are two addresses, 127.0.0.1 and 0.0.0.0, that are commonly used in the hosts file to block traffic. There are significant differences between 127.0.0.1 and 0.0.0.0 , but in most cases either will work. Rarely, a program running on your PC might have problems if you use 127.0.0.1, so it is best to stick with 0.0.0.0.

Recent versions of Google Chrome, Mozilla Firefox, and Microsoft Edge all use DNS over HTTPS (DoH) by default. DNS over HTTPS works the same way as a regular DNS server, however DNS over HTTPS encrypts your queries to boost your privacy . Encrypting your queries means that third parties can't tell what requests you've sent to a DNS server, or how the server responds.

When DNS over HTTPS is enabled in a browser, the browser bypasses the normal DNS client in Windows 10 and 11. That means the browser ignores the hosts file entirely and uses a secured DNS server specified by the browser instead, so any addresses you attempt to block using the hosts file will be accessible. If you want to use the hosts file to block web browser traffic, you'll need to disable DNS over HTTPS in your browser.

Fortunately, you can enable DNS over HTTPS on Windows 11 . That will allow you to use the hosts file to block addresses while maintaining the advantages of DNS over HTTPS.

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

The ipv6 address in the hosts file cannot work

Under normal circumstances, the priority of the hosts file should be higher than the priority of using a DNS server, but if the hosts file uses ipv6 address, it will use the ipv4 address obtained by the DNS server

Windows 11 A Microsoft operating system designed for productivity, creativity, and ease of use. 8,367 questions Sign in to follow

The issue you’re experiencing might be due to the way your system is configured to resolve hostnames. By default, most systems will try to resolve hostnames to IPv4 addresses before trying IPv6.

Here are a few things you could try:

Check the Format of the IPv6 Address in the Hosts File: The IPv6 address should be written in the hosts file in the same format as an IPv4 address. For example: 2001:db8:1::1 example.com www.example.com .

Specify the Zone ID: If you’re using a link-local address (starts with fe80), you need to specify the zone ID. For example: fe80::215:afff:fec6:ea64%11 realhost. You can find the zone ID using the command netsh interface ipv6 show addresses.

Disable DNS over HTTPS (DoH) in Your Browser: If you’re using a browser like Firefox, it might be using DoH, which can bypass the hosts file. You can disable this option in the browser’s network settings.

Change Network Settings: You could try changing the DNS server to localhost (127.0.0.1) in your network connection properties.

Modify the /etc/netsvc.conf File: If you’re on a Unix-like system, you could try adding ‘hosts=local, local6, bind6’ to the /etc/netsvc.conf file. This entry causes the system to look at the host file’s IPv6 address for the hostname instead of the DNS server’s IPv4 addresses.

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How do I add an additional IPv6 address to /etc/network/interfaces?

this question How do I add an additional IP address to /etc/network/interfaces? mostly asks what i want except that i want to add more IPv6 addresses in the same interface eth0 without incrementing to eth0.1 and so on. the ifconfig command does IPv6 like ifconfig eth0 add ... so ... how can i add more IPv6 addresses to eth0 ?

Community's user avatar

  • it would be nice if there was a practical way to do a whole /64 –  Skaperen May 1, 2015 at 13:22
  • You can find some information about using a full /64 block on a single host here: serverfault.com/questions/590038/… –  kasperd May 3, 2015 at 15:04

4 Answers 4

It would appear (tested with ifupdown version 0.7.53.1) that we can add several iface eth0 inet6 stanzas to the interfaces file, which is more declarative than the accepted answer. The following code instructs the ifupdown suite to use stateless autoconfiguration and two additional static IPv6 addresses for the eth0 network interface:

Witiko's user avatar

  • 5 This is the "proper" answer - for IPv6 and IPv4! –  Michael Hampton Jul 7, 2016 at 20:50
  • in my case your answer did not work, but the approved one above did work. I am not sure why it might since it is a virtual machine (xen)? –  Sverre Feb 1, 2018 at 13:43
  • It would be useful to know what version of ifupdown you use. Can you look into the manpage of ifconfig? –  Witiko Feb 1, 2018 at 14:31
  • 1 While this works, it may not do what you want with respect to private addressing and router advertisements. See salsa.debian.org/debian/ifupdown/blob/master/inet6.defn for what actually happens. It seems like the order matters here for each of the inet6 statements. It may make sense to have a single auto declaration and then use post-up to add the addresses via ip -6 add and pre-down to remove it. –  AngerClown Jan 14, 2020 at 2:26
  • 2 Props for the dead:beef and c0de:d00d . –  Markus Zeller Aug 25, 2021 at 7:38

In the question you reference, the second answer shows the equivalent solution for IPv4. In the case of IPv6, the /etc/network/interfaces file should contain something like this:

You will need the iproute2 package installed, but you should use ip instead of ifconfig anyway.

For adding a whole /64 to an interface: There are some Q&As in serverfault.se , like " Adding a whole IPv6 /64 block to an network interface on debian " or " Can I bind a (large) block of addresses to an interface? ". Maybe they can help you.

Dubu's user avatar

  • that local block route feature works so all i need to do now is get that added so it puts it back on reboot –  Skaperen May 6, 2015 at 9:25

Here is what I did for multiple v6 addresses in interfaces file. First thing to consider is there cannot be two gateways, so you add a route below the second address.

UndyingThanos's user avatar

I was puzzled, too. But you can just give as many address lines you like. And it works.

Apply without interruption with:

You can also remove addresses this way. No need for ifdown .

You can even use IPv4 addresses to improve readability. For example on ProxMox I map the IPv6 of a VM based on the internal IPv4 of the VM, which gives addresses like:

fd01:7e57::192.168.0.1/64 provided your IPv6 prefix is /64 .

fd12:3456:789a in the example above is from the private IPv6 area fd00::/8 , which is similar to a private net on IPv4 like 10.0.0.0/8 . Replace 12:3456:789a with 40 random bits. This leaves 16 bits for subnets to form a /64 (in IPv6, networks cannot go beyond /64 , so this should always be the biggest address mask you can see on properly IPv6 enabled networks).

RIPE even writes:

Assigning prefixes longer than /56 is strongly discouraged, so your choices are: If you want a simple addressing plan use a /48 for each end-user
  • "Official" (static) allocations from your ISP should give you a /48.
  • Dynamic allocations (from the ISP to your router), usually give you a /56.
  • And internally on our network, you use a /64, so you can split up the /56 into 256 distinct networks for your own needs.

If you see a /64 on your router this does not mean, your ISP is nuts. Many routers default to /64 if not configured otherwise. Usually all ISPs allow routers to request a /56.

So on the other side (Server) you can safely assume, that all IPs which use the same prefix according to /56 come from the same network.

Tino's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged networking server ethernet ipv6 ..

  • The Overflow Blog
  • Spreading the gospel of Python
  • OverflowAI and the holy grail of search
  • Featured on Meta
  • Our Partnership with OpenAI
  • What deliverables would you like to see out of a working group?

Hot Network Questions

  • What would military spies in 17th century Europe be looking for inside a city, before a siege?
  • Looking for a book I read in the '70s, post-apocalypse/underground bunker
  • Unable to change file ownership through find-exec
  • Slow intersection of geopandas GeoDataFrames
  • How to track ride data for a shared bicycle?
  • Book about machinery at a long-abandoned mining colony that develops AI to keep mining
  • Delta method vs actual expectation
  • Story about someone selling his soul to the Devil and losing...with a twist
  • How does this ramp generator circuit work?
  • How much does one American Airline frequent flier mile equal in US$?
  • Is this a school badge?
  • Is “That store sells watches for one dollar each” grammatically correct? Are there better alternatives to this sentence, such as with “at”?
  • Retrieve Custom URL for the Experience Community in Apex: how can I do that?
  • Can you switch your "Replicate Magic Item" Infusion after a long rest?
  • What is this "/|\" symbol on the enclosures of various appliances?
  • Ozone from 10um IR?
  • How does a guitar string produce sound?
  • Curve Color Viewport Display settings. How can I see the individual chosen color in the viewport?
  • If we consider the universe to be four-dimensional, does the Big Bang lie in its center?
  • printf in Zsh does not shell escape exclamation mark
  • Exclude certain filename suffixes when searching using glob qualifiers
  • How would quadrupedal tetrapods use complex tools and become more technologically advanced?
  • Examples where a derived noun and a passive form in '-or' are unrelated
  • A coin game - is it a group?

how to add ipv6 address in hosts file

How to configure ipv6 address in Linux (RHEL / CentOS 7/8)

January 2, 2024

Linux , How To , Tips and Tricks

This step by step by guide to configure IPv6 address is validated on RHEL and CentOS 7 .

How-to-configure-ipv6-address-linux

IPv6 can act as a replacement for the IPv4 network protocol. The major problem it solves is the exhaustion of IPv4 addresses by using a much larger network address space. It also provides a number of enhancements and new features for network configuration management and support for future protocol changes.

The key reason IPv6 is not yet in wide deployment is that the core protocol does not have a simple way for systems that only have IPv6 addresses to communicate with systems that only have IPv4 addresses.

An IPv6 address is a 128-bit number , normally expressed as eight colon-separated groups of four hexadecimal nibbles (half-bytes). Each nibble represents four bits of the IPv6 address, so each group represents 16 bits of the IPv6 address.

To make it easier to write IPv6 addresses, leading zeros in a colon-separated group do not need to be written. However at least one nibble must be written in each field. Zeros which follow a non zero nibble in the group do not need to be written.

Since addresses with long strings of zeros are common, combine one or more groups of consecutive zeros with exactly one :: block.

Notice that under these rules 2001:1:1:1443::400 would be another less convenient way to write the example address. But it is a valid representation of the same address, and this can confuse administrators new to IPv6.

Some tips for writing consistently readable addresses

  • Always suppress all the leading zeros in a group
  • Use :: to shorten as much as possible. If two runs of zeros are equal in length, shorten the leftmost run of zeros by preference.
  • Although it is allowed, do not use :: to shorten one group of zeros, Use :0: instead, and save :: for runs of zeros longer than a single group.
  • Always use lowercase letters for hexadecimal numbers a through f .

Pre-requisite before starting to configure IPv6 address

Make sure that IPv6 is enable on your node. Look out for below entry in your sysctl configuration

This will list the IPv6 status for the default value and per interface value.

Here " 0 " means IPv6 is in active on our node, if the above returns " 1 " then it means IPv6 is disable on your node. So if the IPv6 is disable then your IPv6 configuration will not work.

I have already written an article with steps to enable or disable IPv6

Comparison of nm-setting and ifcfg-* directives

The following table maps some of the key NetworkManager settings name relevant to IPv6 connections to ifcfg-* directives.

Configure IPv6 address using Network Manager.

Open Network Manager Console from your Linux node

Select Edit a Connection and click on Ok

How to configure ipv6 address in Linux (RHEL / CentOS 7/8)

Next look out for your Ethernet card on which you wish to configure IPv6 address. If your NIC card does not appear on the list then you can add a new device . Since for me my device ( eno50 ) exists, so I will select the device and select Edit

How to configure ipv6 address in Linux (RHEL / CentOS 7/8)

This will bring you the main configuration page where you must give all the details to configure IPv6 address. Since I do not want to add IPv4 address to the same Ethernet device, I have disabled the IPv4 option.

Provide the IPv6 address/subnet and the gateway . Make sure you select Automatically Connect

How to configure ipv6 address in Linux (RHEL / CentOS 7/8)

Lastly click OK to exit the utility.

Next restart the network services to activate the changes

Now let us check the network configuration of eno50

So looks like I was able to successfully configure my interface with IPv6 address.

Validate the connectivity by pinging the IPv6 gateway

So I am able to connect to my gateway which means my IPv6 configuration was successful.

Configure IPv6 address using CLI

The following command will add a new connection for the interface eno49 , which will auto connect at startup, getting IPv4 networking information using DHCPv4. It will also get IPv6 networking settings by listening for router advertisements on the locallink.

The below command configures the eno49 interface statically using the IPv6 address and network prefix 2001:1:1:1443::433/122 and default IPv6 gateway 2001:1:1:1443::43F , but it still auto connects at startup and saves its configuration into /etc/sysconfig/network-scripts/ifcfg-eno49 .

Let us validate our configuration by pinging the gateway using eno49 interface

Again with the CLI looks like the steps are successful for me.

Modify existing IPv6 configuration

In the below command we are changing the IPv6 address of our interface eno49 from 2001:1:1:1443::433 to 2001:1:1:1443::434 , while the gateway remains the same.

Restart the eno49 interface

Next bring the the interface

Validate the new IP address for eno49 device

Check the connectivity from eno49 to it's gateway

Check the configuration file for eno49

I hope the steps from the article to configure IPv6 address on Linux (CentOS/RHEL 7/8) was helpful. Let me know your suggestions and feedback using the comment section.

Deepak Prasad

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to [email protected]

Thank You for your support!!

6 thoughts on “How to configure ipv6 address in Linux (RHEL / CentOS 7/8)”

One update for Centos 8. Change systemctl restart network to systemctl restart NetworkManager.service

I really love your website.. Very nice colors & theme. Did you make this amazing site yourself? Please reply back as I’m planning to create my very own site and want to know where you got this from or exactly what the theme is called. Kudos!

For us noobs: the network should be restarted after the address setup:

service network restart

Thanks for your feedback, I have updated the article 🙂

How did you get /122 when creating the new ip address and same gateway example?

This is the gateway and subnet provided by our network team.

Leave a Comment Cancel reply

Save my name and email in this browser for the next time I comment.

Notify me via e-mail if anyone answers my comment.

how to add ipv6 address in hosts file

We try to offer easy-to-follow guides and tips on various topics such as Linux, Cloud Computing, Programming Languages, Ethical Hacking and much more.

Recent Comments

Popular posts, 7 tools to detect memory leaks with examples, 100+ linux commands cheat sheet & examples, tutorial: beginners guide on linux memory management, top 15 tools to monitor disk io performance with examples, overview on different disk types and disk interface types, 6 ssh authentication methods to secure connection (sshd_config), how to check security updates list & perform linux patch management rhel 6/7/8, 8 ways to prevent brute force ssh attacks in linux (centos/rhel 7).

Privacy Policy

HTML Sitemap

ETC HOSTS File Syntax

Entries in the ETC HOSTS file use the following statement syntax:

Usage Notes

  • The maximum line length supported is 256 characters. If a line is greater than 256 characters, it is truncated to 256 characters and processed. If trace resolver is active, a warning message is issued.
  • The ETC HOSTS file can contain IPv4 and IPv6 addresses, but IPv4 mapped addresses are not supported. Each IP address can have up to 35 host names.
  • A comment is indicated by the # or ; character.
  • If you need loopback support, you must explicitly code a LOOPBACK entry for address 127.0.0.1 in the ETC HOSTS file.
  • Skip to content
  • Skip to search
  • Skip to footer

IPv6 Addressing and Basic Connectivity Configuration Guide, Cisco IOS XE Release 3S

Bias-free language.

The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.

IPv6 Addressing and Basic Connectivity

  • IPv6 Anycast Address
  • IPv6 Switching: Cisco Express Forwarding and Distributed Cisco Express Forwarding Support
  • Unicast Reverse Path Forwarding for IPv6
  • IPv6 Services: AAAA DNS Lookups over an IPv4 Transport
  • IPv6 MTU Path Discovery
  • ICMP for IPv6
  • IPv6 ICMP Rate Limiting
  • ICMP for IPv6 Redirect
  • IPv6 Neighbor Discovery
  • IPv6 Neighbor Discovery Cache
  • IPv6 Default Router Preference
  • IPv6 Stateless Autoconfiguration

Clear Contents of Search

Chapter: IPv6 Addressing and Basic Connectivity

Finding feature information, restrictions for implementing ipv6 addressing and basic connectivity, ipv6 for cisco software, large ipv6 address space for unique addresses, ipv6 address formats, ipv6 address output display, simplified ipv6 packet header, dns for ipv6, cisco discovery protocol ipv6 address support, ipv6 prefix aggregation, ipv6 site multihoming, ipv6 data links, dual ipv4 and ipv6 protocol stacks, configuring ipv6 addressing and enabling ipv6 routing, hostname-to-address mappings, displaying ipv6 redirect messages, example: ipv6 addressing and ipv6 routing configuration, example: dual-protocol stacks configuration, example: hostname-to-address mappings configuration, additional references, feature information for ipv6 addressing and basic connectivity.

Internet Protocol version 6 (IPv6) expands the number of network address bits from 32 bits (in IPv4) to 128 bits, which provides more than enough globally unique IP addresses for every networked device on the planet. The unlimited address space provided by IPv6 allows Cisco to deliver more and newer applications and services with reliability, improved user experience, and increased security.

Implementing basic IPv6 connectivity in the Cisco software consists of assigning IPv6 addresses to individual device interfaces. IPv6 traffic forwarding can be enabled globally, and Cisco Express Forwarding switching for IPv6 can also be enabled. The user can enhance basic connectivity functionality by configuring support for AAAA record types in the Domain Name System (DNS) name-to-address and address-to-name lookup processes, and by managing IPv6 neighbor discovery.

Information About IPv6 Addressing and Basic Connectivity

How to configure ipv6 addressing and basic connectivity, configuration examples for ipv6 addressing and basic connectivity.

Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the Feature Information Table at the end of this document.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/​go/​cfn . An account on Cisco.com is not required.

  • IPv6 packets are transparent to Layer 2 LAN switches because the switches do not examine Layer 3 packet information before forwarding IPv6 frames. Therefore, IPv6 hosts can be directly attached to Layer 2 LAN switches.
  • Multiple IPv6 global addresses within the same prefix can be configured on an interface; however, multiple IPv6 link-local addresses on an interface are not supported.

IPv6, formerly named IPng (next generation), is the latest version of the Internet Protocol (IP). IP is a packet-based protocol used to exchange data, voice, and video traffic over digital networks. IPv6 was proposed when it became clear that the 32-bit addressing scheme of IP version 4 (IPv4) was inadequate to meet the demands of Internet growth. After extensive discussion it was decided to base IPng on IP but add a much larger address space and improvements such as a simplified main header and extension headers. IPv6 is described initially in RFC 2460, Internet Protocol, Version 6 (IPv6) Specification , issued by the Internet Engineering Task Force (IETF). Further RFCs describe the architecture and services supported by IPv6.

The architecture of IPv6 has been designed to allow existing IPv4 users to transition easily to IPv6 while providing services such as end-to-end security, quality of service (QoS), and globally unique addresses. The larger IPv6 address space allows networks to scale and provide global reachability. The simplified IPv6 packet header format handles packets more efficiently. IPv6 prefix aggregation, simplified network renumbering, and IPv6 site multihoming capabilities provide an IPv6 addressing hierarchy that allows for more efficient routing. IPv6 supports widely deployed routing protocols such as Routing Information Protocol (RIP), Integrated Intermediate System-to-Intermediate System (IS-IS), Open Shortest Path First (OSPF) for IPv6, and multiprotocol Border Gateway Protocol (BGP). Other available features include stateless autoconfiguration and an increased number of multicast addresses.

The primary motivation for IPv6 is the need to meet the demand for globally unique IP addresses. IPv6 quadruples the number of network address bits from 32 bits (in IPv4) to 128 bits, which provides more than enough globally unique IP addresses for every networked device on the planet. By being globally unique, IPv6 addresses inherently enable global reachability and end-to-end security for networked devices, functionality that is crucial to the applications and services that are driving the demand for the addresses. Additionally, the flexibility of the IPv6 address space reduces the need for private addresses; therefore, IPv6 enables new application protocols that do not require special processing by border devices at the edge of networks.

IPv6 addresses are represented as a series of 16-bit hexadecimal fields separated by colons (:) in the format: x:x:x:x:x:x:x:x. Following are two examples of IPv6 addresses:

2001:DB8:7654:3210:FEDC:BA98:7654:3210

2001:DB8:0:0:8:800:200C:417A

IPv6 addresses commonly contain successive hexadecimal fields of zeros. Two colons (::) may be used to compress successive hexadecimal fields of zeros at the beginning, middle, or end of an IPv6 address (the colons represent successive hexadecimal fields of zeros). The table below lists compressed IPv6 address formats.

A double colon may be used as part of the ipv6-address argument when consecutive 16-bit values are denoted as zero. You can configure multiple IPv6 addresses per interfaces, but only one link-local address.

The loopback address listed in the table above may be used by a node to send an IPv6 packet to itself. The loopback address in IPv6 functions the same as the loopback address in IPv4 (127.0.0.1).

The unspecified address listed in the table above indicates the absence of an IPv6 address. For example, a newly initialized node on an IPv6 network may use the unspecified address as the source address in its packets until it receives its IPv6 address.

An IPv6 address prefix, in the format ipv6-prefix / prefix-length , can be used to represent bit-wise contiguous blocks of the entire address space. The ipv6-prefix must be in the form documented in RFC 2373 where the address is specified in hexadecimal using 16-bit values between colons. The prefix length is a decimal value that indicates how many of the high-order contiguous bits of the address comprise the prefix (the network portion of the address). For example, 2001:DB8:8086:6502::/32 is a valid IPv6 prefix.

When IPv6 or IPv4 command output displays an IPv6 address, a long IPv6 address can overflow into neighboring fields, causing the output to be difficult to read. The output fields were designed to work with the longest possible IPv4 address, which has 15 characters; IPv6 addresses can be up to 39 characters long. The following scheme has been adopted in IPv4 and IPv6 commands to allow the appropriate length of IPv6 address to be displayed and move the following fields to the next line, if necessary. The fields that are moved are kept in alignment with the header row.

The following example displays eight connections. The first six connections feature IPv6 addresses; the last two connections feature IPv4 addresses.

Connection 1 contains an IPv6 address that uses the maximum address length in the address field. Connection 2 shows the IPv6 address overflowing the address field and the following fields moved to the next line, but in alignment with the appropriate headers. Connection 3 contains an IPv6 address that fills the maximum length of the hostname and address fields without wrapping any lines. Connection 4 shows the effect of both the hostname and address fields containing a long IPv6 address. The output is shown over three lines keeping the correct heading alignment. Connection 5 displays a similar effect as connection 4 with a very long IPv6 address in the hostname and address fields. Note that the connection name field is actually truncated. Connection 6 displays a very short IPv6 address that does not require any change in the display. Connections 7 and 8 display short and long IPv4 addresses.

The basic IPv4 packet header has 12 fields with a total size of 20 octets (160 bits) (see the figure below). The 12 fields may be followed by an Options field, which is followed by a data portion that is usually the transport-layer packet. The variable length of the Options field adds to the total size of the IPv4 packet header. The shaded fields of the IPv4 packet header shown in the figure below are not included in the IPv6 packet header.

how to add ipv6 address in hosts file

The basic IPv6 packet header has 8 fields with a total size of 40 octets (320 bits) (see the figure below). Fields were removed from the IPv6 header because, in IPv6, fragmentation is not handled by devices and checksums at the network layer are not used. Instead, fragmentation in IPv6 is handled by the source of a packet and checksums at the data link layer and transport layer are used. (In IPv4, the UDP transport layer uses an optional checksum. In IPv6, use of the UDP checksum is required to check the integrity of the inner packet.) Additionally, the basic IPv6 packet header and Options field are aligned to 64 bits, which can facilitate the processing of IPv6 packets.

how to add ipv6 address in hosts file

The table below lists the fields in the basic IPv6 packet header.

Following the eight fields of the basic IPv6 packet header are optional extension headers and the data portion of the packet. If present, each extension header is aligned to 64 bits. There is no fixed number of extension headers in an IPv6 packet. The extension headers form a chain of headers. Each extension header is identified by the Next Header field of the previous header. Typically, the final extension header has a Next Header field of a transport-layer protocol, such as TCP or UDP. The figure below shows the IPv6 extension header format.

how to add ipv6 address in hosts file

The table below lists the extension header types and their Next Header field values.

IPv6 supports DNS record types that are supported in the DNS name-to-address and address-to-name lookup processes. The DNS record types support IPv6 addresses. IPv6 also supports the reverse mapping of IPv6 addresses to DNS names.

The table below lists the IPv6 DNS record types.

2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.1.c.0.y.y.y.y.e.f.f.3.ip6.int PTR www.abc.test

The Cisco Discovery Protocol IPv6 address support for neighbor information feature adds the ability to transfer IPv6 addressing information between two Cisco devices. Cisco Discovery Protocol support for IPv6 addresses provides IPv6 information to network management products and troubleshooting tools.

The aggregatable nature of the IPv6 address space enables an IPv6 addressing hierarchy. For example, an enterprise can subdivide a single IPv6 prefix from a service provider into multiple, longer prefixes for use within its internal network. Conversely, a service provider can aggregate all of the prefixes of its customers into a single, shorter prefix that the service provider can then advertise over the IPv6 internet (see the figure below).

how to add ipv6 address in hosts file

Multiple IPv6 prefixes can be assigned to networks and hosts. Having multiple prefixes assigned to a network allows that network to connect easily to multiple ISPs without breaking the global routing table (see the figure below).

how to add ipv6 address in hosts file

In IPv6 networks, a data link is a network sharing a particular link-local prefix. Data links are networks arbitrarily segmented by a network administrator in order to provide a multilevel, hierarchical routing structure while shielding the subnetwork from the addressing complexity of attached networks. The function of a subnetwork in IPv6 is similar to a subnetwork in IPv4. A subnetwork prefix is associated with one data link; multiple subnetwork prefixes may be assigned to the same data link.

The following data links are supported for IPv6: FDDI, Frame Relay PVC, Cisco High-Level Data Link Control (HDLC), PPP over Packet over SONET, ISDN, and serial interfaces.

The dual IPv4 and IPv6 protocol stack technique can be used to transition to IPv6. It enables gradual, one-by-one upgrades to applications running on nodes. Applications running on nodes are upgraded to make use of the IPv6 protocol stack. Applications that are not upgraded (for example, they support only the IPv4 protocol stack) can coexist with upgraded applications on a node. New and upgraded applications make use of both the IPv4 and IPv6 protocol stacks (see the figure below).

how to add ipv6 address in hosts file

One application program interface (API) supports both IPv4 and IPv6 addresses and DNS requests. An application can be upgraded to the new API and still use only the IPv4 protocol stack. The Cisco software supports the dual IPv4 and IPv6 protocol stack technique. When an interface is configured with both an IPv4 and an IPv6 address, the interface will forward both IPv4 and IPv6 traffic.

In the figure below, an application that supports dual IPv4 and IPv6 protocol stacks requests all available addresses for the destination hostname www.example.com from a DNS server. The DNS server replies with all available addresses (both IPv4 and IPv6 addresses) for www.example.com. The application chooses an address (in most cases, IPv6 addresses are the default choice), and connects the source node to the destination using the IPv6 protocol stack.

how to add ipv6 address in hosts file

Mapping Hostnames to IPv6 Addresses

Perform this task to assign IPv6 addresses to individual device interfaces and enable IPv6 traffic forwarding globally on the device. By default, IPv6 addresses are not configured and IPv6 routing is disabled.

1.     enable

2.     configure terminal

3.     interface type number

4.     Do one of the following:

  • ipv6 address ipv6-prefix / prefix-length eui-64
  • ipv6 address ipv6-address / prefix-length link-local
  • ipv6 enable

5.     exit

6.     ipv6 unicast-routing

A name server is used to track information associated with domain names. A name server can maintain a database of hostname-to-address mappings. Each name can map to one or more IPv4 addresses, IPv6 addresses, or both address types. In order to use this service to map domain names to IPv6 addresses, you must specify a name server and enable the DNS, which is the global naming scheme of the Internet that uniquely identifies network devices.

Cisco software maintains a cache of hostname-to-address mappings for use by the connect , telnet , and ping commands, related Telnet support operations, and many other commands that generate command output. This cache speeds the conversion of names to addresses.

Similar to IPv4, IPv6 uses a naming scheme that allows a network device to be identified by its location within a hierarchical name space that provides for domains. Domain names are joined with periods (.) as the delimiting characters. For example, Cisco is a commercial organization that is identified by a com domain name, so its domain name is cisco.com . A specific device in this domain, the FTP server, for example, is identified as ftp.cisco.com .

3.     ipv6 host name [ port ] ipv6-address1 [ ipv6-address2...ipv6-address4 ]

  • ip domain name [ vrf vrf-name ] name
  • ip domain lis t [ vrf vrf-name ] name

5.     ip name-server [ vrf vrf-name ] server-address1 [ server-address2...server-address6 ]

6.     ip domain-lookup

Specifies one or more hosts that supply name information.

  • Specifies one or more hosts (up to six) that can function as a name server to supply name information for DNS.

Enables DNS-based address translation.

  • DNS is enabled by default.

2.     show ipv6 interface [ brief ] [ type number ] [ prefix ]

3.     show ipv6 neighbors [ interface-type interface-number | ipv6-address | ipv6-hostname ] statistics

4.     show ipv6 route [ ipv6-address | ipv6-prefix / prefix-length | protocol | interface-type interface-number ]

5.     show ipv6 traffic

6.     show hosts [ vrf vrf-name | all | hostname | summary ]

7.     enable

8.     show running-config

In the following example, IPv6 is enabled on the device with both a link-local address and a global address based on the IPv6 prefix 2001:DB8:c18:1::/64. The EUI-64 interface ID is used in the low-order 64 bits of both addresses. Output from the show ipv6 interface command is included to show how the interface ID (260:3EFF:FE47:1530) is appended to the link-local prefix FE80::/64 of Gigabit Ethernet interface 0/0/0.

The following example enables the forwarding of IPv6 unicast datagrams globally on the device and configures Gigabit Ethernet interface 0/0/0 with both an IPv4 address and an IPv6 address:

The following example defines two static hostname-to-address mappings in the hostname cache, establishes a domain list with several alternate domain names to complete unqualified hostnames, specifies host 2001:DB8::250:8bff:fee8:f800 and host 2001:DB8:0:f004::1 as the name servers, and reenables the DNS service:

Related Documents

Standards and rfcs, technical assistance.

The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

Was this Document Helpful?

Feedback

Contact Cisco

login required

  • (Requires a Cisco Service Contract )

how to add ipv6 address in hosts file

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Chrome not using hosts file for IPv6 addresses since v73

After a recent Chrome update to v73, Chrome no longer uses my hosts file for IPv6 addresses. I have an entry like:

Trying to go to https://some-project.test results in ERR_NAME_NOT_RESOLVED . If I change the entry to 127.0.0.1 , the hostname resolves.

There's no problem with my hosts file entry. It's worked fine for months on previous versions of Chrome. I can ping some-project.test . Firefox works fine. I can even run a proxy like Fiddler and Chrome can access it that way. I just can't use Chrome directly.

Any suggestions for working around this?

Update: It seems dependent on the network I'm connected to. After moving from a public WiFi network back home, this is working again. I'm not sure how that's possible... shouldn't the hosts file override anything in DNS? And, shouldn't Chrome be using the system resolver anyway? Everything else on the system does and works fine.

Update 2: Back on home wired Ethernet... broken again. The problem is intermittent.

  • google-chrome

Brad's user avatar

  • I can confirm Chrome 73 absolutely uses the hosts file on Windows. There is some other unidentified reason you are unable to navigate to the .test domain you have configured. –  Ramhound Apr 4, 2019 at 22:12
  • @Ramhound It's using the hosts file for me, but not for IPv6 entries. It only works for IPv4 entries in the hosts file. Can you confirm that IPv6 hosts file entries are working for you in Chrome v73? Thanks. –  Brad Apr 4, 2019 at 22:14
  • According to stackoverflow.com/questions/42636711/… , Chrome doesn't like .test for some uses of the Hosts file. Try some-project.local instead, just to rule that out. –  Doug Deden Apr 4, 2019 at 22:26
  • @Brad - Then as somebody as specified it's the name of the domain your using not the fact it IPv6. Chrome 73 absolutely still uses the hosts file for both IPv4 and IPv6. Related –  Ramhound Apr 4, 2019 at 22:29
  • @DougDeden Using something.local or even just something doesn't work. Additionally, something.test works just fine for IPv4 addresses. It also worked fine for IPv6 addresses yesterday. –  Brad Apr 4, 2019 at 22:37

2 Answers 2

There is a know bug in Chrome which might be responsible for your problem: Issue 530482: Can't reach private IPv6 hosts on networks without global IPv6 connectivity .

The discussion in the bug report clarifies that Chrome launches an IPv6 probe to determine if there is IPv6 support, by checking with a remote address. If that IPv6 probe fails, Chrome will mask out any other IPv6 results, in effect disabling IPv6 and ignoring it forever.

The explanation is then that if IPv6 support is sketchy on the network, so that this single initial IPv6 probe done by Chrome fails, Chrome will just disable IPv6 resolving totally, including local IPv6 resolving from the hosts file.

A workaround mentioned is:

Add a network route to 2001:4860:4860::8888 . Doesn't have to actually be functional (could just drop requests to it). As long as Chrome can connect a UDP socket to the address, it will pass the heuristic checking IPv6-connectivity and allow AAAA DNS queries and IPv6 resolve results.

Other more limited workarounds are mentioned at the end of the bug report.

The bug report dates from 2015, but was still alive in May 2019, so it may perhaps be currently in process.

harrymc's user avatar

  • 1 Awesome! Thanks for digging this up. I'm sure that's going to be it. I'm going to experiment with some of the workarounds and see. Will accept the answer later if this works out. –  Brad Jun 24, 2019 at 16:54
  • 3 Yep, that worked. net sh , interface ipv6 , add route 2001:4860:4860::8888/128 interface=1 . –  Brad Jun 24, 2019 at 17:10
  • 1 @Brad - Thanks so much for this. I've been banging my head against the desk trying to get Chrome to connect to hosts via my office's IPv6 VPN. I added that route and voila, it worked instantly. –  oobayly Apr 2, 2020 at 14:19
  • For anyone else who finds this, the command is actually netsh , not net sh –  user125355 Jun 3, 2020 at 19:27
  • On linux, you can use sudo ip route add 2001:4860:4860::8888/128 dev lo . –  ki9 Apr 5, 2021 at 2:39

Your hosts file should be consistent, eg; localhost is 127.0.01 . Then some-project.test should also be available on 127.0.0.1 , and since the IPv6 address ::1 typically , and traditionally also points to localhost , and the IPv4 address 127.0.0.1 . As not all systems are necessarily IPv6 capable -- yes , even in this day, and age. :)

The problem, like localhost is that test is a TLD (just like .com).

My suggested hosts file:

See what I'm talking about? Some applications (and OSs) assume a localhost "host". So you may find you require an entry for it -- see; optional in the example above.

Lastly. Make sure your resolver flushes it's DNS cache. As to your system. It should see the change(s) immediately. But you should check first.

somebody's user avatar

  • My question has nothing to do with localhost. My system supports IPv6 just fine. All other applications on the system can resolve my hostnames just fine. Even Chrome works through a proxy on the same machine. And, there is absolutely nothing wrong with using .test ... it's the prescribed way, as indicated by RFC2606. Also, yes, I've flushed DNS caches and the Chrome resolver cache. –  Brad Jun 24, 2019 at 1:41
  • StackExchange speaks to a broad audience. As such, I chose to make my answer as detailed as necessary to answer not only your specific question. But also to others with a similar question. I can not presume to know the depth of knowledge that either you, or others posses. I can only infer . Which is not a very reliable position to take. What you didn't address in your reply. Is to whether my proposed hosts file did, or didn't work. I will not make an assumption in this regard. As that has at best, a 50% chance of being correct, as being incorrect. –  somebody Jun 24, 2019 at 3:07

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged windows-10 google-chrome ipv6 ..

  • The Overflow Blog
  • Spreading the gospel of Python
  • OverflowAI and the holy grail of search
  • Featured on Meta
  • Our Partnership with OpenAI
  • What deliverables would you like to see out of a working group?

Hot Network Questions

  • How to insert a pex segment with sharkbite/ push-to-fit connectors in an existing [copper] line
  • Can we build multiple models of PA within one the same model of ZFC?
  • A coin game - is it a group?
  • printf in Zsh does not shell escape exclamation mark
  • Why does classical physics not predict particles in the double-slit experiment to land in just two different locations?
  • What is this "/|\" symbol on the enclosures of various appliances?
  • Do I have room to add a 240V breaker in my panel?
  • Exclude certain filename suffixes when searching using glob qualifiers
  • Cubic splines in Cox model
  • Slow intersection of geopandas GeoDataFrames
  • Arguments for vs against filtering Internet Access to legal Websites on University Campus
  • How would time dilate for pioneers travelling to Alpha Centauri Cb?
  • Delta method vs actual expectation
  • Compute the degree of a string
  • Fubini-Study metric/form
  • Series Solution of Laplace Equation in Spherical Coordinates
  • Is this a school badge?
  • Legitimacy of an army of neotenous amphibians
  • Why the color is different in two pictures in similar conditions and setting?
  • What would military spies in 17th century Europe be looking for inside a city, before a siege?
  • Is spin a fundamental property of QFT?
  • What does SQL Server's Error Log actually log?
  • Do native speakers say "I'm [keen on/fond of] cloudy days"?
  • How many Friends are there in the circle?

how to add ipv6 address in hosts file

Change the hostname of your AL2 instance

When you launch an instance into a private VPC, Amazon EC2 assigns a guest OS hostname. The type of hostname that Amazon EC2 assigns depends on your subnet settings. For more information about EC2 hostnames, see Amazon EC2 instance hostname types in the Amazon EC2 User Guide for Linux Instances .

A typical Amazon EC2 private DNS name for an EC2 instance configured to use IP-based naming with an IPv4 address looks something like this: ip-12-34-56-78.us-west-2.compute.internal , where the name consists of the internal domain, the service (in this case, compute ), the region, and a form of the private IPv4 address. Part of this hostname is displayed at the shell prompt when you log into your instance (for example, ip-12-34-56-78 ). Each time you stop and restart your Amazon EC2 instance (unless you are using an Elastic IP address), the public IPv4 address changes, and so does your public DNS name, system hostname, and shell prompt.

This information applies to Amazon Linux. For information about other distributions, see their specific documentation.

Change the system hostname

If you have a public DNS name registered for the IP address of your instance (such as webserver.mydomain.com ), you can set the system hostname so your instance identifies itself as a part of that domain. This also changes the shell prompt so that it displays the first portion of this name instead of the hostname supplied by AWS (for example, ip-12-34-56-78 ). If you do not have a public DNS name registered, you can still change the hostname, but the process is a little different.

In order for your hostname update to persist, you must verify that the preserve_hostname cloud-init setting is set to true . You can run the following command to edit or add this setting:

If the preserve_hostname setting is not listed, add the following line of text to the end of the file:

To change the system hostname to a public DNS name

Follow this procedure if you already have a public DNS name registered.

For AL2: Use the hostnamectl command to set your hostname to reflect the fully qualified domain name (such as webserver.mydomain.com ).

For Amazon Linux AMI: On your instance, open the /etc/sysconfig/network configuration file in your favorite text editor and change the HOSTNAME entry to reflect the fully qualified domain name (such as webserver.mydomain.com ).

Reboot the instance to pick up the new hostname.

Alternatively, you can reboot using the Amazon EC2 console (on the Instances page, select the instance and choose Instance state , Reboot instance ).

Log into your instance and verify that the hostname has been updated. Your prompt should show the new hostname (up to the first ".") and the hostname command should show the fully-qualified domain name.

To change the system hostname without a public DNS name

For AL2: Use the hostnamectl command to set your hostname to reflect the desired system hostname (such as webserver ).

For Amazon Linux AMI: On your instance, open the /etc/sysconfig/network configuration file in your favorite text editor and change the HOSTNAME entry to reflect the desired system hostname (such as webserver ).

Open the /etc/hosts file in your favorite text editor and change the entry beginning with 127.0.0.1 to match the example below, substituting your own hostname.

You can also implement more programmatic solutions, such as specifying user data to configure your instance. If your instance is part of an Auto Scaling group, you can use lifecycle hooks to define user data. For more information, see Run commands on your Linux instance at launch and Lifecycle hook for instance launch in the AWS CloudFormation User Guide .

Change the shell prompt without affecting the hostname

If you do not want to modify the hostname for your instance, but you would like to have a more useful system name (such as webserver ) displayed than the private name supplied by AWS (for example, ip-12-34-56-78 ), you can edit the shell prompt configuration files to display your system nickname instead of the hostname.

To change the shell prompt to a host nickname

Create a file in /etc/profile.d that sets the environment variable called NICKNAME to the value you want in the shell prompt. For example, to set the system nickname to webserver , run the following command.

Open the /etc/bashrc (Red Hat) or /etc/bash.bashrc (Debian/Ubuntu) file in your favorite text editor (such as vim or nano ). You need to use sudo with the editor command because /etc/bashrc and /etc/bash.bashrc are owned by root .

Edit the file and change the shell prompt variable ( PS1 ) to display your nickname instead of the hostname. Find the following line that sets the shell prompt in /etc/bashrc or /etc/bash.bashrc (several surrounding lines are shown below for context; look for the line that starts with [ "$PS1" ):

Change the \h (the symbol for hostname ) in that line to the value of the NICKNAME variable.

(Optional) To set the title on shell windows to the new nickname, complete the following steps.

Create a file named /etc/sysconfig/bash-prompt-xterm .

Make the file executable using the following command.

Open the /etc/sysconfig/bash-prompt-xterm file in your favorite text editor (such as vim or nano ). You need to use sudo with the editor command because /etc/sysconfig/bash-prompt-xterm is owned by root .

Add the following line to the file.

Log out and then log back in to pick up the new nickname value.

Change the hostname on other Linux distributions

The procedures on this page are intended for use with Amazon Linux only. For more information about other Linux distributions, see their specific documentation and the following articles:

How do I assign a static hostname to a private Amazon EC2 instance running RHEL 7 or Centos 7?

Warning

To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions.

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of it.

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.

IMAGES

  1. How To Add An Ipv6 Address To The Hosts File

    how to add ipv6 address in hosts file

  2. How To Add An Ipv6 Address To The Hosts File

    how to add ipv6 address in hosts file

  3. How to add multiple IPv6 address for single host in /etc/hosts?

    how to add ipv6 address in hosts file

  4. IPv6 Address Configuration on Hosts

    how to add ipv6 address in hosts file

  5. IPv6 Address management of hosts

    how to add ipv6 address in hosts file

  6. How to add a device with IPv6 address ?

    how to add ipv6 address in hosts file

VIDEO

  1. Dynamic Addressing for IPv6 GUAs

  2. How to Successfully Migrate from IPv4 to IPv6

  3.  IPV6 CONFIGURATION IN EASY STEPS!

  4. Tutorial 10 IPv6 address configuration and IPv6 static routing Group Ly, Linh, Thoa, Thúy

  5. IPV6 CONFIGURATION USING CISCO PACKET TRACER

  6. IPv6 Link Local Address

COMMENTS

  1. How do I add IPv6 address into System32\drivers\etc\hosts?

    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.

  2. What is the proper way to display IPv6 Addresses in /etc/hosts

    Just follow the zero-compression rules and you should usually be fine. If you have a dual-homed address (where a host listens to both IPv4 and IPv6), you will have to enter it twice, once for the IPv4 address and once for the IPv6 address: ::1 localhost. 127.0.0.1 localhost.

  3. How to add multiple IPv6 address for single host in /etc/hosts?

    I did the same. I gave link local address. I tried to ping them. Only the first address gets pinging. Acutally I want to check whether my machine is doing address select. So it is necessary to receive multiple A values for a particular name. -

  4. IPv6 Address Configuration on Hosts

    1. Enable IPv6 on the network interface. 2. Set the network interface to use "DHCP" or "Automatic (DHCP)" address assignment mode. 3. Hosts will send DHCPv6 requests to the DHCPv6 server, which will respond with an assigned IPv6 address and other configuration details.

  5. linux

    Then I tried ping6 and it worked: dan@danny:~$ ping6 exampledomain.local. PING exampledomain.local(exampledomain.local) 56 data bytes. 64 bytes from exampledomain.local: icmp_seq=1 ttl=64 time=0.032 ms. If I replace ::1 with 127.0.0.1 in my hosts file, it works fine. I'm not sure if this is relevant but this is my Virtual Host configuration in ...

  6. How to Edit the hosts File on Windows 10 or 11

    Once Notepad is open, click on File > Open, and navigate to "C:\Windows\System32\drivers\etc". Notepad is set to look for ".txt" files by default, so you'll need to set it to look for "All Files" in the drop down menu instead. Then, click the hosts file and hit open. Once the hosts file is open, you can start adding lines to block websites.

  7. The ipv6 address in the hosts file cannot work

    Here are a few things you could try: Check the Format of the IPv6 Address in the Hosts File: The IPv6 address should be written in the hosts file in the same format as an IPv4 address. For example: 2001:db8:1::1 example.com www.example.com. Specify the Zone ID: If you're using a link-local address (starts with fe80), you need to specify the ...

  8. What's the use for the special ipv6 addresses in /etc/hosts?

    fe00::0: Can be compared to the Class E address space in IPv4, therefore it's in the reserved scope; reserved for future use. ff02::1: The group of all IPv6 nodes (including the routers) in the Link-local scope, whose IPv4-equivalent is 224.0.0.1. ff02::2: The group of all IPv6 routers in the Link-local scope, whose IPv4-equivalent is 224.0.0.2.

  9. IPv6 scope ID in /etc/hosts

    If you get IPv6 addresses from your ISP then use those, otherwise generate your own ULA prefix. In short: link-local addresses in /etc/hosts don't work, use routable addresses instead. I'm not sure I'll be able to change the device's IPv6 address, because it's actually an Android phone.

  10. networking

    I'm trying to ssh to a server on my LAN via ipv6. in order to save time and not to type ssh fe80::301b:7acc:bc33:a191%wlp1s0 I tried to define the host in /etc/hosts. The problem is that with link local addresses you need to specify the interface, but when I try to add. fe80::301b:7acc:bc33:a191%wlp1s0 ubuntu. and then run ssh ubuntu. I get

  11. How do I assign IPv6 addresses manually?

    If you wish, you would in Windows set a computer's static IPv6 inside Start > Network > Network and Sharing Center > Change Adapter Setting , right-click on the Ethernet connection IPv6 and choose Properties, right-click "Internet Protocol Version 6 (TCP/IPv6)" and click on Properties, the set "Use the following IPv6 address".

  12. How do I add an additional IPv6 address to /etc/network/interfaces?

    It would appear (tested with ifupdown version 0.7.53.1) that we can add several iface eth0 inet6 stanzas to the interfaces file, which is more declarative than the accepted answer. The following code instructs the ifupdown suite to use stateless autoconfiguration and two additional static IPv6 addresses for the eth0 network interface:. iface eth0 inet6 auto iface eth0 inet6 static address 2001 ...

  13. What is IPV6 for localhost and 0.0.0.0?

    In IPv4 it is never routed. The equivalent in IPv6 is the :: address (long form 0:0:0:0:0:0:0:0) ... which is also never routed. The 0.0.0.0 and :: addresses are reserved to mean "any address". So, for example a program that is providing a web service may bind to 0.0.0.0 port 80 to accept HTTP connections via any of the host's IPv4 addresses.

  14. Setting up IPv6 interface on a host

    Setting up IPv6 to be configured on hosts at every restart. The IPv6 hosts settings configured in Step 1. Setting up hosts for IPv6 are deleted when you restart the machine. To enable IPv6 hosts functionality every time you restart the machine, follow this procedure. Open the /etc/rc.tcpip file in a text editor.

  15. How to configure ipv6 address in Linux (RHEL / CentOS 7/8)

    Select Edit a Connection and click on Ok. Next look out for your Ethernet card on which you wish to configure IPv6 address. If your NIC card does not appear on the list then you can add a new device. Since for me my device ( eno50) exists, so I will select the device and select Edit.

  16. How to add an IPv6 address?

    Therefor the CIDR notation for a host/interface address is always /64. The scope of an IPv6 host/interface address is one of the following: Local-Link: An address out of the fe80::/64 range. As the prefix is always fe80:0:0:0, there is no distinct separation of layer 3 networks and therefore this address is only used for communication in the ...

  17. How can I specify IP and ports for a hostname in the Windows hosts file?

    Simply use IP addresses without ports. Example: Then, to access 192.168.2.50:5555 from your browser (or other program): The hosts file can be found at: Linux /etc/hosts. Windows: C:\Windows\System32\drivers\etc\hosts. It will be helpful to add both path and the name of the file to be edited.

  18. ETC HOSTS File Syntax

    The ETC HOSTS file can contain IPv4 and IPv6 addresses, but IPv4 mapped addresses are not supported. Each IP address can have up to 35 host names. A comment is indicated by the # or ; character. If you need loopback support, you must explicitly code a LOOPBACK entry for address 127.0.0.1 in the ETC HOSTS file.

  19. IPv6 Addressing and Basic Connectivity Configuration Guide ...

    An IPv6 address prefix, in the format ipv6-prefix / prefix-length, can be used to represent bit-wise contiguous blocks of the entire address space.The ipv6-prefix must be in the form documented in RFC 2373 where the address is specified in hexadecimal using 16-bit values between colons. The prefix length is a decimal value that indicates how many of the high-order contiguous bits of the ...

  20. Chrome not using hosts file for IPv6 addresses since v73

    The explanation is then that if IPv6 support is sketchy on the network, so that this single initial IPv6 probe done by Chrome fails, Chrome will just disable IPv6 resolving totally, including local IPv6 resolving from the hosts file. A workaround mentioned is: Add a network route to 2001:4860:4860::8888.

  21. How to use IPv6 in enterprise networks

    On a Windows system, type the following: ping -6 <IPv6-address>. To check the network path to a remote system on Linux and macOS, type either of the following: $ traceroute6 <IPv6-address>. $ traceroute -6 <IPv6-address>. Windows administrators can use the tracert command to trace IPv6 address routes, as seen here:

  22. windows

    4. Apply this trick. First you need IP address of url you want to redirect to. Lets say you want to redirect to stackoverflow.com To find it, use the ping command in a Command Prompt. Type in: ping stackoverflow.com. into the command prompt window and you'll see stackoverflow's numerical IP address.

  23. Change the hostname of your AL2 instance

    webserver.mydomain.com. To change the system hostname without a public DNS name. For AL2: Use the hostnamectl command to set your hostname to reflect the desired system hostname (such as webserver ). [ec2-user ~]$ sudo hostnamectl set-hostname webserver.localdomain.