How To Disable IPv6 Network Interface On Linux 7

We can disable the ipv6 network interface in Centos 7 Linux and also check whether it’s enabled or not in Linux. you can also use this command to get the information ifconfig | grep ipv6

ip a | grep inet6

how to disable ipv6

Check Out: Command To Check Swap Partition On Linux Server

How To Disable IPv6 Network Interface On Linux 7:

Method 1:

we can disable IPV6 using sysctl settings and no reboot required.

You can add the below lines in /etc/sysctl.conf.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Note: if you want to disable it on particular interface, use this command net.ipv6.conf.[interface_name].disable_ipv6 = 1 and replace interface_name with the interface in the commands.

Check Out: Create and Configure Elastic Load Balancer On Amazon Cloud

To make changes affective: so

systctl -p

ipv6 network linux

After these settings, you will have to make a change in the sshd_config configuration file. so

vim /etc/ssh/sshd_config 
AddressFamily inet

disable ipv6 in centos 7

systemctl restart sshd

if you don’t perform this task, you might not be able to ssh the machine.

Check Out: Configure Filebeat For MySQL Database Server In Elasticsearch ELK

Method 2: Using the Kernel Module and reboot required. so

You have to make a change in grub file vim /etc/default/grub and

Replace this line GRUB_CMDLINE_LINUX=”crashkernel=auto rhgb quiet” with GRUB_CMDLINE_LINUX=”ipv6.disable=1 crashkernel=auto rhgb quiet”

disable ipv6 linux

Create a backup of the grub.cfg file using cp grub.cfg grub.cfg-back

Check Out: How To Disable Signup Option On Frontend Gitlab Server

Regenerate a GRUB configuration file, /boot/grub2/grub.cfg

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

check ipv6 enabled linux

Reboot the machine and make sure IPV6 address should not be shown using ip a | grep inet6 s

Method 3: you can also use the below commands to disable

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

That’s it. ipv6 network linux disable ipv6 in centos 7 linux check  enabled linux

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment