Dear friends something really strange is happening in my system. The ip_tables module did not seem to be installed so I proceeded to reinstall the kernel and all modules:
sudo apt-get install linux-generic
reboot
sudo apt install iptables-persistent
sudo apt install --reinstall linux-image-$(uname -r) -y
sudo apt install --reinstall linux-modules-$(uname -r) -y
sudo apt install --reinstall linux-modules-extra-$(uname -r) -y
After these steps it seemed that ip-tables was working (I want to use it with fail2ban)
sudo lsmod | grep ip_tables
ip_tables 32768 1 iptable_filter
x_tables 40960 2 iptable_filter,ip_tables
sudo iptables -L -n -v
Chain INPUT (policy ACCEPT 996 packets, 70572 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 2344 packets, 7842K bytes)
pkts bytes target prot opt in out source destination
But after one more reboot it all seemed to disappear forcing me to do a new installation. Do you have any idea what is going on?
$ sudo lsmod | grep ip_tables
$ sudo iptables -L -n -v
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.4.0-182-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.