• 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 in CentOS/RHEL 8

by admin

By default, IPv6 is enabled on CentOS/RHEL 8 systems. However, in certain situations, some users may find it desirable to disable IPv6 support. This post outlines steps to enable ipv6 on a CentOS/RHEL 8 system.

1. Edit /etc/default/grub and delete the entry ipv6.disable=1 from the GRUB_CMDLINE_LINUX, as shown below:

# vi /etc/default/grub
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root"

2. Run the grub2-mkconfig command to regenerate the grub.cfg file:

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

Alternatively, on UEFI systems, run the following:

# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

3. Delete the file /etc/sysctl.d/ipv6.conf which contains the entry:

# First, disable for all interfaces
net.ipv6.conf.all.disable_ipv6 = 1
# If using the sysctl method, the protocol must be disabled all specific interfaces as well. 
net.ipv6.conf.[interface].disable_ipv6 = 1

If the Initial RAM Disk image was created earlier while disabling IPv6, only then carry out this step.

# dracut -f

4. Check the content of the file /etc/ssh/sshd_config and make sure the AddressFamily line is commented:

# vi /etc/ssh/sshd_config
#AddressFamily inet

5. Make sure the following line exists in /etc/hosts, and is not commented out:

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

6. Reboot the system to enable IPv6 support.

# systemctl reboot

Verification

1. The current state of the ipv6 module disable option can be seen via sysfs:

# cat /sys/module/ipv6/parameters/disable
1

2. The current state of the sysctl disable_ipv6 can be seen with the sysctl command:

# sysctl -a 2>/dev/null | grep disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.eth0.disable_ipv6 = 0

3. To list any IPv6 addresses assigned to the system:

# ip -6 addr

4. To list any IPv6 TCP or UDP sockets something like the following can be used:

# ss -6 -pan
How to Disable IPv6 in CentOS/RHEL 8

Filed Under: CentOS/RHEL, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. lastcomm: command not found
  2. deluser Command Examples in Linux
  3. How To Customize The Screensaver Options In Gnome on CentOS/RHEL 7
  4. mpstat: command not found
  5. uuidgen: command not found
  6. How to find and delete files older than some particular time period in Linux
  7. Yum Command Fails with “Another app is currently holding the yum lock” in CentOS/ RHEL 7
  8. pw-cli Command Examples in Linux
  9. How to Remove/Delete All Packages from Channel(s) in SpaceWalk
  10. “WARNING: Failed to connect to lvmetad. Falling back to device scanning” – error while running LVM commands

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright