Introduction

If you are disabling IPv6 then you likely know why you are doing it and the reasons may be varied. Disabling IPv6 only requires a brief search to find the sysctl change required but the Ubuntu bug issue is worth a mention.

Disable IPv6

Modify the following file:

vim /etc/sysctl.d/99-sysctl.conf

Add the following lines:

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

Reload values and confirm IPv6 addresses have been removed:

sysctl -p

Surviving Reboots

There appears to a bug in Ubuntu affecting the sysctl settings loading after reboot.

The fix however is to create a new file /etc/rc.local and add these contents:

#!/bin/bash
# /etc/rc.local

# Load kernel variables from /etc/sysctl.d
/etc/init.d/procps restart

exit 0

You’ll need to ensure the file is executable as well:

chmod 755 /etc/rc.local

Thanks to Bill for his post which likely saved me time searching the interweb for answers…

https://www.admintome.com/blog/disable-ipv6-on-ubuntu-18-04/

Disable IPv6 on Ubuntu 18.04
Tagged on:         

One thought on “Disable IPv6 on Ubuntu 18.04

  • 10th June 2020 at 07:28
    Permalink

    Ah.. The bug.. Thanks it works.

    Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.