I have a strange problem with iptables and my loopback interface.
ifconfig says:
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
for both ipv6 and ipv4 rules, i use this:
-A INPUT -i lo -j ACCEPT
For ipv6 it works fine:
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all ::/0 ::/0 state RELATED,ESTABLISHED
ACCEPT all ::1 ::1
but for ipv4, it opens all ports:
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
the desired solution is archived by:
-A INPUT -s 127.0.0.1 --dst 127.0.0.1 -i lo -j ACCEPT
But why is binding the rule to the interface lo not working for ipv4, but for ipv6 flawlessly?