Home Linux Server How to disable IPv6 on RHEL/CentOS 7

How to disable IPv6 on RHEL/CentOS 7

by Thạch Phạm
Published: Last Updated on


What is IPv6?

IPv6 is “Internet Protocol version 6“, a version of Internet Protocol (IP) intended to upgrade Internet Protocol version 4 (IPv4) that currently transmits most Internet traffic but has run out of address. IPv6 allows up to 2,128 addresses, a huge increase compared to the 232 (about 4.3 billion) addresses of IPv4.

28% of devices with IPv6 addresses in Vietnam are used to search at Google, the most are in the US with 32%.

Check if IPv6 is enabled on the server

How to know if your server supports IPv6 feature? The simplest way is that you just need to display the network card information, which will come with spontaneous IPv6 information for the Linux network card.

AZDIGI Tutorial
[root@sv ~]# ifconfig -a | grep inet6
        inet6 fe80::6ddf:1974:3ad2:c86f  prefixlen 64  scopeid 0x20
        inet6 fe80::9f2a:5f83:61dd:75c1  prefixlen 64  scopeid 0x20
        inet6 ::1  prefixlen 128  scopeid 0x10

Note: The IPv6 value, as shown above, is a self-generated IPv6 value by the Linux system. Not for public use but only for local network communication connections.

In addition, you can quickly check by using the command below, if the result is “0“, it means it is active, and “1” means it is not.

AZDIGI Tutorial
[root@sv ~]# cat /proc/sys/net/ipv6/conf/all/disable_ipv6

How to disable IPv6

Method 1: Disable IPv6 in GRUB

  • You open the configuration file according to the path below:
AZDIGI Tutorial
vi /etc/default/grub

Next, you add the content: ipv6.disable=1 to the GRUB_CMDLINE_LINUX= line:

How to disable IPv6 on RHEL/CentOS 7
  • Recreate the GRUB configuration file and overwrite the current grub configuration file.
AZDIGI Tutorial
grub2-mkconfig -o /boot/grub2/grub.cfg
  • Reboot the Linux system.
AZDIGI Tutorial

Method 2: Disable IPv6 via sysctl

This way, we will not need to reboot the server, but the configuration modification will take effect immediately. Now add the following 3 configuration lines to the end of the /etc/sysctl.conf file.

AZDIGI Tutorial
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
How to disable IPv6 on RHEL/CentOS 7
  • Reload new configuration without reboot
AZDIGI Tutorial
sysctl -f /etc/sysctl.conf

Note: If you are using X Forwarding of the SSH service configured at /etc/ssh/sshd_config. then you should change the ‘AddressFamily‘ value in the SSH service configuration.

#AddressFamily any => AddressFamily inet


  • inet: works with IPv4
  • inet6: works with IPv6
  • any: with with IPv4 and IPv6

So AZDIGI has shown you 2 methods to disable IPv6 on the CentOS7 server. If you have any questions or concerns, you can leave a comment below the article. Wishing you success!

You can refer to other instructions at the link below:

If you need support, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign