HowTo Disable ipv6

Share your own howto's etc. Not for support questions!

HowTo Disable ipv6

Postby julian67 » 2009-09-18 06:50

This subject comes up a lot and often the methods/advice offered are erroneous, so here is a reliable howto.

First if you suspect ipv6 is causing problems (usually it's timeouts on DNS so pages fail to load/load slowly or you find apt can't resolve some repositories) then you can quickly check if it's the case using Iceweasel/Firefox or Epiphany.

Open a new tab and type about:config and hit return. Go past any dire warnings and you'll see a filter box. Enter ipv6 and you'll see this:

Image

Double click on the line to toggle the setting to 'true'

Image

If you run a dnscache (dnscache-run, djbdns etc) you'll need to restart it. If you don't know if you run a dnscache then you almost certainly do not.

Close the tab, open a new one and go to some of the pages you had trouble with. If they now resolve then you can go ahead and disable ipv6 systemwide.

Here's how:

As root create a file /etc/modprobe.d/00local.conf and edit it to look as follows

Code: Select all
install ipv6 /bin/true
alias net-pf-10 off
alias ipv6 off


Save the file.

Reboot. You now have a system which doesn't use ipv6. You can verify this by checking if the ipv6 driver is loaded

Code: Select all
$ lsmod |grep ipv6

which will produce no output. On a system with ipv6 enabled you would see something like

Code: Select all
$ lsmod |grep ipv6
ipv6                  236036  18


How Not To Do It

Often it's advised to edit /etc/modprobe.d/aliases.conf or /etc/modprobe.d/blacklist.conf

In the case of blacklist.conf it simply won't work. ipv6 is a kernel module, a driver. From /etc/modprobe.d/blacklist.conf
# This file lists modules which will not be loaded as the result of
# alias expansion, with the purpose of preventing the hotplug subsystem
# to load them. It does not affect autoloading of modules by the kernel.
# This file is provided by the udev package.


From /etc/modprobe.d/aliases.conf

# These are the standard aliases for devices and kernel drivers.
# This file does not need to be modified.


So you possibly can disable ipv6 via aliases.conf but your changes will be not be persistent, that is a package/system upgrade will overwrite them. The advantage of creating /etc/modprobe.d/00local.conf is that it will be persistent. Nothing will automatically overwrite or delete it, it will continue to work even after dist-upgrading from release to release.

If you compile your own kernels you can easily build them with no ipv6 support.
"If at first you don't succeed, give up." - Homer Simpson.

"If it ain't working, don't fix it."

What is this so-called "Google" anyway?
User avatar
julian67
 
Posts: 3464
Joined: 2007-04-06 14:39
Location: upriver

Re: HowTo Disable ipv6

Postby milomak » 2009-09-18 21:11

On 2.6.31 (which I think is the same with at least 2.6.28 and onwards), the kernel path is:

Code: Select all
   Location:                                                                                                                                                                      │
  │     -> Networking support (NET [=y])                                                                                                                                             │
  │       -> Networking options                                                                                                                                                      │
  │         -> TCP/IP networking (INET [=y])                                                                                                                                         │
  │           -> The IPv6 protocol (IPV6 [=n])
Laptop (32-bit) - Debian Sid
Desktop (64-bit) - Debian Sid, F12, Gentoo, ArchLinux
MythTV - Debian Testing
milomak
 
Posts: 555
Joined: 2009-06-09 22:20

Re: HowTo Disable ipv6

Postby register88 » 2009-09-27 01:24

Add below line in /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 0
register88
 
Posts: 4
Joined: 2009-09-27 01:22

Re: HowTo Disable ipv6

Postby julian67 » 2009-09-27 01:43

That is fine but can be overwritten by package or dist-upgrade (if you don't pay close attention). The reason I outlined the method in the first post is that it is guaranteed to be persistent even if the user is forgetful or makes a mistake.
"If at first you don't succeed, give up." - Homer Simpson.

"If it ain't working, don't fix it."

What is this so-called "Google" anyway?
User avatar
julian67
 
Posts: 3464
Joined: 2007-04-06 14:39
Location: upriver

Re: HowTo Disable ipv6

Postby Jackiebrown » 2009-10-03 06:20

julian67 wrote:That is fine but can be overwritten by package or dist-upgrade (if you don't pay close attention). The reason I outlined the method in the first post is that it is guaranteed to be persistent even if the user is forgetful or makes a mistake.


I know you mentioned paying attention...

With that said, dpkg should not overwrite anything in /etc without prompting
User avatar
Jackiebrown
 
Posts: 1157
Joined: 2007-01-02 04:46
Location: San Antonio, TX

Re: HowTo Disable ipv6

Postby julian67 » 2009-10-03 07:10

It seems as easy to me to put three short lines of text somewhere they work perfectly but cannot get overwritten as it is to put them somewhere they work perfectly but can get overwritten. Sod's law says if something can go wrong it will go wrong. But when I develop perfect recall and finally shake off this annoying tendency to make mistakes and bad decisions I'll do it some other way. I'd like to be richer too.

I like to use methods which don't require me having my brain switched on.

Last time I dist-upgraded there were quite a lot of changes I was prompted to examine. I couldn't remember exactly what they all were. I wasn't sure in every case which differences were due to my edits and which were due to changes in the default files. Looking at the diffs didn't enlighten me in every case, only gave an uncomfortable feeling along the lines of "it looks familiar but....oh shit what did I do that for? Or did I? And why is the new one different?" I do keep extensive docs of pretty much everything but sometimes that's about as useful as someone asking "where did you last have it?" when you lost something. I keep a tarred backup of /etc and /usr/local and make sure it's up to date before making any big changes, so I can pick through it later and restore any edits if needed, but I much prefer it when I don't need to. Some of the changes that might be made to a file like /etc/sysctl.conf are not blindingly obvious (to me anyway), may include things which are not mentioned in the default comments (you have to read the man pages) and are likely to be the result of struggling through some truly uninspiring reading matter, maybe some trial and error too.

I said in the first post of this howto "The advantage of creating /etc/modprobe.d/00local.conf is that it will be persistent."

That's still true, and the best part is it will be persistent even if you are inconsistent :wink:
"If at first you don't succeed, give up." - Homer Simpson.

"If it ain't working, don't fix it."

What is this so-called "Google" anyway?
User avatar
julian67
 
Posts: 3464
Joined: 2007-04-06 14:39
Location: upriver

Re: HowTo Disable ipv6

Postby hkoster1 » 2009-10-03 10:41

I agree with your approach to the problem at hand, i.e. disabling ipv6 in the browser or even
system-wide. Now, for the larger problem: how to get there (general use of ipv6) from here
(still using ipv4)? Would your approach be helpful, or would temporary slow resolving of dns
be the small price we pay for progress? Just asking... :wink:
hkoster1
 
Posts: 1074
Joined: 2006-12-18 10:10

Re: HowTo Disable ipv6

Postby julian67 » 2009-10-03 11:01

First thing to note is that adoption of ipv6 is S.E.P - Someone Else's Problem.

I have however developed a completely foolproof personal strategy - waiting.

It's something that can't be driven by the domestic consumer or small business user, but by ISPs, major hosting companies, operating system suppliers, very large enterprises, major hardware manufacturers, regulatory bodies, governments and so on.
"If at first you don't succeed, give up." - Homer Simpson.

"If it ain't working, don't fix it."

What is this so-called "Google" anyway?
User avatar
julian67
 
Posts: 3464
Joined: 2007-04-06 14:39
Location: upriver

Re: HowTo Disable ipv6

Postby hkoster1 » 2009-10-03 20:06

Hmmm... apart from that S.S.A - Self-Serving Attitude, I've spent some time since your post
researching what would be required to implement IPV6. Good grief! My own ISP (XS4ALL.NL)
makes free IPV6 tunneling available on an experimental basis... after studying the available
info and the Debian Howto at http://wiki.debian.org/DebianIPv6 I'm still not much
wiser. Seems they added so much new stuff to the IPV6 specification that one almost needs
a Ph.D. in Computer Science to understand what's going on. That rules me out (sadly, I'm
more of the Soul Singin' ilk...). Looks like the change-over, if and when it comes, is going
to be a Y2K-like event.

So, I quickly reverted to IPV4 system-wide, thanks to your Howto; and did the same on my
other computers running Mac OS X. A noticeable improvement! :P
hkoster1
 
Posts: 1074
Joined: 2006-12-18 10:10


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests