sed -i '/^NETWORKING_IPV6./d' /etc/sysconfig*/network

**<span lang="EN-US" style="color: rgb(122, 8, 116); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">echo </span>**<span lang="EN-US" style="color: red; font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">&#39;NETWORKING_IPV6=</span>**<span lang="EN-US" style="color: rgb(85, 85, 85); font-family: Verdana, sans-serif; font-size: 9pt; background-color: white;">no</span>**<span lang="EN-US" style="color: red; font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">&#39;</span>**<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">&gt;&gt; /</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">etc</span>**<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">sysconfig</span>**<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">network</span>

**<span lang="EN-US" style="color: rgb(122, 8, 116); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">echo </span>****<span lang="EN-US" style="color: red; font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">&#39;</span>**<span lang="EN-US" style="color: rgb(85, 85, 85); font-family: Verdana, sans-serif; font-size: 9pt; background-color: white;">IPV6INIT=no</span><span lang="EN-US" style="color: red; font-family: Verdana, sans-serif; font-size: 9pt; background-color: white;">&#39;</span>**<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">&gt;&gt; </span>**<span lang="EN-US" style="color: rgb(85, 85, 85); font-family: Verdana, sans-serif; font-size: 9pt; background-color: white;">/etc/sysconfig/network-scripts/ifcfg-eth0</span>

**<span lang="EN-US" style="color: rgb(85, 85, 85); font-family: Verdana, sans-serif; font-size: 9pt; background-color: white;">chkconfig&nbsp; ip6tables off</span>**

**<span lang="EN-US" style="color: rgb(194, 12, 185); font-family: Consolas; font-size: 10pt; background-color: white;">cat </span>****<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">&gt;/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">etc</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">modprobe.d</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">ipv6.conf </span>_<span lang="EN-US" style="color: rgb(204, 0, 0); font-family: Consolas; font-size: 10pt; background-color: white;">&lt;&lt; EOFI</span>_

_<span lang="EN-US" style="color: rgb(204, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">alias net-pf-10 off</span>_

_<span lang="EN-US" style="color: rgb(204, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">options ipv6 disable=1</span>_

_<span lang="EN-US" style="color: rgb(204, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: white;">EOFI</span>_

<span lang="EN-US" style="font-family: 微软雅黑, sans-serif; font-size: 10pt; background-color: white;">echo&nbsp;&#39;</span><span lang="EN-US" style="font-family: Consolas; background-color: white;">alias net-pf-10 off</span><span lang="EN-US" style="font-family: 微软雅黑, sans-serif; font-size: 10pt; background-color: white;">&#39;&nbsp;&gt;&gt; </span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">etc</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">modprobe.d</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">ipv6.conf</span>

<span lang="EN-US" style="font-family: 微软雅黑, sans-serif; background-color: white;">echo&nbsp;&#39;</span><span lang="EN-US" style="font-family: Consolas; background-color: white;">options ipv6 disable=1</span><span lang="EN-US" style="font-family: 微软雅黑, sans-serif; background-color: white;">&#39; &gt;&gt;&nbsp;</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">etc</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">modprobe.d</span>**<span lang="EN-US" style="font-family: Consolas; font-size: 10pt; background-color: white;">/</span>**<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Consolas; font-size: 10pt; background-color: rgb(249, 249, 249);">ipv6.conf</span>

<span lang="EN-US" style="background-color: inherit;">[**<span style="color: blue; font-family: Arial, sans-serif; font-size: 14pt; background-color: white;">https://wiki.centos.org/FAQ/CentOS6</span>**](https://wiki.centos.org/FAQ/CentOS6)</span>

**<span lang="EN-US" style="color: rgb(7, 43, 97); font-family: Arial, sans-serif; font-size: 14pt; background-color: white;">How do I disable IPv6?</span>**

<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">&nbsp;</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: white;">adding the following to&nbsp; /etc/sysctl.conf</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">net.ipv6.conf.all.disable_ipv6 = 1</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">net.ipv6.conf.default.disable_ipv6 = 1</span>

<span lang="EN-US" style="font-family: Consolas; background-color: inherit;">echo &#39;net.ipv6.conf.all.disable_ipv6 = 1&#39; &gt;&gt; /etc/sysctl.conf</span>

<span lang="EN-US" style="font-family: Consolas; background-color: inherit;">echo &#39;net.ipv6.conf.default.disable_ipv6 = 1&#39; &gt;&gt; /etc/sysctl.conf</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">sysctl -p</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">To disable in the running system:</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">echo 1 &gt; /proc/sys/net/ipv6/conf/all/disable_ipv6</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">echo 1 &gt; /proc/sys/net/ipv6/conf/default/disable_ipv6</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">or</span>

<span lang="EN-US" style="color: red; font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">sysctl -w net.ipv6.conf.all.disable_ipv6=1</span>

<span lang="EN-US" style="color: red; font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">sysctl -w net.ipv6.conf.default.disable_ipv6=1</span>

**<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">Additional note #1</span>**<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">: If problems with X forwarding are encountered on systems with IPv6 disabled, edit&nbsp;**/etc/ssh/sshd_config**&nbsp;and make either of the following changes:</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">(1) Change the line</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">#AddressFamily any</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">to</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">AddressFamily inet</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">(inet is ipv4 only; inet6 is ipv6 only)</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">or</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">(2) Remove the hash mark (#) in front of the line</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">#ListenAddress 0.0.0.0</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">Then restart ssh.</span>

**<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">Additional note #2</span>**<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">: If problems with starting postfix are encountered on systems with IPv6 disabled, either</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">(1) edit /etc/postfix/main.cf and comment out the localhost part of the config and use ipv4 loopback.</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">#inet_interfaces = localhost</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">inet_interfaces = 127.0.0.1</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">or</span>

<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">(2) take out the ipv6 localhost from /etc/hosts .</span>

**<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">Additional Note #3&nbsp;</span>**<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 10pt; background-color: inherit;">: To disable RPCBIND ipv6 (rpcbind, rpc.mountd, prc.statd) remark out the udp6 and tcp6 lines in /etc/netconfig:</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">udp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_clts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v&nbsp;&nbsp;&nbsp;&nbsp; inet&nbsp;&nbsp;&nbsp;&nbsp; udp&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_cots_ord&nbsp; v&nbsp;&nbsp;&nbsp;&nbsp; inet&nbsp;&nbsp;&nbsp;&nbsp; tcp&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">#udp6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_clts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v&nbsp;&nbsp;&nbsp;&nbsp; inet6&nbsp;&nbsp;&nbsp; udp&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">#tcp6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_cots_ord&nbsp; v&nbsp;&nbsp;&nbsp;&nbsp; inet6&nbsp;&nbsp;&nbsp; tcp&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">rawip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_raw&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp; inet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">local&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_cots_ord&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp; loopback&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">unix&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpi_cots_ord&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp; loopback&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</span>

<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">#########################</span>

<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: &quot;Courier New&quot;; font-size: 10pt; background-color: inherit;">&nbsp;</span>

<span lang="EN-US" style="color: rgb(17, 0, 0); font-family: Verdana, sans-serif; font-size: 9pt; background-color: white;">Disabling IPv6 support in Red Hat Enterprise Linux 6</span>
  1. Create a file /etc/modprobe.d/ipv6.conf with the following contents:
  2. options ipv6 disable=1
  3. For completeness, it is a good idea to configure the ip6tables service not to start at boot by issuing the following command:
  4. # chkconfig ip6tables off
  5. Edit /etc/sysconfig/network and add the line NETWORKING_IPV6=no
  6. Disable ipv6 support in the kernel through /etc/sysctl.conf :
  7. # ipv6 support in the kernel, set to 0 by default
  8. net.ipv6.conf.all.disable_ipv6 = 1
  9. net.ipv6.conf.default.disable_ipv6 = 1
  10. 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)
  11. Reboot the system to disable IPv6 support.

    Note: 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.

    Disabling ipv6 in the sysctl.conf will ensure ipv6 isn't used even if the ipv6 module is loaded and can work as a short term solution (until a full reboot)