I am just starting my foray into IPv6.

First, my reference information:

  • Comcast ISP cable-modem
  • Linux firewall/router/gateway machine
    • eth1 points to the Internet with a Comcast-supplied IPv6 /128 address
    • eth0 points to my internal network with a Comcast-supplied IPv6 /64 network
  • Internal Linux machines

Up until now, my security on the internal machines has been primarily based on using RFC1918 addresses and iptables NAT. IPv6 (apparently) does not support NAT.

So I'm hoping that somebody has a simple tutorial on how I can configure ip6tables on my linux-firewall-router to ensure that I have lots of outgoing access, but

  • only established connections come in
  • only the necessary ICMPv6 connections can come in, but no unnecessary ones
  • perhaps some kind of knockd-esque way to allow me but nobody else to access internal machines from the Internet
    • I think the answer to this one is "SSH certificates and disallow all password login"

Sadly, as far as I can tell, Amazon EC2 does not do IPv6. Otherwise, that would be a great way to test my configuration.

1 Answer 1


IPv6 (apparently) does not support NAT.

The standards folks strongly discourage IPv6 NAT but that doesn't prevent people from implementing it. There is no fundamental difference that makes IPv6 NAT any easier or harder than IPv4 NAT. The subject of IPv6 NAT in Linux was a contraversial one but it was eventually implemented in Linux 3.7.

ip6tables is the ipv6 counterpart to iptables. The setup for a basic firewall that allows everything outgoing but only allows specific stuff incoming and doesn't restrict access to the firewall box itself is pretty simple.

  1. Set the forward chain policy to drop (I always reccomend setting chain policy to drop so that when you flush and reset the rules you don't leave yourself wide open)
  2. Add a rule in the forward table to allow packets from inside to outside.
  3. Add a rule in the forward table to allow packets with "established" and "related" connection tracking states. This allows responses related to your outgoing connections without opening you up to the Internet in general.
  4. Add rules for anything you want to allow.

If you want to restrict access to the firewall box itself life gets a bit trickier becuase you have to make sure you allow things like SLACC. There are some examples at https://www.sixxs.net/wiki/IPv6_Firewalling

If you are trying to limit traffic to/from the router itself (rather than just limit forwarded traffic) you will need to allow neighbour discovery and neigbour advertisements.

I belive what you need is (taken from https://www.cert.org/downloads/IPv6/ip6tables_rules.txt )

ip6tables -A INPUT -p icmpv6 --icmpv6-type router-advertisement -m hl --hl-eq 255 -j ACCEPT
ip6tables -A INPUT -p icmpv6 --icmpv6-type neighbor-solicitation -m hl --hl-eq 255 -j ACCEPT
ip6tables -A INPUT -p icmpv6 --icmpv6-type neighbor-advertisement -m hl --hl-eq 255 -j ACCEPT
ip6tables -A INPUT -p icmpv6 --icmpv6-type redirect -m hl --hl-eq 255 -j ACCEPT
  • I am looking for more specific information. "Add rules for anything you want to allow." What do I need to allow? When I set the INPUT chain to DROP, then I don't get an IPv6 address from the rotuer.
    – hymie
    Commented Jul 15, 2017 at 12:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .