|

How to Disable IPv6 on Linux

IPv6 is enabled by default on most Linux distros. However, IPv6 is not used for some situations for most of time and it may cause troubles and requires effort to protect the network and ensure the security. This post introduces how to disable IPv6 support on Linux (newer modern Kernel versions).

First, add these lines to /etc/sysctl.conf:

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

IPv6 on Linux can be easily configured via sysctrl. To make it take effect, run as root:

sysctl -p

To verify, check the network interfaces whether IPv6 addresses disappear by ifconfig.

You may also check that the kernel variable contains 1:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

The settings are in sysctl.conf and after restarts, Linux will load them and the settings will still take effect.

Similar Posts

  • |

    How to Install Xen on Fedora as Domain-0 (Fedora 17)

    The new development of Xen and Linux kernel make it easy to install Xen on Fedora as the Domain-0 now. This post uses Fedora 17 as an example platform to introduce how to set up Domain-0 on Fedora Linux. Compared to our old method (https://www.systutorials.com/setting-up-stable-xen-dom0-with-fedora-xen-3-4-3-with-xenified-linux-kernel-2-6-32-13-in-fedora-12/) which requires manually compiled Xen and patched kernel, the current…

  • How to use ioprio_set in linux c

    Since there is no glibc wrapper for ioprio_set in linux c, we need to call this API with some definition. Using syscall in linux as follows. syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, IOPRIO_PRIO_CLASS(IOPRIO_CLASS_IDLE)); Some other definitions to declare above macros. 69 enum { 70 IOPRIO_CLASS_NONE, 71 IOPRIO_CLASS_RT, 72 IOPRIO_CLASS_BE, 73 IOPRIO_CLASS_IDLE, 74 }; 75 76 enum { 77…

  • C++ Reference and Styles

    C++ References Reference of the C++ Language Library, with detailed descriptions of its elements and examples on how to use its functions: http://www.cplusplus.com/reference/ C++ reference: http://www.cppreference.com/w/ C++ Styles I compile a list of C++ styles on the Internet. http://geosoft.no/development/cppstyle.html http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml http://www.mactech.com/articles/develop/issue_02/C%2B%2B_Style_Guide_v007.html http://www.cs.uga.edu/~dkl/1302/Fall99/style.html Read more: GNU C Reference Manual Reference: Special HTML Characters How to generate…

2 Comments

  1. Nice try, but the correct config parameters are:

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

    between disable and ipv6 you have to paste an underscore

    1. Thanks for pointing this out. It is a formatting problem after the site changes to be using markdown. `_` is treated as a formatting character. It is fixed now.

Leave a Reply

Your email address will not be published. Required fields are marked *