The Set-Up

This is a set up. Rush. Adrenaline.

Now that we have our Debian server installed, I like to do some post install set up. First, I disable ipv6. You may argue that by doing so I am a luddite. And, you’d be right. But I don’t have ipv6 on my network. I have a router that NATs to the internet, so I think I’ll be fine with the ipv4 address space.

There are a number of ways to disable ipv6 on your Debian machine. You can run the following commands. But it won’t be persistent, meaning after reboot ipv6 will be enabled again.

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

Confirm that it worked by running sudo sysctl -p.

To have ipv6 disabled permanently, edit /etc/sysctl.conf with your favorite text editor, I prefer nano, so like this sudo nano /etc/sysctl.conf. And add the following at the end:

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

Another way to disable ipv6 is to give the GRand Unified Bootloader (GRUB) the Linux kernel boot parameters. To do so edit /etc/default/grub and change the lines GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX to include parameter ipv6.disable=1. After editing the file, run sudo update-grub to, you guessed it, update GRUB.

Alternatively, create a bash script with the code below and run it as root.

#Disable ipv6
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
sysctl -w net.ipv6.conf.lo.disable_ipv6=1

#Update GRUB kernel parameters
sed -i'.bak' -e '/^GRUB_CMDLINE_LINUX.*/ s/"$/ ipv6.disable=1"/g;s/=" /="/g' /etc/default/grub
update-grub

#Update sysctl.conf file
cat >> /etc/sysctl.conf<< EOF
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
EOF
sysctl -p

This is it for now. Not much trouble with these parts, just editing the config files. But hey. It’s free, at least.