How to disable IPv6 on Debian Wheezy?

32

Solution 1

If you do sysctl -p, the reboot isn't necessary. It worked for me, but I prefer to keep params in single file, so I put the line above in the sysctl.conf file.

Just to be sure, I put a line about every device, so my solution is adding the following lines to /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
net.ipv6.conf.eth1.disable_ipv6 = 1
net.ipv6.conf.ppp0.disable_ipv6 = 1
net.ipv6.conf.tun0.disable_ipv6 = 1

Solution 2

Disabling IPv6 on more recent systems works the same way as described in the Debian wiki:

Disable ipv6 in kernel : echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf will disable ipv6 at next reboot.

Keep in mind that, whatever problem you are having, this should be an absolute last resort after you have exhausted all other options for fixing the problem. IPv6 is not optional and you will have to turn it back on sooner or later.

Share:
32

Related videos on Youtube

Sammy
Author by

Sammy

Updated on September 18, 2022

Comments

  • Sammy
    Sammy over 1 year

    I want to make sure that my update function is executed only by one thread at a time for a given value.

    func update1(int id){
       ...
       makeUpdate(id)
       ...
    }
    
    func update2(int id){
       ...
       makeUpdate(id)
       ...
    }
    

    So, how should I write my makeUpdate() function that the myUpdate block is executed only once for a given id value? That means if update1 is updating the record with the id "15" and update2 with the id "20", the block access should not be synchronized.

    • Admin
      Admin about 11 years
      at least '/sys/module/ipv6/parameters/disable_ipv6' still exists for Kernel 3.2.0xxx
    • Admin
      Admin about 11 years
      @sparkie yeah but wiki.debian.org/DebianIPv6#How_to_turn_off_IPv6 says nothing about /sys/module/ipv6/parameters/disable_ipv6 but /etc/sysctl.d/disableipv6.conf
    • Adrian
      Adrian about 5 years
      That depends on what the records are and how they're held in memory - the body of makeUpdate is pretty important to answer this, but generally speaking in Go your primary synchronization tools are channels and sync.Mutex.
    • Sammy
      Sammy about 5 years
      @Adrian thanks for the answer. However, i don't think the body should matter. The question is really how to synchronize depending on a value each caller has
    • Adrian
      Adrian about 5 years
      The body matters very much, because makeUpdate is what needs to be synchronized, or more specifically, access to the data that makeUpdate is manipulating is what needs to be synchronized.
    • Sammy
      Sammy about 5 years
      @Adrian no, it is not the access to the data that needs to be synched, it is the code in makeUpdate(). Imagine it just calls a service somewhere and we should treat it as a blackbox
    • Adrian
      Adrian about 5 years
      Perhaps you could further explain your situation, because generally speaking, access to data is the only thing that ever needs to be synchronized.
    • Peter
      Peter about 5 years
      You may find the singleflight package useful.
    • Andrew W. Phillips
      Andrew W. Phillips about 5 years
      @Sammy: Are the set of IDs unlimited or a fixed number? That will determine if you have to dynamically create mutexes.
    • Andrew W. Phillips
      Andrew W. Phillips about 5 years
      Just to clarify - I think you are saying you want to serialize "updates" for the same ID but allow updates for different IDs to execute in parallel. You could use a sync.Mutex for each ID but a better way may be to create a channel for each ID and a go-routine for each channel that reads the ID and executes the update.
  • ConstantineK
    ConstantineK over 10 years
    Interestingly I still have ipv6 showing up after following the instructions and verifying the settings listed on the wiki pages persisted after reboots. It might have something to do with the fact that this is running on a vm hosted by someone else.
  • ConstantineK
    ConstantineK about 10 years
    Definitely. I had no interest in doing this but as you may know, many legacy pieces of software with no future development have issues, and that is what I was working with. So, I wish!
  • womp
    womp about 10 years
    This didn't work for me. Jawa's approach did work though. I'm using BAMT1.1, not really sure which version of debian it's based on.
  • Evgeniy Berezovsky
    Evgeniy Berezovsky about 9 years
    Isn't net.ipv6.conf.all.disable_ipv6 = 1 enough? At least iIt did the trick for all interfaces on my machine.
  • Matthew Ayers
    Matthew Ayers about 8 years
    @MichaelHampton OpenVZ isn't a VM system, it's a container/chroot jail-based system, which is probably why you can't mess with its network settings like this...
  • Michael Hampton
    Michael Hampton about 8 years
    @Jules Thanks, but I already know exactly what OpenVZ is.
  • Doktor J
    Doktor J almost 8 years
    Thanks for this! For some reason, on my Raspberry Pi just disabling via net.ipv6.conf.all.disable_ipv6 didn't work; adding an explicit line for my adapter did the trick!
  • Bruno
    Bruno over 5 years
    Same here: it didn't work using net.ipv6.conf.all.disable_ipv6; had to use a line specific for my adapter like this: net.ipv6.conf.enp6s0.disable_ipv6 = 1