How to disable IPv6 in Debian Lenny and Squeeze

There're many-many methods described all over the net, some work in Etch, some in Lenny, some in Squeeze. The official documentation tells you to use sysctl to set net.ipv6.conf.all.disable_ipv6 to 1 in case of Squeeze.

Actually this is the only method that works for me (at least in Squeeze). I used to get IPv6 related errors during apt-get update commands and using sysctl to let the kernel know not to use IPv6 stopped these from occurring.

The older method (that worked in Lenny) does not really work for me anymore (it prevented the ipv6 module from being loaded, but APT errors still kept coming), but I'll document it just for reference: create a new file at /etc/modprobe.d/local.conf and put the following in it:
install ipv6 /bin/true
alias net-pf-10 off
alias ipv6 off

There's another (third) method which might (or might not) work for you: set the kernel commandline parameter disable_ipv6 to 1. This is meant to do the same as the sysctl method and might work if your kernel recognizes this commandline parameter. If you're using the GRUB bootloader, you can specify the parameter in /etc/default/grub in the GRUB_CMDLINE_LINUX variable.

As already said: for me the sysctl method works just fine in Squeeze.