UFW is not working in an LXC container

6,601

The Fix

Update /etc/default/ufw so that IPV6 is equal to no.

Notes

No ufw disable and ufw enable is required before you can successfully use ufw allow 22.

Note that I've no plans to use IPV6, so it wasn't an issue for me turning it off.

I appreciate this is a bit of a work-around, but it suits my needs.

Share:
6,601

Related videos on Youtube

greggannicott
Author by

greggannicott

Updated on September 18, 2022

Comments

  • greggannicott
    greggannicott over 1 year

    I've created an LXC container on Ubuntu Server 14.04.1 using the default template.

    I log into it, and run the following commands:

    sudo apt-get update
    sudo apt-get install ufw
    sudo ufw allow 22
    

    At this point, I get the following error:

    ERROR: initcaps
    [Errno 2] modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.13.0-32-generic/modules.dep.bin'
    ip6tables v1.4.21: can't initialize ip6tables table `filter': Table does not exist (do you need to insmod?)
    Perhaps ip6tables or your kernel needs to be upgraded.
    
  • mchid
    mchid over 8 years
    if you are not using ipv6, you can disable ipv6 unix.stackexchange.com/a/190189