• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to enable IPv6 on CentOS / RHEL 7

by admin

IPv6 is enabled by default on RHEL / CenOS 7 systems. So, if IPv6 was disabled on the system intentionally, it can be re-enabled by the following either of the methods described below.
1. Enabling IPv6 in kernel module (requires reboot)
2. Enabling IPv6 using sysctl settings (no reboot required)

Enabling IPv6 in kernel module (requires reboot)

1. Edit /etc/default/grub and change the value of kernel parameter ipv6.disable from 1 to 0 in line GRUB_CMDLINE_LINUX, e.g.:

# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=0 crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
Note: ipv6.disable=0 is the default value, so you can simply remove this argument ipv6.disable from GRUB_CMDLINE_LINUX argument list if you want.

2. Regenerate a GRUB configuration file and overwrite existing one using the command shown below.

# grub2-mkconfig -o /boot/grub2/grub.cfg

3. Restart system for the changes to take effect.

# shutdown -r now

Enabling IPv6 using sysctl settings (no reboot required)

In addition, even if the ipv6 kernel module is loaded, it could also be disabled by using sysctl settings.

1. In order to get ipv6 running online, please make sure below lines in /etc/sysctl.conf are commented out or removed.

# cat /etc/sysctl.conf | grep ipv6
# net.ipv6.conf.all.disable_ipv6 = 1     ### either comment/remove this line or change its value from 1 to 0
# net.ipv6.conf.default.disable_ipv6 = 1 ### either comment/remove this line or change its value from 1 to 0

2. Use the command ‘sysctl -p’ to re-read the configuration file /etc/sysctl.conf.

# sysctl -p

More about using sysctl settings

1. To dynamically disable ipv6 on an interface, use commands given below.

# sysctl net.ipv6.conf.[interface].disable_ipv6 = 1       ### put interface name here [interface], i.e. eth0
# sysctl net.ipv6.conf.default.disable_ipv6 = 1

2. To dynamically enable ipv6 on an interface, use the commands given below.

# sysctl net.ipv6.conf.[interface].disable_ipv6 = 0       ### put interface name here [interface], i.e, eth0
# sysctl net.ipv6.conf.default.disable_ipv6 = 0

3. To dynamically enable ipv6 on all interfaces, use the commands given below.

# sysctl net.ipv6.conf.all.disable_ipv6 = 0
# sysctl net.ipv6.conf.default.disable_ipv6 = 0

4. To dynamically disable ipv6 on all interfaces, use the commands given below.

# sysctl net.ipv6.conf.all.disable_ipv6 = 1
# sysctl net.ipv6.conf.default.disable_ipv6 = 1

Verify

To verify if IPv6 is enabled or not, execute :

# ifconfig -a | grep inet6
        inet6 fe80::211:aff:fe6a:9de4  prefixlen 64  scopeid 0x20
        inet6 ::1  prefixlen 128  scopeid 0x10[host]

As shown in the output above, IPv6 is enabled.

CentOS / RHEL 7 : How to disable IPv6 on a specific interface only
CentOS / RHEL 7 : How to disable IPv6
CentOS / RHEL 6 : How to disable IPv6

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. ssh-keygen: command not found
  2. Linux OS service ‘nfs’
  3. make Command Examples in Linux
  4. How to list all modules and check if they are enabled or disabled in CentOS/RHEL 8
  5. pw-record Command Examples in Linux
  6. lvextend command examples in Linux
  7. CentOS / RHEL 6,7 : How to disable or delete virbr0 interface
  8. CentOS / RHEL : How to extend Physical Volume in LVM by extending the Disk Partition used
  9. What is the purpose of .bash_profile file under User Home Directory In Linux
  10. Active Directory Users Unable to Login via SSH using SSSD and Getting “Permission Denied, Please Try Again” [CentOS/RHEL]

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright