Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 21878  / 2 Years ago, tue, june 7, 2022, 8:50:53

I have migrated my Ubuntu Focal server firewall backend from legacy iptables to netfilter, by running update-alternatives --set iptables /usr/sbin/iptables-nft and rebooting the server. Now all tables shown in iptables-legacy -S are empty, but when I run iptables -S the last line always says:


# Warning: iptables-legacy tables present, use iptables-legacy to see them

I have since removed iptables-legacy from alternatives using the following command:


update-alternatives --remove iptables /usr/sbin/iptables-legacy

And now only the netfilter version is shown


root@iBug-Server:~# update-alternatives --display iptables
iptables - auto mode
link best version is /usr/sbin/iptables-nft
link currently points to /usr/sbin/iptables-nft
link iptables is /usr/sbin/iptables
slave iptables-restore is /usr/sbin/iptables-restore
slave iptables-save is /usr/sbin/iptables-save
/usr/sbin/iptables-nft - priority 20
slave iptables-restore: /usr/sbin/iptables-nft-restore
slave iptables-save: /usr/sbin/iptables-nft-save

How can I get rid of this warning?


More From » networking

 Answers
3

As the error messages says, it's because the legacy (non-netfilter) iptables subsystem is present. The most common cause is that the iptables-legacy command is called, which loads the legacy modules.


There are 5 modules related to legacy iptables, one for each table. (Note: The module names begin with iptable_, no S here)


iptable_filter
iptable_nat
iptable_mangle
iptable_raw
iptable_security

When ANY of them is loaded, iptables-nft decides that the legacy iptables is present, and emits the said warning.


Similarly, there are 5 more modules for legacy IPv6 iptables, each beginning with ip6table_ (no S here, too).


After migrating to netfilter, those 10 modules can be safely removed with rmmod and blacklisted.


Note again that using blacklist iptable_filter doesn't work here because this directive only prevents automatic loading, but not manual loading via modprobe(8) or another command. This solution using install <modulename> /bin/false should correctly prevent the module from loading under any circumstances.


[#2323] Tuesday, June 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tionavocad

Total Points: 189
Total Questions: 101
Total Answers: 118

Location: Liechtenstein
Member since Wed, Dec 8, 2021
2 Years ago
tionavocad questions
Tue, May 23, 23, 00:07, 1 Year ago
Tue, Jan 17, 23, 20:38, 1 Year ago
Sun, Oct 10, 21, 04:50, 3 Years ago
;