7

I am trying to set up an IP6tables firewall on Linux and I basically want to start copying my IPv4 configuration.

One of my rules simply accepts all traffic to the localhost subnet:

iptables -A INPUT -s 127.0.0.0/8 -j ACCEPT

I am a little puzzled though what the equivalent for IPv6 is. Is it as simple as:

ip6tables -A INPUT -s ::/128 -m comment --comment localhost -j ACCEPT

Many sources on internet explain 127.0.0.1, but I am specifically looking for the 127.0.0.0/8 equivalent and I haven't been able to find confirmation yet.

BTW I would expect the ip6tables -vnL counters to increment when I issue:

telnet -6 localhost 22

But that doesn't happen.

  • 1
    Another option would be to allow all traffic on the localhost interface via -A INPUT -i lo -j ACCEPT which could then be duplicated in both the iptables and ip6tables rules. – thrig Nov 24 '15 at 20:30
  • @thrig: Good point, I'll try that one. – jippie Nov 24 '15 at 21:15
15

From Wikipedia:

IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback purposes. That means any packet sent to one of those 16,777,214 addresses (127.0.0.1 through 127.255.255.254) will be looped back. IPv6 has just a single address, ::1.

So for IPv6 its just ::1 or ::1/128.

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.