• Articles Automation Career Cloud Containers Kubernetes Linux Programming Security

Configuring an IPv6 address in Red Hat Enterprise Linux 7 and 8

%t min read | by Valentin Bajrami (Sudoer alumni)

Configuring an IPv6 Address in RHEL 7 and 8

As I mentioned in What you need to know about IPv6 , different methods exist to configure an IPv6 address on a machine. We will mainly focus on configuring an IPv6 address on a Red Hat Enterprise Linux (RHEL) 7 and 8 systems and briefly explain different assignment methods.

[Want to try out Red Hat Enterprise Linux?  Download  it now for free.]

Configuring IPv6 on RHEL 7 and 8

A Red Hat Enterprise Linux system is configured to obtain an IPv6 address automatically. These are the lines in the configuration file where the magic happens (I am adding some explanation to each line):

For more information on what those connection settings do, run:

Stateless address autoconfiguration (SLAAC)

If the IPV6_AUTOCONF variable is set to yes , then the SLAAC method is used to configure the host’s IPv6 address by using the Neighbor Discovery Protocol (NDP) . The technique applied here is the one explained in the previous article’s Multicast section, where there is an exchange of client solicitation and router advertisement ICMPv6 messages.

We use the term stateless because there is no service to keep track of what IPv6 addresses have been assigned to clients. Rather, the IPv6 address is composed with a technique called the Extended Unique Identifier (EUI-64) where 16 bits are added to the Media Access Control (MAC) address (which has 48 bits), thus creating a globally unique IPv6 address.

To use DHCPv6, the following should appear within the configuration file:

If the DHCPv6 variable is set to yes , then a client obtains an IP address from the DHCPv6 pool. The DHCPv6 service then keeps track of what IPv6 addresses are assigned to what clients. Among the IP address, other information like DNS servers, lease time, hostnames, and other attributes are pushed to the client. An administrator must configure the IPv6 address pool to be able to serve clients.

It is also possible (but not recommended) to configure an IPv6 address manually. Manual configuration requires a lot of effort, is error-prone, and it’s hard to keep track of what IPv6 addresses are assigned to what clients. On a large network, a DHCPv6 server is preferable for performing this task.

To configure IPv6 on Red Hat Enterprise Linux 7 and 8 manually, your version of the following needs to added to the configuration file:

Or, you can manually configure through NetworkManager:

Testing IPv6 connectivity

To test IPv6 connectivity, we can run a ping6 on www.redhat.com :

While the ping was running, I ran Wireshark in the background to see what’s happening under the hood. Here is the ICMPv6 request packet (sent by me) and the ICMPv6 reply packet I received back.

ICMPv6 request

Icmpv6 reply.

Note that many organizations choose to block ping requests for security reasons, so it’s generally a good idea to try pinging several sites when testing your connectivity.

Ethernet cables

Valentin Bajrami

Valentin is a system engineer with more than six years of experience in networking, storage, high-performing clusters, and automation. He is involved in different open source projects like bash, Fedora, Ceph, FreeBSD and is a member of Red Hat Accelerators. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the red hat developer program., related content.

A blue cable plugged into a green Raspberry Pi

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.

Why do I get multiple global IPv6 addresses listed in ifconfig?

This could be a no-brainer, but when I look in ifconfig it lists two different global IPv6 addresses. Is there a reason why I'm getting two assigned? Shouldn't I just get a single address?

Stephen RC's user avatar

  • It doesn't seem to be the case anymore. in 14.04, 15.04, debian 8.2 or even windows 10. You should get just one global IPV6 adresse now –  vigilian Sep 30, 2015 at 13:04
  • @MichaelHampton may I ask why? –  hdl May 13, 2016 at 14:14
  • 3 @hdl Because ifconfig is deprecated for many years. It is not even included by default in modern Linux distributions (but it can still be installed, for a while anyway). You will need to convert, because sooner or later ifconfig will go away completely. –  Michael Hampton May 13, 2016 at 14:15
  • Oh, ok, I've done a quick search and seen that it is being (very slowly) deprecated indeed, but only on Linux distros. –  hdl May 13, 2016 at 15:10
  • 5 2400:4000:CAFE: ... That's beautiful –  KevinOrr Sep 29, 2016 at 15:39

The address containing ea9a:8fff:fe6d:6aaa is an automatically configured address based on your Ethernet MAC address. You can recognize them because they contain ...ff:fe... in the middle of the last 64 bits. The rest of the bits is derived from your MAC address. Compare

Because some people are worried that making your MAC address visible on the internet would cause content / website providers to track your behavior by your mac address (and such behavior wouldn't surprise me, although they can more easily track you with cookies, browser-local storage etc etc etc) the privacy extensions were introduced.

The address containing 48c8:f262:ebe8:297b is such an address. That is the address that will be used to connect to websites and other outgoing connections. It will change over time to maintain your privacy and make you harder to track.

Both addresses are available for you to use. Outgoing connections will use the privacy address, unless configured otherwise. You can also still receive incoming connections on the MAC address based IPv6 address. This is all done to give you lots of flexibility. If you want you could add even more addresses.

PS: another tool to see IPv6 addresses is

It will show you a bit more detail. You will see the word temporary after the privacy address, which indicates what it is.

Sander Steffann's user avatar

  • 1 Which one will be used as the source address? How does the OS determine? –  Felipe Alvarez May 20, 2016 at 13:42
  • 2 The default source address is determined according to tools.ietf.org/html/rfc6724 . Usually the most recently generated temporary address will be used –  Sander Steffann May 21, 2016 at 21:14
  • 1 Are temporary addresses re-assigned after the DHCP lease runs out? If so, how do you handle constantly changing IPs at the firewall? Do you have to open the whole DHCP range of IPs? –  DanMan Mar 31, 2018 at 15:43
  • 1 There is no DHCP involved, this is SLAAC. If your security depends on the addresses of individual devices on a shared LAN then it's insecure anyway. –  Sander Steffann Mar 31, 2018 at 19:06

You must log in to answer this question.

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

  • The Overflow Blog
  • How do mixture-of-experts layers affect transformer models?
  • What a year building AI has taught Stack Overflow
  • Featured on Meta
  • New Focus Styles & Updated Styling for Button Groups
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network
  • AI-generated content is not permitted on Ask Ubuntu
  • Let's organize some chat workshops

Hot Network Questions

  • Is infinity a concept or a word empty of meaning?
  • Why do you need to set aside 10 cards when setting up the game?
  • "The sight of her rendered him speechless." — Why place "her" after nouns? Why not say just "Her sight rendered him speechless."?
  • FindMaximum, error in solution
  • My workmate wants me to teach her art but I would prefer to maintain a work-only boundary
  • Indexing array of colors and numbers
  • Can a monophonic melody have harmony?
  • Did any processor implement an integer square root instruction?
  • FTIR Spectra: Did I synthesize ethyl gallate from gallic acid?
  • Draw a Fibonacci Swoosh
  • Ensuring IEEE 754 Compliance and Numerical Precision in C++ HPC Projects
  • Comparison of clocks running at different heights in a gravitational field
  • How to list all file in a path with absolute path and spaces in a script
  • How to derive the average current drawn by the op amp in the given circuit?
  • What is the "shorthand" (or colloquialism) to say "anything in order not to do something/this or that"?
  • If a I rent a car in Zurich, Switzerland, can I return the car in Lauterbrunnen?
  • Where do root systems arise in mathematics?
  • Can I safely refinish 250 gallon propane tank?
  • Baseball caught: Ownership? Can one leave?
  • Multivariate chain rule (again) for differential forms
  • Interpreting the output of badblocks: when is it time to replace the microsd card?
  • How can tiny MOSFETs be rated for relatively high current?
  • Is there a mathematical formula or a list of frequencies (Hz) of notes?
  • What kind of alien technology would make space colonization viable?

how to add ipv6 address using ifconfig

  • Shell Scripting
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Linux Commands

File and Directory Manipulation

  • ls Command in Linux
  • How to Change the Directory in Linux | cd Command
  • How to Display Current Working Directory in Linux | pwd Command
  • How to Create Directory in Linux | mkdir Command
  • rm command in Linux with examples
  • How to Copy Files and Directories in Linux | cp Command
  • How to Move File in Linux | mv Command
  • How to Create an Empty File in Linux | Touch Command
  • How to View the Content of File in Linux | cat Command
  • grep command in Unix/Linux

File Operations and Compression

  • How to Find a File in Linux | Find Command
  • How to Compress Files in Linux | Tar Command
  • Gzip Command in Linux
  • gunzip command in Linux with examples
  • ZIP command in Linux with examples
  • How to Install Zip and Unzip in Linux?
  • How to Make Script Executable in Linux | chmod Command
  • How to Change File Ownership in Linux | chown Command
  • chgrp command in Linux with Examples
  • How to List Running Processes in Linux | ps Command

Network and Connectivity

  • How to Monitor System Activity in linux | top Command
  • How to Kill a Process in Linux | Kill Command

How to Find Your IP Address in Linux | ifconfig Command

  • How to Check Network Connectivity in Linux | ping Command
  • How do I use SSH to connect to a remote server in Linux | ssh Command
  • How to Securely Copy Files in Linux | scp Command
  • Wget command in Linux/Unix
  • curl command in Linux with Examples
  • How to Compare Files Line by Line in Linux | diff Command
  • Head command in Linux with examples

Text Processing and Manipulation

  • Tail command in Linux with examples
  • How to sort lines in text files in Linux | sort Command
  • AWK command in Unix/Linux with examples
  • Sed Command in Linux/Unix with examples
  • cut command in Linux with examples
  • tr command in Unix/Linux with examples
  • echo command in Linux with Examples
  • export command in Linux with Examples
  • source Command in Linux with Examples
  • How to Display Command History in Linux | history Command

Help and Information

  • apropos command in Linux with Examples
  • info command in Linux with Examples
  • How to Create and Use Alias Command in Linux
  • uname command in Linux with Examples
  • df command in Linux with Examples
  • du command in Linux with examples
  • How to Mount File System in Linux | mount Command
  • ln command in Linux with Examples

System Administration and Control

  • How to Display Path of an Executable File in Linux | Which Command
  • whereis command in Linux with Examples
  • locate command in Linux with Examples
  • How to Display and Set Date and Time in Linux | date Command
  • cal command in Linux with Examples
  • How to Start, Stop and Restart Services in Linux Using systemctl Command
  • shutdown command in Linux with Examples

User and Group Management

  • init command in Linux with examples
  • How to add User in Linux | useradd Command
  • usermod command in Linux with Examples
  • How to Delete User in Linux | userdel Command
  • How to Create a new group in Linux | groupadd command
  • groupmod command in Linux with examples
  • How to Delete a Group in Linux | groupdel command
  • How to Change User Password in Linux | passwd Command
  • Difference Between su and su - Command in Linux

Privilege and Security Management

  • chroot command in Linux with examples
  • file command in Linux with examples
  • hexdump command in Linux with examples
  • wc command in Linux with examples
  • tee command in Linux with examples
  • script command in Linux with Examples
  • How To Generate SSH Key With ssh-keygen In Linux?

Process Management and Control

  • 'crontab' in Linux with Examples
  • at Command in Linux with Examples
  • nohup Command in Linux with Examples
  • bg command in Linux with Examples
  • fg command in Linux with examples
  • Process Control Commands in Unix/Linux
  • Shell Script to Demonstrate Wait Command in Linux

Data Backup and Synchronization

  • rsync command in Linux with Examples
  • screen command in Linux with Examples
  • uniq Command in Linux with Examples

Knowing your IP address is fundamental for network administration, troubleshooting, and various Linux system tasks. In this article, we will explore several methods to find your IP address in a Linux environment. Whether you are a seasoned Linux user or just getting started, understanding these methods will empower you to navigate and manage your network effectively.

How to Find Your IP Address in Linux Using `ifconfig Command:

ifconfig (interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning. Also, this command is used to assign the IP address and netmask to an interface or to enable or disable a given interface.

Syntax of `ifconfig`Command in Linux

  • [ interface ] is the network interface you want to configure or display information for (e.g., eth0, wlan0).
  • [ options ] are various command-line options that can be used to modify the behavior of ifconfig.

Newer versions of some Linux distributions don’t have ifconfig command pre-installed. So, in case, there is an error “ifconfig: command not found” , Then execute the following command to install ifconfig.

Installing net-tools in Linux

For Debian, Ubuntu, and related Linux distributions.

For CentOS or RPM(RedHat Package Manager) based Linux

This will install `ifconfig` along with some other networking commands like arp, route, ipmaddr.

Finding Your Ip Address in Linux Using `ifconfig` Command

To view information about all network interfaces on your Linux system, simply execute the following command:

Finding IP Address in Linux Using `ifconfig`

Finding IP Address in Linux Using `ifconfig`

This command will provide a comprehensive list of all network interfaces along with their respective IP addresses, MAC addresses, and other relevant details.

Options available in `ifconfig` Command in Linux

Here are the most commonly used option in ifconfig command in linux

What is Public and Private IP in Linux

In the realm of networking, both in Linux and other operating systems, IP addresses are categorized as either public or private. These designations are crucial for facilitating communication between devices on a network, whether it’s the global internet or a local intranet. Let’s delve into the distinctions between public and private IP addresses in Linux.

1) How to Find Your Public IP Addresses in Linux:

A public IP address is a globally unique identifier assigned to a device on the internet. It serves as the address by which other devices on the internet can find and communicate with it. Public IP addresses are assigned by the Internet Assigned Numbers Authority (IANA) to Internet Service Providers (ISPs) and other organizations that control access to the global internet.

In Linux, you can determine the public IP address of a system by using external services or commands like curl or wget to query a web service. For example:

This command retrieves your public IP address from a web service.

Public IP addresses are essential for servers, websites, and other devices that need to be directly accessible from the internet. They are globally routable, meaning they can be reached from any location on the internet.

Different Ways to Find Your Public IP Address in Linux

1) Using `wget` with `ifconfig.me` to Find Your IP Address in Linux

Similar to curl , this uses the ifconfig.me service to fetch your public IP address.

Using `wget` with `ifconfig.me` to Find Your IP Address in Linux

Using `wget` with `ifconfig.me` to Find Your IP Address in Linux

2) Using `dig` with `resolver1.opendns.com` to Find Your IP Address in Linux

This command uses the OpenDNS resolver to query your public IP address.

Using `dig` with `resolver1.opendns.com` to Find Your IP Address in Linux

Using `dig` with `resolver1.opendns.com` to Find Your IP Address in Linux

3) Using `curl` with `icanhazip.com`to Find Your IP Address in Linux

This command queries the icanhazip.com service to obtain your public IP address.

 Using `curl` with `icanhazip.com`to Find Your IP Address in Linux

Using `curl` with `icanhazip.com`to Find Your IP Address in Linux

4) Using `wget` with `icanhazip.com` to Find Your IP Address in Linux

Similar to the curl command, this uses the icanhazip.com service to fetch your public IP address.

 Using `wget` with `icanhazip.com` to Find Your IP Address in Linux

Using `wget` with `icanhazip.com` to Find Your IP Address in Linux

5) Using host with dns.google to Find Your IP Address in Linux

This command utilizes the DNS service provided by Google to resolve your public IP address.

Using host with dns.google to Find Your IP Address in Linux

Using host with dns.google to Find Your IP Address in Linux

2) How to Find Your Private IP Addresses in Linux:

Contrastingly, private IP addresses are used within a private network and are not directly accessible from the internet. These addresses are defined in reserved address ranges specified by the Internet Engineering Task Force (IETF) in RFC 1918. The commonly used private IP address ranges are:

  • 10.0.0.0 to 10.255.255.255 (10.0.0.0/8)
  • 172.16.0.0 to 172.31.255.255 (172.16.0.0/12)
  • 192.168.0.0 to 192.168.255.255 (192.168.0.0/16)

These addresses are intended for use in local networks, such as home or corporate intranets. Devices within the same private network can communicate with each other using these private IP addresses, but they rely on a mechanism called Network Address Translation (NAT) to access the internet through a shared public IP address.

In Linux, you can view the private IP addresses of your system using the ifconfig or ip addr commands. For example:

Different Ways to Find Your Private IP Address in Linux

1) Using `hostname` to Find Your IP Address in Linux

The -I option with the hostname command can be used to display the private IP address of your machine.

Using hostname to Find Your IP Address in Linux

Using hostname to Find Your IP Address in Linux

2) Using `nmcli` (NetworkManager command-line tool) to Find Your IP Address in Linux

If you’re using NetworkManager, this command filters out IPv4 addresses associated with your network interfaces.

Using nmcli to Find Your IP Address in Linux

Using nmcli to Find Your IP Address in Linux

3) Using `awk` with `ifconfig` to Find Your IP Address in Linux

This command uses the awk tool to filter and print only the private IP addresses from the ifconfig output.

Using `awk` with `ifconfig` to Find Your IP Address in Linux

Using `awk` with `ifconfig` to Find Your IP Address in Linux

4) Using `grep` with `ip` to Find Your IP Address in Linux

This command uses grep with Perl-compatible regular expressions to extract private IP addresses from the ip command output.

Using `grep` with `ip` to Find Your IP Address in Linux

Using `grep` with `ip` to Find Your IP Address in Linux

5) Using `ss` (socket statistics) command to Find Your IP Address in Linux

This complex command lists the IP addresses to which the system is listening for incoming connections.

Using `ss` (socket statistics) command to Find Your IP Address in Linux

Using `ss` (socket statistics) command to Find Your IP Address in Linux

Frequently Asked Question

1) how can i quickly check my ip address in linux using the command line.

You can use the ` ip` command with the ` address` option. Open a terminal and type ` ip address` or ` ip a` , and look for the line starting with “inet” followed by your IP address.

2) How to specificity display only the public IP address in Linux?

You can use a command like ` curl` or ` wget` to fetch your public IP from a web service. For example: curl ifconfig.me or wget -qO- ifconfig.me

3) Can I find my IP address in Linux using GUI tools?

Yes, many Linux distributions come with network management tools that provide a graphical interface. For example, in Ubuntu, you can use the network settings or system monitor to find your IP address.

4) How do I find the IP address of a specific network interface in Linux?

You can use the ` ifconfig` or ` ip address` command followed by the interface name. For example: ifconfig eth0 or ip address show eth0 This will display details, including the IP address, for the specified interface.

5) How can I display detailed information about all network interfaces in Linux?

You can use the ` ifconfig` or ` ip address` show command to display comprehensive information about all network interfaces. For example: ifconfig or ip address show It will display details such as IP addresses, netmasks, and other network-related information for all available interfaces on your Linux system.

In this article, we’ve explored how to find your IP address in Linux using the ifconfig command. We also discuss what is private and public IP address and how to display both of the IP Address .This essential skill is crucial for effective network management. Whether you’re a seasoned Linux user or a beginner, understanding these simple commands empowers you to navigate and control your network effortlessly.

Please Login to comment...

Similar reads.

author

  • linux-command
  • Linux-networking-commands
  • 10 Best Todoist Alternatives in 2024 (Free)
  • How to Get Spotify Premium Free Forever on iOS/Android
  • Yahoo Acquires Instagram Co-Founders' AI News Platform Artifact
  • OpenAI Introduces DALL-E Editor Interface
  • Top 10 R Project Ideas for Beginners in 2024

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

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

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

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 reach out to him on his LinkedIn profile or join on Facebook page.

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)”

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.

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

service network restart

Thanks for your feedback, I have updated the article 🙂

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!

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

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.

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 to correctly configure IPv6 with OpenVPN?

Trying to find the OpenVPN configuration which suits my needs I made this script to help myself during the installation on a CentOS system. My server config file actually looks like this:

It actually works perfectly, but as I rented a server @ liteserver.nl and they gave me a /64 subnet, I was trying to configure OpenVPN server to give one IPv6 address to each client to access the internet with a dedicated IP. So I followed the instructions on this page to setup IPv6 for internal usage. And that page contains instructions for a server with a public IPv6 which is 2001:db8:0:abc::100/64 and a routed IPv6 subnet (which I think is probably what liteserver.nl gave me) which is 2001:db8:0:123::/64. Paying no attention about the sample addresses difference I configured my server with a public IPv6 (2a04:52c0:101:xxx::100/64) and I gave to the OpenVPN clients the whole subnet they gave me ( 2a04:52c0:101:xxx::/64), here's how my server.conf actually looks like:

So as IPv4 connectivity works, IPv6 are assigned correctly, but I cannot access the internet using IPv6 (according to test-ipv6.com ) I'm asking myself if I need two /64 subnets (one for the private OpenVPN network and one for the VPN server itself, so for outgoing connections) to correctly configure this or if I missed something...anyway what I'd like to get is a VPN server with private IPv4 and IPv6 connectivity and with a public IPv4 and one or more IPv6 address(es). Please tell me if that's possible and how to do that. I'm really hoping that someone could help me.

Thanks in advance.

Community's user avatar

  • +1 For incrementing exit codes in your script.. :) –  gxx Aug 25, 2017 at 15:44
  • I've never tried using OpenVPN IPv6 pushing options, but you have another way: use tap in layer 2 and distribute routes and network adapter settings via DHCP. I've never tried it either though. It works fine with v4. –  Michal Sokolowski Aug 25, 2017 at 16:20
  • @MichalSokolowski First of all, thanks for your answer. I though about that, but I would like to achieve this using only OpenVPN if possible...I read that OpenVPN is now fully supporting IPv6, so there must be a way. Anyway, again, thanks for interestment. –  Phonic Mouse Aug 26, 2017 at 11:18
  • @MichalSokolowski I would also really prefer tun rather than tap. –  Phonic Mouse Aug 26, 2017 at 11:22
  • 1 Having 2 /64 subnets is the best option, if that's available I'd go that route, you're config looks fine otherwise, jacobdevans.com/ipv6-openvpn-tunneling-with-asus-merlinwrt More on splitting a single /64 into (2) /65's community.openvpn.net/openvpn/wiki/… –  Jacob Evans Aug 28, 2017 at 12:47

2 Answers 2

I think you need to proxy NDP requests to your public IPv6 addresses. I haven't tested this personally, but this is the theory:

Your ISP will send traffic for your whole IPv6 network (2a04:52c0:101:xxx::/64) to your server. This means that, when someone on the Internet tries to connect to an IP address inside that network, the traffic will be sent to your server, expecting it knows how to handle it.

Your server has an address in that network (2a04:52c0:101:xxx::100). When it receives traffic to another address, it ignores it, because it's not an address that it can identify with. So, the traffic that goes to the devices that get an IP address from that network assigned by OpenVPN stops dead on your server.

To make your server realize that it has to get that traffic and sent it "down" through OpenVPN, you have two options: use a different IPv6 network for your OpenVPN clients (so traditional routing works) or proxy the traffic to your current network. The first is the best option, but your ISP may not assign you more than one /64; the latter is NDP proxying, akin to ARP proxying in IPv4.

Using NDP proxying, your server will get the traffic for addresses not its own and resend it to the clients with that same IP address connected through OpenVPN. You will have to do this for every IP address in your network that belongs to an OpenVPN client.

There are other answers in the StackExchange network that cover this in detail:

  • IPv6 routing problem
  • How to asign full IPv6 subnet to OpenVPN client

Please, check those answers for a more thorough explanation.

rsuarez's user avatar

  • So I have to configure standard private IPv6 networking inside the VPN (with a random IPv6 subnet?), the whole public /64 subnet to my VPN host and then redirect all IPv6 requests from inside the VPN to my public interface? –  Phonic Mouse Aug 26, 2017 at 10:47
  • 1 Please put the main information in your answer. If the link gets broken, your answer won't be that helpful anymore. –  gxx Aug 26, 2017 at 10:48
  • @gf_ I think it would be useful, as I don't know where to look with the current link. –  Phonic Mouse Aug 26, 2017 at 11:20
  • I've edited my answer to elaborate a little more. Please, ask if you need more help. –  rsuarez Aug 28, 2017 at 12:03
  • @rsuarez Many many thanks for your answer. I think that NDP proxying is not what I was looking for as I have to add a rule for each address. So as my ISP does not provide me a second subnet I have to find another way. So can I setup the public subnet to my public interface and a random ipv6 subnet for private ipv6 networking inside the VPN? –  Phonic Mouse Aug 28, 2017 at 14:01

The solution is very simple (though it took 6 hours to figure it out). Manual is here: Splitting a single routable IPv6 netblock

  • Remove existing ipv6: ifconfig eth0 inet6 del 2a04:52c0:101:xxx::x/64
  • Add the same inet6 with /65 prefix: ifconfig eth0 inet6 add 2a04:52c0:101:xxx::x/65
  • Change the line in your config to: server-ipv6 2a04:52c0:101:xxx:8000::/65

user3599934's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged openvpn ipv6 ..

  • The Overflow Blog
  • How do mixture-of-experts layers affect transformer models?
  • What a year building AI has taught Stack Overflow
  • Featured on Meta
  • New Focus Styles & Updated Styling for Button Groups
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network

Hot Network Questions

  • Can possessive pronouns ever come on their own after a noun?
  • FindMaximum, error in solution
  • Why do pilots have control of so many functions that seem like they should be always-on?
  • Emulate Jelly's tie-scan
  • Does the acetic acid in vinegar oxidize significantly?
  • Is there a mathematical formula or a list of frequencies (Hz) of notes?
  • Wife and I would like to travel throughout the Schengen area for more than 90 days while my Portuguese citizenship application is in process
  • How can I design a benevolent, all-powerful deity, and still have a society with day-to-day issues?
  • Why isn't Syria treating Israel's attack in Damascus as an open act of war?
  • Is there a way to take away an action in D&D 5e?
  • My workmate wants me to teach her art but I would prefer to maintain a work-only boundary
  • Geometry Nodes: Array items and rotate randomly on a 90° basis
  • Who was the first person to get a more accurate measure of the earth's circumference than Eratosthenes?
  • Is the subscheme parametrizing the k-th degeneracy loci Cohen-Macaulay?
  • Adding two numbers in Tally marks
  • Is the Umbrage Hill Quest in Dragon of Icespire Peak likely to kill 1st-level PCs?
  • Plumbing Issues
  • How do you convey that an action is subconscious when writing in first person?
  • How to identify small molecules in a structure without bonds
  • Why are geodesics between two points in hyperbolic space unique?
  • Indexing array of colors and numbers
  • Multivariate chain rule (again) for differential forms
  • FTIR Spectra: Did I synthesize ethyl gallate from gallic acid?
  • What international law did Ecuador break by storming the Mexican embassy?

how to add ipv6 address using ifconfig

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 assign IPv6 addresses manually?

So I'm still rather clueless with IPv6, but I wanted to try something with my network today. Currently, I assign IPv4 LAN addresses manually, so that my router is 192.168.0.1 , then my first computer is 192.168.0.2 , and so on.

So far, I haven't been able to figure out how to do this with IPv6. Or is the process completely different that this is not how it would work?

Router is an Archer C4000, and my main system runs Ubuntu 19.04

EDIT: To clarify with how I manually set network IP addresses, my router has a page where I can set an address of my choosing to a MAC address. No configuration is done outside of the router.

hiigaran's user avatar

  • Please edit question and indicate how you assign LAN addesses manually. (On the router only? On your first computer as well?) I suspect you just set a network range on the router, and then addresses are not assigned "manually", but by DHCP from the router. On IPv6 then your router needs to advertise a subnet. On Ubuntu, you can set both IPv4 and IPv6 address manually with ip addr add ... . –  dirkt Sep 10, 2019 at 11:22
  • Edited. I'm going to guess then that it is assigned from a range, but then I limit what can be assigned based on MAC addresses. If I'm setting the IP address manually on each device, is there any further configuration that needs to be done (apart from avoiding duplicates), or will the router just accept that device A is going to use its own configured address? –  hiigaran Sep 10, 2019 at 12:00
  • If there's a page where you can assign an IPv4 address based on a MAC address, then this is for static addresses assigned via DHCP from the router. IPv6 works differently. While there is DHCPv6, the normal way is to use SLAAC , and let each computer pick an IPv6 address based on the announced subnet prefix.So this page won't help you to assign IPv6 addresses... –  dirkt Sep 10, 2019 at 12:05

2 Answers 2

To clarify with how I manually set network IP addresses, my router has a page where I can set an address of my choosing to a MAC address. No configuration is done outside of the router

This usually isn't called "manual configuration" to avoid confusion (from the LAN hosts' point of view, it is still automatic configuration). The usual terms are "static DHCP lease" or "DHCP reservation".

Overall, the process in IPv6 is usually completely different.

In IPv6 primary address auto-configuration mechanism (SLAAC) is completely stateless: the router does not issue individual addresses; it only periodically advertises the subnet address prefix and each host just combines it with its own chosen suffix. The router cannot limit hosts to just a specific sub-range; in fact the router does not receive any feedback about hosts' chosen address at all.

(Depending on each device's OS, the suffix might be a MAC address in traditional RFC4862 SLAAC; it might be a static hash value in RFC7217; it might be completely random in RFC4941 "Privacy Extensions"; and it might even be a user-provided value if the OS allows that.)

For example, the router advertises 2001:db8:123:456::/64 as the LAN address prefix; client A combines it with its own MAC address and begins using 2001:db8:123:456:6af2:68fe:ff7c:e25c .

That said, DHCP does exist in the IPv6 world and handles address leases in much the same way as IPv4 DHCP does. That means you can create DHCPv6 address pools, you can configure static address leases in DHCPv6, and so on. But not all clients support DHCPv6 at all (e.g. Android does not), so having SLAAC alongside is almost unavoidable.

So if you have a DHCPv6-capable client on a DHCPv6-capable network, chances are it'll have both a nice DHCPv6-assigned address and a longer SLAAC-autoconfigured address.

If I'm setting the IP address manually on each device, is there any further configuration that needs to be done (apart from avoiding duplicates), or will the router just accept that device A is going to use its own configured address?

As you can see above, that's how IPv6 address configuration works anyway .

u1686_grawity's user avatar

Your router's manual is found in User Guide and contains for IPv6 only an option for entering a static IPv6 address for the router itself (as received from the ISP).

The section about specifying the IP addresses that the router assigns by MAC address does not say whether they are IPv4 or IPv6, but I think it is highly unlikely that this will work for IPv6. And here is why.

IPv6 is quite unlike IPv4 in the sense that the long IPv6 address is made up of two parts. The first (the prefix) is assigned by the ISP. The second is assigned locally by the router or by each computer and is usually a random value based on the MAC address.

This means that the router does not control the IPv6 prefix which the ISP can change whenever it likes. You can force your computer to use a static IPv6 address, but only if it agrees with the ISP. You may be able to ask the ISP for a static IPv6 address, but that is a bad idea.

The reason it's a bad idea, is that all your devices are visible to the entire Internet by their IPv6 address (unless the router intervenes). Therefore having a fixed IPv6 address just makes tracking you that much easier.

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

But the fact you can does not mean you should. The only place that static IPv6 addresses makes sense is inside a local network which is not connected to the Internet.

harrymc's user avatar

  • What about if I wanted to run a web server? I'm constantly traveling for work, and I would love to have access to one of the computers at home which runs 24/7. I'd need to set a static IPv6 for this to work, wouldn't I? –  hiigaran Sep 10, 2019 at 19:23
  • A general solution would require an IPv6 dynamic DNS provider. See for that the article dynv6.com: IPv6 dynamic DNS done right . –  harrymc Sep 10, 2019 at 19:29
  • @harrymc Help me understand your logic, why would a server in a data center have a static IP but a server at home a dynamic one? In what world does that make any sense? –  Chazy Chaz Jul 29, 2022 at 12:40
  • In a world where the ISP attributes to users dynamic IP addresses. –  harrymc Jul 29, 2022 at 12:51

You must log in to answer this question.

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

  • The Overflow Blog
  • How do mixture-of-experts layers affect transformer models?
  • What a year building AI has taught Stack Overflow
  • Featured on Meta
  • New Focus Styles & Updated Styling for Button Groups
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network
  • Google Cloud will be Sponsoring Super User SE

Hot Network Questions

  • Why do you need to set aside 10 cards when setting up the game?
  • Comparison of clocks running at different heights in a gravitational field
  • Why do we need to prove extension lemmas?
  • Network analysis Kirchhoff
  • Is the subscheme parametrizing the k-th degeneracy loci Cohen-Macaulay?
  • Efficient way to find sum of largest x elements in a subarray
  • How can I set a Discord mute button for M3 MacBook Air running Sonoma?
  • How to know which repository to add to dnf to install a particular application in RHEL?
  • Wife and I would like to travel throughout the Schengen area for more than 90 days while my Portuguese citizenship application is in process
  • Geometry Nodes: Array items and rotate randomly on a 90° basis
  • Is infinity a concept or a word empty of meaning?
  • Is there a mathematical formula or a list of frequencies (Hz) of notes?
  • What happens if I use a material component of greater value than spell requires?
  • Is the Umbrage Hill Quest in Dragon of Icespire Peak likely to kill 1st-level PCs?
  • Who is "A person" in, "A person cannot receive even one thing....". John 3:27?
  • Is this many washers neccesarry?
  • Can possessive pronouns ever come on their own after a noun?
  • Plumbing Issues
  • How can tiny MOSFETs be rated for relatively high current?
  • Is Central Limit Theorem about multiple samples or just one?
  • Cirkuitikz: How to only rotate alternating current symbol?
  • Why did the US and Israel vote against making food a human right?
  • What international law did Ecuador break by storming the Mexican embassy?
  • Where do root systems arise in mathematics?

how to add ipv6 address using ifconfig

IMAGES

  1. How To Check The IPv6 Configuration On A Windows Device

    how to add ipv6 address using ifconfig

  2. Adding an IPv4 or IPv6 address in CentOS 6.x

    how to add ipv6 address using ifconfig

  3. Adding an IPv4 or IPv6 address in CentOS 7

    how to add ipv6 address using ifconfig

  4. 3 Easy Ways to Find IP address in Linux

    how to add ipv6 address using ifconfig

  5. How to Find/Get IP Address in Linux Using Command Line

    how to add ipv6 address using ifconfig

  6. How to Configure IPv6 Network on CentOS/RHEL 8

    how to add ipv6 address using ifconfig

VIDEO

  1. IPv6 Link Local Address

  2.  IPV6 CONFIGURATION IN EASY STEPS!

  3. ADDUSER/IFCONFIG/COLOR PROMPT LXD CONTAINER MACHINE

  4. How to configure ipv6 ip address on router interface

  5. How to Block IPv6 Addresses with Htaccess in Website

  6. How to create ipv6 from vps

COMMENTS

  1. 2. Add an IPv6 address

    Adding an IPv6 address is similar to the mechanism of "IP ALIAS" addresses in Linux IPv4 addressed interfaces.

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

    The following code instructs the ifupdown suite to use stateless autoconfiguration and two additional static IPv6 addresses for the eth0 network interface: address 3ffe:ffff::dead:beef. netmask 32. address 3ffe:ffff::c0de:d00d. netmask 32. This is the "proper" answer - for IPv6 and IPv4!

  3. Configuring IPv6 addresses

    There are different ways to configure an IPv6 address on an interface. You can use use "ifconfig" or "ip".

  4. Ubuntu Linux Add Static IPv6 Address Network Configuration

    Test IPv6 Configuration. To see your IPv6 address, enter: # ifconfig eth0 # ip -6 address show eth0 Display kernel IPv6 routing table: # netstat -nr -6 Ping to ipv6 enabled site such as cyberciti.biz (or ipv6.google.com): # ping6 cyberciti.biz Sample Output

  5. Linux ifconfig Command Explained With 19 Practical Examples

    The ifconfig command allows users to associate additional IP addresses with an interface using an IP alias. Create an alias IP with the following command: sudo ifconfig [interface_name]:[alias_number] [alias_IP] Note that the alias IP must belong to the same netmask. For example, the IP address for enp0s3 is 10.0.2.15.

  6. Linux ifconfig Command

    With the ifconfig command, you can assign an IP address and netmask to a network interface. Use the following syntax to assign the IP address and netmask: ifconfig [interface-name] [ip-address] netmask [subnet-mask] For example, to assign the IP address 192.168..101 and netmask 255.255.. to the interface eth0, you would run:

  7. FreeBSD Configure IPv6 Networking / Static IP Address

    Use ifconfig command as follows to assign an IP address: # ifconfig {interface-name} inet6 {IPv6-Address} prefixlen {routed-bit} # ifconfig le0 inet6 001:470:1e04:5ea::10 prefixlen 64 To add a default router, enter: # route -n add -inet6 default {IPv6-Router-IP} # route -n add -inet6 default 2001:470:1e04:5ea::1

  8. Configuring an IPv6 address in Red Hat Enterprise Linux 7 and 8

    If the IPV6_AUTOCONF variable is set to yes, then the SLAAC method is used to configure the host's IPv6 address by using the Neighbor Discovery Protocol (NDP).The technique applied here is the one explained in the previous article's Multicast section, where there is an exchange of client solicitation and router advertisement ICMPv6 messages.

  9. Debian IPv6 Virtual ( Additional ) Static Addresses Configuration

    The following example shows the addition of a secondary address using the /sbin/ifconfig command. Support nixCraft! nixCraft is a privacy-focused, Ad-free, and reader-supported site. Support independent tech content. ... Additional Ipv6 address #2: add 2607:f0d0:2001:000a::4/64; Interface: eth0; Ipv6 Type: Static;

  10. How to add an IPv6 address?

    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 current layer 2 segment of the connected LAN.

  11. How to get the IPv6 IP address in Linux

    3. Use the following command to view your IP address on Linux : ifconfig. Normally, Ipv6 address looks like 2001:5c0:9168::/48 . If you are facing any conflict in your IP, follow the below steps to set an IP address again: To assign IPv6 IPs, make sure you have the iproute2 tools installed.

  12. Why do I get multiple global IPv6 addresses listed in ifconfig?

    Outgoing connections will use the privacy address, unless configured otherwise. You can also still receive incoming connections on the MAC address based IPv6 address. This is all done to give you lots of flexibility. If you want you could add even more addresses. PS: another tool to see IPv6 addresses is.

  13. How to Find Your IP Address in Linux

    In Linux, you can view the private IP addresses of your system using the ifconfig or ip addr commands. For example: ifconfig. or. ip addr Different Ways to Find Your Private IP Address in Linux. 1) Using `hostname` to Find Your IP Address in Linux. The -I option with the hostname command can be used to display the private IP address of your ...

  14. How to set a static IP Address from the Command Line in GNU/Linux using

    Im a beginner of Linux i tried to change static IP on ubuntu server 20.04 server in the method of below command, It has changing my IP and get pinging but after restarting NO IP showing on ifconfig. or ip a . waiting for your valuable reply. sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0; sudo route add default gw 192.168.1.1 eth0;

  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 check IPv6 address via command line?

    0. If you want to find the public IPv6 address you can do this with the dig command and then pipe the result into the sed command to remove the closing quotes. dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | sed 's|"||g'. Another alternative is using the curl command and pulling the IP address from a URL such as OpenDNS'.

  17. How to assign an IPv6 address to an interface

    Stop running away from this, request and assign an IPv6 address to an external interface to make content available over both IPv4 and IPv6. Assign an IPv6 address to an interface using ip utility. $ ip -6 address add 2A00:0C98:2060:A000:0001:0000:1d1e:ca75/64 dev eth0. Use the same tool to configure the default route.

  18. How to correctly configure IPv6 with OpenVPN?

    0. The solution is very simple (though it took 6 hours to figure it out). Manual is here: Splitting a single routable IPv6 netblock. Remove existing ipv6: ifconfig eth0 inet6 del 2a04:52c0:101:xxx::x/64. Add the same inet6 with /65 prefix: ifconfig eth0 inet6 add 2a04:52c0:101:xxx::x/65.

  19. 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".