Shorewall IPv6 SupportTomEastep20082009Thomas M. EastepPermission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version
1.2 or any later version published by the Free Software Foundation; with
no Invariant Sections, with no Front-Cover, and with no Back-Cover
Texts. A copy of the license is included in the section entitled
GNU Free Documentation
License.This article applies to Shorewall 4.3 and
later. If you are running a version of Shorewall earlier than Shorewall
4.3.5 then please see the documentation for that
release.OverviewBeginning with Shorewall 4.2.4, support for firewalling IPv6 is
included as part of Shorewall.PrerequisitesIn order to use Shorewall with IPv6, your firewall must meet the
following prerequisites:Kernel 2.6.24 or
later.Iptables 1.4.0 or later (1.4.1.1 is strongly
recommended)If you wish to include DNS names in your IPv6 configuration
files, you must have Perl 5.10 and must install the Perl Socket6
library.PackagesShorewall IPv6 support introduced two new packages:Shorewall6. This package provides
/sbin/shorewall6 which is the IPv6 equivalent
of /sbin/shorewall.
/sbin/shorewall only handles IPv4 while
/sbin/shorewall6 handles only IPv6.. Shorewall6
depends on Shorewall. The Shorewall6 configuration is stored in
/etc/shorewall6.Shorewall6 Lite. This package is to IPv6 what Shorewall Lite
is to IPv4. The package stores its configuration in /etc/shorewall6-lite. As with Shorewall
Lite, Shorewall6 Lite usually requires no configuration changes on
the firewall system.IPv4/IPv6 InteractionIP connections are either IPv4 or IPv6; there is no such thing as
a mixed IPv4/6 connecton. IPv4 connections are controlled by Shorewall
(or Shorewall-lite); IPv6 connections are controlled by Shorewall6 (or
Shorewall6-lite). Starting and stopping the firewall for one address
family has no effect on the other address family.As a consequence, there is very little interaction between
Shorewall and Shorewall6.DISABLE_IPV6An obvious area where the configuration of Shorewall affects
Shorewall6 is the DISABLE_IPV6 setting in
/etc/shorewall/shorewall.conf. When configuring
Shorewall6, you will want to set DISABLE_IPV6=No and restart Shorewall
or Shorewall-lite.TC_ENABLEDAnother area where their configurations overlap is in traffic
shaping; the tcdevices and tcclasses files do
exactly the same thing in both Shorewall and Shorewall6. Consequently,
you will have TC_ENABLED=Internal in Shorewall or in Shorewall6 and
TC_ENABLED=No in the other product. Also, you will want CLEAR_TC=No in
the configuration with TC_ENABLED=No.Regardless of which product has TC_ENABLED=Internal:IPv4 packet marking is controlled by
/etc/shorewall/tcrulesIPv6 packet marking is controlled by
/etc/shorewall6/tcrulesKEEP_RT_TABLESMulti-ISP users will need to be aware of this one. When there
are entries in the providers file, Shorewall normally installs a
modified /etc/iproute2/rt_tables during
shorewall start and shorewall
restart and restores a default file during
shorewall stop. Setting KEEP_RT_TABLES=Yes in
shorewall.conf(5)
stops Shorewall (Shorewall lite) from modifying
/etc/iproute2/rt_tables.Shorewall6 is also capable of modifying
/etc/iproute2/rt_tables in a similar way.Our recommendation to Multi-ISP users is to:Select the same names for similar providers.Set KEEP_RT_TABLES=No in shorewall.conf(5) and
set KEEP_RT_TABLES=Yes in shorewall6.conf(5).These setting allow Shorewall to control the contents of
/etc/iproute2/rt_tables.6TO4If you are using a 6to4 tunnel for your IPv6 connectivity, you
need an entry in
/etc/shorewall/tunnels.#TYPE ZONE GATEWAY GATEWAY
# ZONE
6to4 net
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVEShorewall6 Differences from ShorewallConfiguring and operating Shorewall6 is very similar to configuring
Shorewall with some notable exceptions:No NATIn Shorewall6, there is no NAT of any kind (Netfilter6 doesn't
support any form of NAT). Most people consider this to be a giant
step forward.When an ISP assigns you an IPv6 address, you are actually
assigned an IPv6 prefix (similar to a
subnet). A 64-bit prefix defines a subnet with 4 billion hosts
squared (the size of the IPv4 address space squared). Regardless of
the length of your prefix, you get to assign local addresses within
that prefix.Default Zone TypeThe default zone type in Shorewall6 is
ipv6. It is suggested that you specify
ipv6 in the TYPE column of
/etc/shorewall6/zones and a type of ipv4 in
/etc/shorewall/zones; that way, if you run the
wrong utility on a configuration, you will get an instant
error.Interface OptionsThe following interface options are available in
/etc/shorewall6/interfaces:blacklistSame as in ShorewallbridgeSame as in ShorewalldhcpInterface is assigned by IPv6 DHCP or the firewall hosts
an IPv6 DHCP server on the interface.maclistSame as in ShorewallnosmurfsChecks the source IP address of packets arriving on the
interface and drops packets whose SOURCE address is:An IPv6 multicast addressThe subnet-router anycast address for any of the
global unicast addresses assigned to the interface.An RFC 2526 anycast address for any of the global
unicast addresses assigned to the interface.optionalSame as in ShorewallroutebackSame as in Shorewallsourceroute[={0|1}]Same as in ShorewalltcpflagsSame as in Shorewallmss=mssSame as in Shorewallforward[={0|1}]Override the setting of IP_FORWARDING in shorewall6.conf
with respect to how the system behaves on this interface. If
1, behave as a router; if 0, behave as a host.Host OptionsThe following host options are available in
/etc/shorewall6/hosts:blacklistSame as in ShorewallmaclistSame as in ShorewallroutebackSame as in ShorewalltcpflagsSame as in ShorewallSpecifying AddressesAnywhere that an address or address list follows a colon
(":"), the address or list may be enclosed in angled brackets
("<" and ">") to improve readability.Example (/etc/shorewall6/rules):#ACTION SOURCE DEST PROTO DEST
# PORT(S)
ACCEPT net $FW:<2002:ce7c:92b4::3> tcp 22When the colon is preceeded by an interface name,
the angle brackets are required. This is true
even when the address is a MAC address in Shorewall format.Example (/etc/shorewall6/rules):#ACTION SOURCE DEST PROTO DEST
# PORT(S)
ACCEPT net:wlan0:<2002:ce7c:92b4::3> tcp 22Beginning with Shorewall 4.4.6 and 4.5.4, square brackets ("["
and "]") may also be used.Example (/etc/shorewall6/rules):#ACTION SOURCE DEST PROTO DEST
# PORT(S)
ACCEPT net:wlan0:[2002:ce7c:92b4::3] tcp 22Stopped StateWhen Shorewall6 or Shorewall6 Lite is in the stopped state,
the following traffic is still allowed.Traffic with a multicast destination IP address
(ff00::/8).Traffic with a link local source address
(ff800::/8)Traffic with a link local destination address.Multi-ISPThe Linux IPv6 stack does not support balancing (multi-hop)
routes. Hence, neither the option in shorewall6-providers(5)
nor USE_DEFAULT_RT=Yes in shorewall6.conf(5) is
supported./sbin/shorewall6 and /sbin/shorewall6-lite CommandsSeveral commands supported by
/sbin/shorewall and
/sbin/shorewall-lite are not supported by
/sbin/shorewall6 and
/sbin/shorewall6-lite:hitsipcalciprangeMacrosThe Shorewall6 package depends on Shorewall-common for
application macros. Only certain address-family specific macros such
as macro.AllowICMPs are included in Shorewall6. As a consequence,
/usr/share/shorewall/ is included in the default Shorewall6
CONFIG_PATH.Installing IPv6 SupportYou will need at least the following packages:Shorewall 4.3.5 or later.Shorewall6 4.3.5 or later.You may also with to install Shorewall6-lite 4.3.5 or later on your
remote firewalls to allow for central IPv6 firewall administration.More information about IPv6I strongly suggest that you read the Linux IPv6 HOWTO.
The 6to4 Tunnels page also includes
instructions for setting up your first IPv6 environment.In addition to the Linux IPv6 HOWTO, I have found the following two
books to be useful:IPv6 Essentials, Silvia Hagen, 2002,
O'Reilly Media, Inc, ISBN 0-596-00125-8.O'Reilly published a second edition of this book in 2006.IPV6 Theory, Protocol, and Practice, Second
Edition, Pete Loshin, 2004, Morgan-Kaufmann Publishers, IBSN
1-55860-820-9