How to disable IPv6 address on Ubuntu 18.04 Bionic Beaver Linux
op
Objective
The objective is to disable IPv6 on Ubuntu Bionic Beaver LinuxOperating System and Software Versions
- Operating System: - Ubuntu 18.04 Bionic Beaver Linux
Requirements
Privileged access to your Ubuntu System as root or viasudo
command is required.
Conventions
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ - given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Ubuntu 20.04 (Focal Fossa)Instructions
Whether you are running Ubuntu 18.04 desktop or server the IPv6 network addresses are enabled by default. In most of the cases this default setting can be simply ignored.However, in case that you need to disable the IP version 6 network protocol on your Ubuntu 18.04 Desktop or Server this tutorial we help you to do just that.
Disable IPv6 Network Address
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 $ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
/etc/sysctl.conf
configuration file by adding the following lines:
net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1
WARNING: Please note, that at the time of writing this method to disable IPv6 after reboot using
The recommend method to disable IPv6 on Ubuntu 18.04 after reboot is to configure the GRUB boot loader to pass kernel parameter during the boot time. /etc/sysctl.conf
configuration file on Ubuntu 18.04 does Not work. However, this seems to be a bug so feel free to try.To do so open the
/etc/default/grub
using your favorite text editor with root privileges and change/add:
FROM: GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" TO: GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1" GRUB_CMDLINE_LINUX="ipv6.disable=1"
/etc/default/grub
file execute the following commands to apply the GRUB changes:
$ sudo update-grubAll done. Optionally reboot your Ubuntu 18.04 system.
Enable IPv6 Network Address
To enable IPv6 protocol simply reverse the above procedure. To immediately disable IPv6 protocol execute:$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 $ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0In case you have also configured the
/etc/sysctl.conf
configuration file remove the appropriate lines. Lastly, edit the /etc/default/grub
using your favorite text editor with root privileges and change/remove:
FROM: GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1" GRUB_CMDLINE_LINUX="ipv6.disable=1" TO: GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX=""When ready execute:
$ sudo update-grubto apply changes made to the GRUB boot loader configuration.
How to disable IPv6 address on Ubuntu 18.04 Bionic Beaver Linux
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!