I am trying install iptables for UFW but having issues with it.
Here is how I am installing iptables:
agganu@agganuserver:~$ sudo apt-get install iptables
Reading package lists... Done
Building dependency tree
Reading state information... Done
iptables is already the newest version (1.8.4-3ubuntu2).
The following packages were automatically installed and are no longer required:
augeas-lenses libaugeas0 libfwupdplugin1 python3-acme python3-augeas python3-certbot python3-configargparse python3-icu python3-josepy python3-mock python3-parsedatetime python3-pbr
python3-requests-toolbelt python3-rfc3339 python3-zope.component python3-zope.event python3-zope.hookable
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 93 not upgraded.
As you can see, I get the message that the iptables is already installed.
But when I check check the status of your current iptables I am receiving an error.
agganu@agganuserver:~$ sudo iptables -L -v
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.4.0-96-generic
iptables v1.8.4 (legacy): can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
Can you please let me know how to resolve this so that I can install UFW.
Here is my system information:
.-/+oossssoo+/-. agganu@agganuserver
`:+ssssssssssssssssss+:` -------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 20.04.4 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: Super Server 0123456789
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.4.0-96-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 11 days, 3 hours, 26 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 1093 (dpkg), 10 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: bash 5.0.17
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 5440x2160
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Theme: Adwaita [GTK3]
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Icons: Adwaita [GTK3]
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Terminal: /dev/pts/0
.ssssssssdMMMNhsssssssssshNMMMdssssssss. CPU: Intel Xeon D-1521 (8) @ 2.700GHz
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ GPU: 0a:00.0 ASPEED Technology, Inc. ASPEED Graphics Family
+sssssssssdmydMMMMMMMMddddyssssssss+ Memory: 1141MiB / 32008MiB
/ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.
Any help is greatly appreciated.
Thanks
apt upgrade
? Seems you updated your kernel but you didn't restart and the system isn't yet using it. – earthmeLon Jul 11 '22 at 19:09lsmod | grep ip_tables
? Update/upgrade. If for some reason you don't have the module loaded you might need to (re)install it (to get why this package:dpkg -S /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/ip_tables.ko
) – Pablo Bianchi Jul 11 '22 at 19:28