Disable RHEL7 IPv6

This how-to will show you how to disable RHEL7 IPv6. IPv6 is enabled by default on a standard install of RHEL 7. It is pretty much the same method to disable IPv6 on Redhat 7 as it is Redhat 6. Below are the details on how to do this.

Check IPv6

Check that IPv6 is actually configured.

[root@server ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:19:5e:64:03:09 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::115:8dff:fd64:409/64 scope link
       valid_lft forever preferred_lft forever

Disable IPv6

To disable IPv6 run the following commands.

[root@server ~]# sysctl -w net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
[root@server ~]# sysctl -w net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6 = 1

Check IPv6 is Disabled

Check that IPv6 is actually configured.

[root@server ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:19:5e:64:03:09 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever

Disable IPv6 Permanently

To disable IPv6 permanently you need to add the commands to the networking config.

Edit the following file

[root@server ~]# vi /etc/sysctl.conf

add the following content to the end of the file

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

That should be it, IPv6 will now be disabled at boot time on your Redhat 7 & CentOS 7 system.