How do I disable or enable the IPv6 protocol in RHEL
Contents
Issue: How do I disable or enable the IPv6 protocol in Red Hat Enterprise Linux?
When I attempt to disable IPv6 in RHEL5, IPv4 does not connect. Had to re-enable IPv6 via console commands to connect to network.
Environmenta: Red Hat Enterprise Linux 6 Red Hat Enterprise Linux 5 Red Hat Enterprise Linux 4
Resolution:
Disabling IPv6 support in Red Hat Enterprise Linux 7
- Create a new file named /etc/sysctl.d/ipv6.conf and add the following options:
|
|
- The new settings would then need to be reloaded with:
# sysctl -p
Disabling IPv6 support in Red Hat Enterprise Linux 6
- Create a file /etc/modprobe.d/ipv6.conf with the following contents:
options ipv6 disable=1
- For completeness, it is a good idea to configure the ip6tables service not
to start at boot by issuing the following command:
chkconfig ip6tables off
- Edit /etc/sysconfig/network and add the following line
NETWORKING_IPV6=no
- Disable IPv6 support in the kernel through /etc/sysctl.conf :
|
|
- Comment out any IPv6 addresses found in /etc/hosts, including ::1 localhost address
|
|
- Optionally to prevent rpc.nfsd setting up IPv6 sockets while NFS server is running, edit /etc/netconfig for the lines starting with udp6 and tcp6; change the “v” in the third column to “-"(hyphen/dash)
- Reboot the system to disable IPv6 support.
Note: The solution above only disables(unhooks all of the calls) the ipv6 module, but doesn’t prevent it from loading. Unloading the module isn’t recommended due to the dependency factors it has with other modules(for example: bonding) and services. To prevent the module from loading, modify /etc/modprobe.d/ipv6.conf with the following only:
|
|
- Disabling ipv6 in the sysctl.conf will ensure ipv6 isnt used even if the ipv6 module is loaded and can work as a short term solution (until a full reboot)
- There is a special case where this might not work, please see The “ipv6 disable=1” option does not seem to work on Red Hat Enterprise Linux 6 system. (https://access.redhat.com/knowledge/solutions/72733)
Re-enabling IPv6 support in Red Hat Enterprise Linux 6
- Review the files under /etc/modprobe.d/ and remove (or comment out) any of the following lines:
|
|
- Configure the ip6tables service to start at boot by issuing the following
command:
chkconfig ip6tables on
- Edit /etc/sysconfig/network and add the line
NETWORKING_IPV6=yes
- Make sure the following options to your /etc/sysctl.conf are
|
|
- Make sure the following line exists in /etc/hosts, and is not commented out.
|
|
- Edit /etc/netconfig for the lines starting with udp6 and tcp6; change the “-"(hyphen/dash) in the third column to “v”
- Reboot the system to activate IPv6 support.
Reference : https://access.redhat.com/knowledge/solutions/8709 https://access.redhat.com/knowledge/solutions/72733
Author Hangbin Liu
LastMod 2018-12-13 (1672b97)