JohnJohnsonJoe
JohnJohnsonJoe

Reputation: 215

Iptables v1.6.1 can't initialize iptables table `filter' Ubuntu 18.04 Bash Windows

I'm running Ubuntu 18.04 from Windows Bash:

uname -a
Linux DESKTOP-M87DGAS 4.4.0-17134-Microsoft #112-Microsoft Thu Jun 07 22:57:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

I need to open some port with:

sudo ufw allow 22/tcp

But I get the following error:

ERROR: initcaps
[Errno 2] iptables v1.6.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

I get the same error by typing:

iptables -L

I've already upgrade my kernel with:

sudo apt-get update
sudo apt-get full-upgrade

I've tried to reboot the system but it didn't work.

How can I initiate the iptable filter?

Upvotes: 21

Views: 72223

Answers (2)

akez
akez

Reputation: 95

Windows restrict that command in WSL without authorization from administrator.

You just have to run WSL on CMD/Powershell/Ubuntu.exe as administator, then try this command again:

sudo iptables -L -v

I tested on WSL v1, but it should also work on WSL v2.

Upvotes: 7

Jon
Jon

Reputation: 3671

According to the Microsoft WSL page on github.com, iptables isn't supported.

https://github.com/Microsoft/WSL/issues/767

There is a uservoice page for requesting support at

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/32025199-support-iptables

Upvotes: 20

Related Questions