1

If I look at the iptables command on a EL7 environment:

bash-4.1# uname -rvos
Linux 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 GNU/Linux

The symlinks end up in a iptables-multi-1.4.7 process in sbin directory.

bash-4.1# namei /sbin/iptables
f: /sbin/iptables
 d /
 d sbin
 l iptables -> /etc/alternatives/iptables.x86_64
   d /
   d etc
   d alternatives
   l iptables.x86_64 -> /sbin/iptables-1.4.7
     d /
     d sbin
     l iptables-1.4.7 -> iptables-multi
       l iptables-multi -> /etc/alternatives/sbin-iptables-multi.x86_64
         d /
         d etc
         d alternatives
         l sbin-iptables-multi.x86_64 -> /sbin/iptables-multi-1.4.7
           d /
           d sbin
           - iptables-multi-1.4.7

If I run iptables-multi-1.4.7 with the same parameters as iptables, it gives me an unknown subcommand error.

bash-4.1# iptables --list INPUT 1
KUBE-FIREWALL  all  --  anywhere             anywhere

bash-4.1# iptables-multi-1.4.7 --list INPUT 1
iptables multi-purpose version: unknown subcommand "--list"

Even though they are the same binary (symlinked to each other) same command line parameters generate different output. What is the right way of invoking iptables-multi-1.4.7 ?

  • The help also does not give a useful information. bash-4.1# iptables-multi-1.4.7 --help iptables multi-purpose version: unknown subcommand "--help" – Hakan Baba Aug 9 '17 at 21:44
0
bash-4.1# iptables-multi-1.4.7 main --list INPUT 1
KUBE-FIREWALL  all  --  anywhere             anywhere

After stumbling over the source code of the iptables-multi I see that it tries to parse the first and the second entries in argv. Passing main as the subcommand falls back to the iptables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.