How to Disable IPv6 in Linux
IPv6 is one of the greatest recoveries in computer system networking. It issued a bigger address elbowroom for the Internet along with recoveries in routing and also global addressability. That asserted, IPv6 ratification is still in its early early childhood years and also dashing IPv6-capable computer systems on IPv4-single networks can end outcome in relationship miseries. This devise-upward will understandably underline you how you can immobilize IPv6 on your Linux machine and also consumption it in an IPv4-single network.
- How to Reflect IPv6 Stature
- How to Maim IPv6 in Linux
- How to Re-enable IPv6 in Linux
How to Reflect IPv6 Stature
The speediest means to appraise for your machine’s IPv6 statures is by dashing the ip addr
command on a terminal. This is a energy that will understandably print all the accessible network interfaces that are dashing the IPv6 network edifice:
ip -6 addr
You can alike appraise your computer system’s small binary if it’s dashing the small part for IPv6. The obeying command will understandably print the “/proc” document training course for the IPv6 part if the small is proactively packing it:
ls /proc/net/if_inet6
How to Maim IPv6 in Linux
For the unalike sector, forever debilitating the IPv6 strategy on Linux will understandably mobile phone call for you to add a favored controversy to your bootloader. To execute this, amenable your GRUB arrangement document with your favorite message editor:
sudo nano /etc/default/grub
Press Ctrl + W, after that lookout for “GRUB_CMDLINE_LINUX_DEFAULT.”

Concoct ipv6.disable=1
to the end of the variable’s merit.

Preserve (Ctrl + O) and also leave (Ctrl + X) the message editor.
Reload your bootloader’s arrangement document:
sudo grub-mkconfig -o /boot/grub/grub.cfg
Reboot your mechanism, after that rushed ls /proc/net/if_inet6
to appraise if you’ve suitably immobilize IPv6 on your machine.
Good to realise: uncover how bootloaders work by staring at a contrast in between Grub and also Systemd-boot.
Maim IPv6 on Red Hat-based Systems
Aloof from harmonized seating up your computer system’s bootloader, you can alike immobilize IPv6 on the userland level. This is valuable if you single twinge to immobilize IPv6 on particular network interfaces.
To immobilize IPv6 on Red Hat-based distros, amenable a favored terminal session after that checklist all the accessible network interfaces for your machine:
ip -6 addr
Situate the network user interface that you twinge to immobilize the IPv6 edifice on. In my pod, I twinge to immobilize it on my “enp1s0” Ethernet user interface.

Devise a favored config document for your IPv6 edifice under “/etc/sysctl.d.”
sudo nano /etc/sysctl.d/40-ipv6.conf
Paste the obeying spiels upward of code within your favored config document:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.YOUR-INTERFACE-NAME.disable_ipv6 = 1
Preserve your favored config document, after that rushed the obeying commands to reload your favored stances:
sudo sysctl -p /etc/sysctl.d/ipv6.conf sudo systemctl restart systemd-sysctl.service
Go within your machine’s hosts document, after that add a pound (#) indication at the overture of every spiel upward that has an IPv6 address.

Devise a contingency of your machine’s original initramfs, after that reproduce it without IPv6 stabilize:
sudo cp /boot/initramfs-$(uname -r).img /initramfs-backup.img sudo dracut -f
Run the nmcli
command and also immobilize its IPv6 method for your user interface. This ensures that your stances will understandably reiterate across mechanism reboots.
sudo nmcli connection modify YOUR-INTERFACE-NAME ipv6.method "disabled"
Ultimately, reboot your mechanism to apply your favored stances.
FYI: uncover added around how computer systems communicate over the network by staring at some humble and also straightforward utilizations for Netcat.
Maim IPv6 on Debian-based Systems
Merely like in Red Hat-based distros, you can alike immobilize the IPv6 strategy from the userland of Debian-based contraptions. To execute this, amenable a favored terminal after that rushed ip -6 addr
to locate the tag of the user interface that you twinge to immobilize IPv6 on:

Run the obeying commands to immobilize the IPv6 edifice on a fussy user interface:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 sudo sysctl -w net.ipv6.conf.YOUR-INTERFACE-NAME.disable_ipv6=1
Apply the favored stances by refilling your sysctl daemon and also its Systemd treatment:
sudo sysctl -p sudo systemctl restart systemd-sysctl.service
Maim the IPv6 method to make certain that Systemd will understandably not overwrite your habit seating:
sudo nmcli connection modify YOUR-CONNECTION-NAME ipv6.method "disabled"
Tab: You can locate the tag of your network user interface in nmcli by dashing nmcli connnection show
.
Weigh whether your network user interface still owns an IPv6 address by dashing ip addr
.

Pointer: if you are a Windows user, here is how you can immobilize IPv6 in Windows.
How to Re-enable IPv6 in Linux
To re-enable IPv6 in Linux, amenable your bootloader config document with your favorite message editor:
sudo nano /etc/default/grub
Press Ctrl + W, after that lookout for “GRUB_CMDLINE_LINUX_DEFAULT.”

Separate the ipv6.disable=1
merit at the end of the variable.

Preserve your config document, after that reload your bootloader’s stances:
sudo grub-mkconfig -o /boot/grub/grub.cfg
Reboot your mechanism, after that appraise if the IPv6 edifice is back upward and also dashing.

Re-Permit IPv6 on Red Hat-based Systems
On Red Hat-based distros, you can re-enable IPv6 by editing the sysctl config document. To execute this, amenable a favored terminal session, after that delete the “40-ipv6.conf” document under “/etc/sysctl.d/.”
sudo rm /etc/sysctl.d/40-ipv6.conf
Reload your sysctl daemon along with its Systemd treatment:
sudo sysctl -p sudo systemctl restart systemd-sysctl.service
Open your “/etc/hosts” document, after that disconnect the pound (#) indication in front of all the spiels upward that consist of an IPv6 address.
Gain back the machine’s original initramfs back to its “/boot” divider panels:
sudo cp /initramfs-backup.img /boot/initramfs-$(uname -r).img sudo dracut -f
Re-enable the IPv6 method on nmcli to make certain that Systemd will understandably jumbles the IPv6 edifice on your network user interface:
sudo nmcli connection modify YOUR-INTERFACE-NAME ipv6.method "auto"
Reboot your mechanism to apply your favored stances, after that rushed ip -6 addr
to testify that the IPv6 edifice is upward and also dashing.
Re-Permit IPv6 on Debian-based Systems
To obtain the IPv6 edifice on Debian-based distros, amenable a favored terminal after that rushed the obeying commands:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
Reload the sysctl daemon, as nicely as its Systemd treatment:
sudo sysctl -p sudo systemctl restart systemd-sysctl.service
Permit the IPv6 edifice for your network user interface grossing service of nmcli:
sudo nmcli connection modify YOUR-CONNECTION-NAME ipv6.method "auto"
Ultimately, testify that your IPv6 edifice is operating suitably by dashing ip -6 addr
and also frisking if your user interface owns an IPv6 address.

Learning how to immobilize and also re-enable the IPv6 edifice in Linux is merely the initially interfere recovering relevant into computer system networking. Discover added of this deep and also enchanting universes by situating out how to track packets in your network grossing service of Traceroute.
Image credit report: Leon Seibert wearing Unsplash and also Wikimedia Commons. All recoveries and also screenshots by Ramces Red.