Need help disable ipV6 at startup

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
briliath
Level 1
Level 1
Posts: 33
Joined: Wed Feb 15, 2017 10:03 pm

Need help disable ipV6 at startup

Post by briliath »

Hello,
I am using Linux Mint and I have found out that I am leaking ipV6 even when using my VPN. So I found a way to disable ipV6 by doing this:

sudo sh -c "echo 'net.ipv6.conf.all.disable_ipv6=1\nnet.ipv6.conf.default.disable_ipv6=1\nnet.ipv6.conf.lo.disable_ipv6=1' >> /etc/sysctl.conf"

then this:

sudo sysctl -p

and it all works like a charm. The thing is - I have to do this every time I boot up. Can someone explain to me (I'm still sort of a noob) how I can write a script to have these commands work automatically at startup, so my ipV6 is automatically disabled every time I start the computer? I would need it all explained in simple terms. I have never written a script before. Thanks for any help.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
thx-1138
Level 8
Level 8
Posts: 2092
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Need help disable ipV6 at startup

Post by thx-1138 »

Code: Select all

gksudo xed /etc/default/grub
Change:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
To=>

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
Then run in a terminal:

Code: Select all

sudo update-grub
Reboot - that's all to it.
To undo: repeat the above after you have (...obviously) removed ipv6.disable=1 from the grub entry...
briliath
Level 1
Level 1
Posts: 33
Joined: Wed Feb 15, 2017 10:03 pm

Re: Need help disable ipV6 at startup

Post by briliath »

Thanks!!!! That was so easy even I could do it. Do you know - will I need to do this every time I update to a new kernel? Or will this stick around until I remove it? The latest one I have is 4.13.0-31
User avatar
thx-1138
Level 8
Level 8
Posts: 2092
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Need help disable ipV6 at startup

Post by thx-1138 »

briliath wrote:Or will this stick around until I remove it?
Unless you change it back manually yourself, it will stick... :)
briliath
Level 1
Level 1
Posts: 33
Joined: Wed Feb 15, 2017 10:03 pm

Re: Need help disable ipV6 at startup

Post by briliath »

FANTASTIC. Thank you so much!
Locked

Return to “Networking”