1

In linux, if you need to bridge NICs, bridge module will be loaded automatically. But one of bridge's dependency is ipv6. Is there any way to overwirte ipv6 dependency since I only need ipv4? I have tried to blacklist the module but it's not working at all.

Edit: The question is not asking how to disable ipv6, instead I want to know how to load bridge without ipv6 module. The question is not duplicate.

0

From its configuration definition:

depends on: CONFIG_IPV6 || CONFIG_IPV6 = CONFIG_n

it appears the bridge module either depends on the ipv6 module if it was compiled in (built-in or as module), or won't depend on it if it was not compiled in at all in kernel. So if you never want to use IPv6 you could simply use a kernel not having the CONFIG_IPV6 option set.

If that's not an option, you can do one of these things:

  • First load the ipv6 module (modprobe ipv6), then immediately disable IPv6, for the interface, or for any other or all interfaces, by changing the disable_ipv6 toggle to 1 with:

    echo 1 > /proc/sys/net/ipv6/conf/someinterface/disable_ipv6
    

    or using the equivalent sysctl (more sudo or ip netns friendly):

    sysctl -w net.ipv6.conf.someinterface.disable_ipv6=1
    

    The ipv6 module has first to be loaded to enable disabling its functionalities! else the toggles above won't be available.

    It's indeed probably a good idea to disable IPv6 on the bridge interface itself.

    If you want to disable any use of ipv6, including newer interfaces appearing later:

    sysctl -w net.ipv6.conf.default.disable_ipv6=1
    sysctl -w net.ipv6.conf.all.disable_ipv6=1
    
  • There's also a kernel boot option ipv6.disable=1 , which might be better suited for limited environment (eg embedded), and which might not install at all the ipv6 code, but I didn't test if it's compatible with your bridge "activation".

    Add "ipv6.disable=1" to the boot option, then save your grub file:

    GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
    

    Details for this boot option in this AskUbuntu answer: How to disable IPv6 permanently?

  • And then I'm thinking that this should also work (but I couldn't test it either since I have IPv6 builtin): instead of simply doing modprobe ipv6 in the first method, try this instead:

    modprobe ipv6 disable=1
    

    or

    modprobe ipv6 disable_ipv6=1
    

    before it was ever loaded. If this works, then you can add it as an option with something like this:

    options ipv6 disable=1 disable_ipv6=1 #pick the right option
    

    in a file called for example /etc/modprobe.d/disable-ipv6.conf.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.