How to disable IPV6 in debian

This tutorial will explain how to disable IPV6 in debian.

Open a terminal and su to root

Now you need to check if iPV6 is active or not using the following command

netstat -tunlp |grep p6 |wc -l

If the result is anything other than 0, then one or more IPv6-aware processes is running.

Disable using the following 3 commands

echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf

sed ‘/::/s/^/#/’ /etc/hosts >/etc/dipv6-tmp;cp -a /etc/hosts /etc/hosts-backup && mv /etc/dipv6-tmp /etc/hosts

sed ‘/ipv6=yes/s/yes/no/’ /etc/avahi/avahi-daemon.conf >/etc/avahi/dipv6-tmp;cp -a /etc/avahi/avahi-daemon.conf /etc/avahi/avahi-daemon.conf-backup && mv /etc/avahi/dipv6-tmp /etc/avahi/avahi-daemon.conf

After running above 3 commands restart your system

Now you can run the following command to check IPV6 is active

netstat -tunlp |grep p6 |wc -l

Again, these steps will disable IPv6 on a stock install of Squeeze. If you have additional IPv6-aware processes running (server daemons in particular), then additional steps may be required.

Sponsored Link

One thought on “How to disable IPV6 in debian

  1. That is ugly. How about this instead

    edit /etc/sysctl.conf

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

Leave a comment

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