<chapter id="eupsq"><title>Solaris IP Filter (Overview)</title><highlights><para>This chapter provides an overview of Solaris IP Filter. For Solaris
IP Filter tasks, see <olink targetptr="ipfilter-admin-1" remap="internal">Chapter&nbsp;26, Solaris IP Filter (Tasks)</olink>.</para><para>This chapter contains the following information:</para><itemizedlist remap="jumplist"><listitem><para><olink targetptr="fvcbo" remap="internal">What's New in Solaris IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="eupss" remap="internal">Introduction to Solaris IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="gaufw" remap="internal">Solaris IP Filter Packet Processing</olink></para>
</listitem><listitem><para><olink targetptr="ezltg" remap="internal">Guidelines for Using Solaris IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="ezecz" remap="internal">Using Solaris IP Filter Configuration
Files</olink></para>
</listitem><listitem><para><olink targetptr="ezecx" remap="internal">Working With Solaris IP Filter Rule
Sets</olink></para>
</listitem><listitem><para><olink targetptr="gdwan" remap="internal">Packet Filter Hooks</olink></para>
</listitem><listitem><para><olink targetptr="fxxrb" remap="internal">IPv6 for Solaris IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="euqex" remap="internal">Solaris IP Filter Man Pages</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="fvcbo"><title>What's New in Solaris IP Filter</title><para>This section describes new Solaris IP Filter features in the Solaris release.</para><para>For a complete listing of new Solaris features and a description of
Solaris releases, see <olink targetdoc="solwhatsnew" remap="external"><citetitle remap="book">Solaris Express, Developer Edition What&rsquo;s New</citetitle></olink></para><sect2 id="gdwak"><title>Packet
Filter Hooks</title><para>Solaris Express, Developer Edition 2/07 Release:
Packet filter hooks are now used for packet filtering in the Solaris Operating
System. This feature offers the following advantages in system administration:</para><itemizedlist><listitem><para>Packet filter hooks simplify the configuration of the Solaris
IP filter.</para>
</listitem><listitem><para>Support for filtering packets across zones is now available.</para>
</listitem><listitem><para>Using filter hooks improves the performance of Solaris IP
Filter.</para>
</listitem>
</itemizedlist><para>For further details about these hooks, see <olink targetptr="gdwan" remap="internal">Packet
Filter Hooks</olink>. For tasks that are associated with packet filter hooks,
see <olink targetptr="ipfilter-admin-1" remap="internal">Chapter&nbsp;26, Solaris IP Filter (Tasks)</olink>.</para>
</sect2><sect2 id="fvixt"><title>IPv6 Packet Filtering for Solaris IP Filter</title><para>Solaris 10 6/06: For system administrators who have all or part of their
network infrastructure configured with IPv6, Solaris IP Filter has been enhanced
to include IPv6 packet filtering. IPv6 packet filtering can filter based on
the source/destination IPv6 address, pools containing IPv6 addresses, and
IPv6 extension headers. </para><para>The <option>6</option> option has been added to both the <command>ipf</command> command
and the <command>ipfstat</command> command to use with IPv6. Although there
is no change to the command line interface for the <command>ipmon</command> and <command>ippool</command> commands, these commands also support IPv6. The <command>ipmon</command> command
has been enhanced to accommodate the logging of IPv6 packets, and the <command>ippool</command> command supports the inclusion of IPv6 addresses in pools.</para><para>For more information see IPv6 for Solaris IP Filter. For tasks associated
with IPv6 packet filtering, see <olink targetptr="ipfilter-admin-1" remap="internal">Chapter&nbsp;26, Solaris IP Filter (Tasks)</olink>.</para>
</sect2>
</sect1><sect1 id="eupss"><title>Introduction to Solaris IP Filter</title><para>Solaris IP Filter replaces the <trademark>SunScreen</trademark> firewall
as the firewall software for the Solaris Operating System (Solaris OS). Like
the SunScreen firewall, Solaris IP Filter provides stateful packet filtering
and network address translation (NAT). Solaris IP Filter also includes stateless
packet filtering and the ability to create and manage address pools.</para><para>Packet filtering provides basic protection against network-based attacks.
Solaris IP Filter can filter by IP address, port, protocol, network interface,
and traffic direction. Solaris IP Filter can also filter by an individual
source IP address, a destination IP address, by a range of IP addresses, or
by address pools.</para><para>Solaris IP Filter is derived from open source IP Filter software. To
view license terms, attribution, and copyright statements for open source
IP Filter, the default path is <filename>/usr/lib/ipf/IPFILTER.LICENCE</filename>.
If the Solaris OS has been installed anywhere other than the default, modify
the given path to access the file at the installed location.</para><sect2 id="faprs"><title>Information Sources for Open Source IP Filter</title><para>The home page for the open source IP Filter software by Darren Reed
is found at <ulink url="http://coombs.anu.edu.au/~avalon/ip-filter.html" type="url"></ulink>. This site includes information for open source IP Filter,
including a link to a tutorial entitled &ldquo;IP Filter Based Firewalls HOWTO&rdquo;
(Brendan Conoboy and Erik Fichtner, 2002). This tutorial provides step-by-step
instructions for building firewalls in a BSD UNIX environment. Although written
for a BSD UNIX environment, the tutorial is also relevant for the configuration
of Solaris IP Filter.</para>
</sect2>
</sect1><sect1 id="gaufw"><title>Solaris IP Filter Packet Processing</title><para>Solaris IP Filter executes a sequence of steps as a packet is processed.
The following diagram illustrates the steps of packet processing and how filtering
integrates with the TCP/IP protocol stack.</para><figure id="gawjh"><title>Packet Processing Sequence</title><mediaobject><imageobject><imagedata entityref="IPFilterPackProcSeq"/>
</imageobject><textobject><simpara>Shows the sequence of steps associated with Solaris IP
Filter packet processing.</simpara>
</textobject>
</mediaobject>
</figure><para>The packet processing sequence includes the following:</para><itemizedlist><listitem><para><emphasis role="strong">Network Address Translation (NAT)</emphasis></para><para>The translation of a private IP address to a different public address,
or the aliasing of multiple private addresses to a single public one. NAT
allows an organization to resolve the problem of IP address depletion when
the organization has existing networks and needs to access the Internet.</para>
</listitem><listitem><para><emphasis role="strong">IP Accounting</emphasis></para><para>Input
and output rules can be separately set up, recording the number of bytes that
pass through. Each time a rule match occurs, the byte count of the packet
is added to the rule and allows for collection of cascading statistics.</para>
</listitem><listitem><para><emphasis role="strong">Fragment Cache Check</emphasis></para><para>If the next packet in the current traffic is a fragment and the previous
packet was allowed, the packet fragment is also allowed, bypassing state table
and rule checking.</para>
</listitem><listitem><para><emphasis role="strong">Packet State Check</emphasis></para><para>If <literal>keep state</literal> is included in a rule, all packets
in a specified session are passed or blocked automatically, depending on whether
the rule says <literal>pass</literal> or <literal>block</literal>.</para>
</listitem><listitem><para><emphasis role="strong">Firewall Check</emphasis></para><para>Input
and output rules can be separately set up, determining whether or not a packet
will be allowed through Solaris IP Filter, into the kernel's TCP/IP routines, or out
onto the network.</para>
</listitem><listitem><para><emphasis role="strong">Groups</emphasis></para><para>Groups
allow you to write your rule set in a tree fashion.</para>
</listitem><listitem><para><emphasis role="strong">Function</emphasis></para><para>A
function is the action to be taken. Possible functions include <literal>block</literal>, <literal>pass</literal>, <literal>literal</literal>, and <literal>send ICMP response</literal>.</para>
</listitem><listitem><para><emphasis role="strong">Fast-route</emphasis></para><para>Fast-route
signals Solaris IP Filter to not pass the packet into the UNIX IP stack for routing,
which results in a TTL decrement.</para>
</listitem><listitem><para><emphasis role="strong">IP Authentication</emphasis></para><para>Packets that are authenticated are only passed through the firewall
loops once to prevent double-processing.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="ezltg"><title>Guidelines for Using Solaris IP Filter</title><itemizedlist><listitem><para>Solaris IP Filter is managed by the SMF services svc:/network/pfil
and svc:/network/ipfilter. For a complete overview of SMF, see <olink targetdoc="sysadv1" targetptr="hbrunlevels-25516" remap="external">Chapter 14, <citetitle remap="chapter">Managing Services (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.
For information on the step-by-step procedures that are associated with SMF,
see <olink targetdoc="sysadv1" targetptr="faauf" remap="external">Chapter 15, <citetitle remap="chapter">Managing Services (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</listitem><listitem><para>Solaris IP Filter requires direct editing of configuration
files.</para>
</listitem><listitem><para>Solaris IP Filter is installed as part of the Solaris OS.
By default, Solaris IP Filter is not activated after a fresh install. To configure
filtering, you must edit configuration files and manually activate Solaris
IP Filter. You can activate filtering by either rebooting the system or by
plumbing the interfaces using the <command>ifconfig</command> command. For
more information, see the <olink targetdoc="refman1m" targetptr="ifconfig-1m" remap="external"><citerefentry><refentrytitle>ifconfig</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page. For the tasks associated with enabling Solaris
IP Filter, see <olink targetptr="etmhi" remap="internal">Configuring Solaris IP Filter</olink>.</para>
</listitem><listitem><para>To administer Solaris IP Filter, you must be able to assume
a role that includes the IP Filter Management rights profile, or become superuser.
You can assign the IP Filter Management rights profile to a role that you
create. To create the role and assign the role to a user, see <olink targetdoc="sysadv6" targetptr="rbactask-15" remap="external"><citetitle remap="section">Configuring RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</listitem><listitem><para>IP Network Multipathing (IPMP) supports stateless filtering
only.</para>
</listitem><listitem><para>Sun Cluster configurations do not support filtering with Solaris
IP Filter.</para>
</listitem><listitem><para>Filtering between zones is not currently supported with Solaris
IP Filter.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="ezecz"><title>Using Solaris IP Filter Configuration Files</title><para>Solaris IP Filter can be used to provide firewall services or network
address translation (NAT). Solaris IP Filter can be implemented using loadable
configuration files. Solaris IP Filter includes a directory called <filename>/etc/ipf</filename>. You can create and store configuration files called <filename>ipf.conf</filename>, <filename>ipnat.conf</filename> and <filename>ippool.conf</filename> in
the <filename>/etc/ipf</filename> directory. These files are loaded automatically
during the boot process when they reside in the <filename>/etc/ipf</filename> directory.
You can also store the configuration files in another location and load the
files manually. For example configuration files, see <olink targetptr="ipfilter-admin-2" remap="internal">Creating and Editing Solaris IP Filter Configuration
Files</olink>.</para>
</sect1><sect1 id="ezecx"><title>Working With Solaris IP Filter Rule Sets</title><para>To manage your firewall, you use Solaris IP Filter to specify rule sets
that you use to filter your network traffic. You can create the following
types of rule sets:</para><itemizedlist><listitem><para>Packet filtering rule sets</para>
</listitem><listitem><para>Network Address Translation (NAT) rule sets</para>
</listitem>
</itemizedlist><para>Additionally, you can create address pools to reference groups of IP
addresses. You can then use these pools later in a rule set. The address pools
help to speed up rule processing. Address pools also make managing large groups
of addresses easier.</para><sect2 id="euqfb"><title>Using Solaris IP Filter's Packet Filtering Feature</title><para>You set up packet filtering by using packet filtering rule sets. Use
the <command>ipf</command> command to work with packet filtering rule sets.
For more information on the <command>ipf</command> command, see the <olink targetdoc="refman1m" targetptr="ipf-1m" remap="external"><citerefentry><refentrytitle>ipf</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> command.</para><para>You can create packet filtering rules either at the command line, using
the <command>ipf</command> command, or in a packet filtering configuration
file. If you want the packet filtering rules to be loaded at boot time, create
a configuration file called <filename>/etc/ipf/ipf.conf</filename> in which
to put packet filtering rules. If you do not want the packet filtering rules
loaded at boot time, put the <filename>ipf.conf</filename> file in a location
of your choice, and manually activate packet filtering by using the <command>ipf</command> command.</para><para>You can maintain two sets of packet filtering rule sets with Solaris
IP Filter, the active rule set and the inactive rule set. In most cases, you
work with the active rule set. However, the <command>ipf <option>I</option></command> command
enables you to apply the command action to the inactive rule list. The inactive
rule list is not used by Solaris IP Filter unless you select it. The inactive
rule list provides you with a place to store rules without affecting active
packet filtering.</para><para>Solaris IP Filter processes the rules in the rules list from the beginning
of the configured rules list to the end of the rules list before passing or
blocking a packet. Solaris IP Filter maintains a flag that determines whether
it will or will not pass a packet. It goes through the entire rule set and
determines whether to pass or block the packet based on the last matching
rule.</para><para>There are two exceptions to this process. The first exception is if
the packet matches a rule containing the <literal>quick</literal> keyword.
If a rule includes the <literal>quick</literal> keyword, the action for that
rule is taken, and no subsequent rules are checked. The second exception is
if the packet matches a rule containing the <literal>group</literal> keyword.
If a packet matches a group, only rules tagged with the group are checked.</para><sect3 id="euqfk"><title>Configuring Packet Filtering Rules</title><para>Use the following syntax to create packet filtering rules:</para><para><replaceable>action</replaceable> <literal>[in|out]</literal> <replaceable>option</replaceable> <replaceable>keyword, keyword...</replaceable></para><orderedlist><listitem><para>Each rule begins with an action. Solaris IP Filter applies
the action to the packet if the packet matches the rule. The following list
includes the commonly used actions applied to a packet.</para><variablelist><varlistentry><term><literal>block</literal></term><listitem><para>Prevents the packet from passing through the filter.</para>
</listitem>
</varlistentry><varlistentry><term><literal>pass</literal></term><listitem><para>Allows the packet through the filter.</para>
</listitem>
</varlistentry><varlistentry><term><literal>log</literal></term><listitem><para>Logs the packet but does not determine if the packet is blocked
or passed. Use the <command>ipmon</command> command to view the log.</para>
</listitem>
</varlistentry><varlistentry><term><literal>count</literal></term><listitem><para>Includes the packet in the filter statistics. Use the <command>ipfstat</command> command to view the statistics.</para>
</listitem>
</varlistentry><varlistentry><term><literal>skip</literal> <replaceable>number</replaceable></term><listitem><para>Makes the filter skip over <replaceable>number</replaceable> filtering
rules.</para>
</listitem>
</varlistentry><varlistentry><term><literal>auth</literal></term><listitem><para>Requests that packet authentication be performed by a user
program that validates packet information. The program determines whether
the packet is passed or blocked.</para>
</listitem>
</varlistentry><varlistentry><term><literal>preauth</literal></term><listitem><para>Requests that the filter look at a pre-authenticated list
to determine what to do with the packet.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem><listitem><para>Following the action, the next word must be either <command>in</command> or <command>out</command>. Your choice determines whether the packet filtering rule is
applied to an incoming packet or to an outgoing packet.</para>
</listitem><listitem><para>Next, you can choose from a list of options. If you use more
than one option, they must be in the order shown here.</para><variablelist><varlistentry><term><literal>log</literal></term><listitem><para>Logs the packet if the rule is the last matching rule. Use
the <command>ipmon</command> command to view the log.</para>
</listitem>
</varlistentry><varlistentry><term><literal>quick</literal></term><listitem><para>Executes the rule containing the <literal>quick</literal> option
if there is a packet match. All further rule checking stops.</para>
</listitem>
</varlistentry><varlistentry><term><literal>on</literal> <replaceable>interface-name</replaceable></term><listitem><para>Applies the rule only if the packet is moving in or out of
the specified interface.</para>
</listitem>
</varlistentry><varlistentry><term><literal>dup-to</literal> <replaceable>interface-name</replaceable></term><listitem><para>Copies the packet and sends the duplicate out on <replaceable>interface-name</replaceable> to an optionally specified IP address.</para>
</listitem>
</varlistentry><varlistentry><term><literal>to</literal> <replaceable>interface-name</replaceable></term><listitem><para>Moves the packet to an outbound queue on <replaceable>interface-name</replaceable>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem><listitem><para>After specifying the options, you can choose from a variety
of keywords that determine whether the packet matches the rule. The following
keywords must be used in the order shown here.</para><note><para>By default, any packet that does not match any rule in the configuration
file is passed through the filter.</para>
</note><variablelist><varlistentry><term><literal>tos</literal></term><listitem><para>Filters the packet based on the type-of-service value expressed
as either a hexadecimal or a decimal integer.</para>
</listitem>
</varlistentry><varlistentry><term><literal>ttl</literal></term><listitem><para>Matches the packet based on its time-to-live value. The time-to-live
value stored in a packet indicates the length of time a packet can be on the
network before being discarded.</para>
</listitem>
</varlistentry><varlistentry><term><literal>proto</literal></term><listitem><para>Matches a specific protocol. You can use any of the protocol
names specified in the <filename>/etc/protocols</filename> file, or use a
decimal number to represent the protocol. The keyword <literal>tcp/udp</literal> can
be used to match either a TCP or a UDP packet.</para>
</listitem>
</varlistentry><varlistentry><term><literal>from</literal>/<literal>to</literal>/<literal>all</literal>/<literal>any</literal></term><listitem><para>Matches any or all of the following: the source IP address,
the destination IP address, and the port number. The <literal>all</literal> keyword
is used to accept packets from all sources and to all destinations.</para>
</listitem>
</varlistentry><varlistentry><term><literal>with</literal></term><listitem><para>Matches specified attributes associated with the packet. Insert
either the word <literal>not</literal> or the word <literal>no</literal> in
front of the keyword in order to match the packet only if the option is not
present.</para>
</listitem>
</varlistentry><varlistentry><term><literal>flags</literal></term><listitem><para>Used for TCP to filter based on TCP flags that are set. For
more information on the TCP flags, see the <olink targetdoc="refman4" targetptr="ipf-4" remap="external"><citerefentry><refentrytitle>ipf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</varlistentry><varlistentry><term><literal>icmp-type</literal></term><listitem><para>Filters according to ICMP type. This keyword is used only
when the <literal>proto</literal> option is set to <literal>icmp</literal> and
is not used if the <literal>flags</literal> option is used.</para>
</listitem>
</varlistentry><varlistentry><term><literal>keep</literal> <replaceable>keep-options</replaceable></term><listitem><para>Determines the information that is kept for a packet. The <replaceable>keep-options</replaceable> available include the <literal>state</literal> option
and the <literal>frags</literal> option. The <literal>state</literal> option
keeps information about the session and can be kept on TCP, UDP, and ICMP
packets. The <literal>frags</literal> option keeps information on packet fragments
and applies the information to later fragments. The <replaceable>keep-options</replaceable> allow
matching packets to pass without going through the access control list.</para>
</listitem>
</varlistentry><varlistentry><term><literal>head</literal> <replaceable>number</replaceable></term><listitem><para>Creates a new group for filtering rules, which is denoted
by the number <replaceable>number</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>group</literal> <replaceable>number</replaceable></term><listitem><para>Adds the rule to group number <replaceable>number</replaceable> instead
of the default group. All filtering rules are placed in group 0 if no other
group is specified.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</orderedlist><para>The following example illustrates how to put together the packet filtering
rule syntax to create a rule. To block incoming traffic from the IP address <literal>192.168.0.0/16</literal>, you would include the following rule in the rule
list:</para><screen>block in quick from 192.168.0.0/16 to any</screen><para>For the complete grammar and syntax used to write packet filtering rules,
see the <olink targetdoc="refman4" targetptr="ipf-4" remap="external"><citerefentry><refentrytitle>ipf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page. For tasks associated with packet filtering, see <olink targetptr="ettma" remap="internal">Managing
Packet Filtering Rule Sets for Solaris IP Filter</olink>. For an explanation
of the IP address scheme (<literal>192.168.0.0/16</literal>) shown in the
example, see <olink targetptr="ipplan-1" remap="internal">Chapter&nbsp;2, Planning an IPv4 Addressing Scheme (Tasks</olink>.</para>
</sect3>
</sect2><sect2 id="euqfc"><title>Using Solaris IP Filter's NAT Feature</title><para>NAT sets up mapping rules that translate source and destination IP addresses
into other Internet or intranet addresses. These rules modify the source and
destination addresses of incoming or outgoing IP packets and send the packets
on. You can also use NAT to redirect traffic from one port to another port.
NAT maintains the integrity of the packet during any modification or redirection
done on the packet.</para><para>Use the <command>ipnat</command> command to work with NAT rule lists.
For more information on the <command>ipnat</command> command, see the <olink targetdoc="refman1m" targetptr="ipnat-1m" remap="external"><citerefentry><refentrytitle>ipnat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> command.</para><para>You can create NAT rules either at the command line, using the <command>ipnat</command> command, or in a NAT configuration file. NAT configuration rules
reside in the <command>ipnat.conf</command> file. If you want the NAT rules
to be loaded at boot time, create a file called <filename>/etc/ipf/ipnat.conf</filename> in
which to put NAT rules. If you do not want the NAT rules loaded at boot time,
put the <filename>ipnat.conf</filename> file in a location of your choice,
and manually activate packet filtering with the <command>ipnat</command> command.</para><sect3 id="euxbd"><title>Configuring NAT Rules</title><para>Use the following syntax to create NAT rules:</para><para><replaceable>command</replaceable> <replaceable>interface-name</replaceable> <replaceable>parameters</replaceable></para><orderedlist><listitem><para>Each rule begins with one of the following commands:</para><variablelist><varlistentry><term><literal>map</literal></term><listitem><para>Maps one IP address or network to another IP address or network
in an unregulated round-robin process.</para>
</listitem>
</varlistentry><varlistentry><term><literal>rdr</literal></term><listitem><para>Redirects packets from one IP address and port pair to another
IP address and port pair.</para>
</listitem>
</varlistentry><varlistentry><term><literal>bimap</literal></term><listitem><para>Establishes a bidirectional NAT between an external IP address
and an internal IP address.</para>
</listitem>
</varlistentry><varlistentry><term><literal>map-block</literal></term><listitem><para>Establishes static IP address-based translation. This command
is based on an algorithm that forces addresses to be translated into a destination
range.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem><listitem><para>Following the command, the next word is the interface name,
such as <literal>hme0</literal>.</para>
</listitem><listitem><para>Next, you can choose from a variety of parameters, which determine
the NAT configuration. Some of the parameters include:</para><variablelist><varlistentry><term><literal>ipmask</literal></term><listitem><para>Designates the network mask.</para>
</listitem>
</varlistentry><varlistentry><term><literal>dstipmask</literal></term><listitem><para>Designates the address that <literal>ipmask</literal> is translated
to.</para>
</listitem>
</varlistentry><varlistentry><term><literal>mapport</literal></term><listitem><para>Designates <literal>tcp</literal>, <literal>udp</literal>,
or <literal>tcp/udp</literal> protocols, along with a range of port numbers.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</orderedlist><para>The following example illustrates how to put together the NAT rule syntax
together to create a NAT rule. To rewrite a packet that goes out on the <literal>de0</literal> device with a source address of <literal>192.168.1.0/24</literal> and
to externally show its source address as <literal>10.1.0.0/16</literal>, you
would include the following rule in the NAT rule set:</para><screen>map de0 192.168.1.0/24 -> 10.1.0.0/16</screen><para>For the complete grammar and syntax used to write NAT rules, see the <olink targetdoc="refman4" targetptr="ipnat-4" remap="external"><citerefentry><refentrytitle>ipnat</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page.</para>
</sect3>
</sect2><sect2 id="euqfe"><title>Using Solaris IP Filter's Address Pools Feature</title><para>Address pools establish a single reference that is used to name a group
of address/netmask pairs. Address pools provide processes to reduce the time
needed to match IP addresses with rules.  Address pools also make managing
large groups of addresses easier.</para><para>Address pool configuration rules reside in the <command>ippool.conf</command> file.
If you want the address pool rules to be loaded at boot time, create a file
called <filename>/etc/ipf/ippool.conf</filename> in which to put address pool
rules. If you do not want the address pool rules loaded at boot time, put
the <filename>ippool.conf</filename> file in a location of your choice, and
manually activate packet filtering with the <command>ippool</command> command.</para><sect3 id="euxby"><title>Configuring Address Pools</title><para>Use the following syntax to create an address pool:</para><screen>table role = <replaceable>role-name</replaceable> type = <replaceable>storage-format</replaceable> number = <replaceable>reference-number</replaceable></screen><variablelist><varlistentry><term><literal>table</literal></term><listitem><para>Defines the reference for the multiple addresses.</para>
</listitem>
</varlistentry><varlistentry><term><literal>role</literal></term><listitem><para>Specifies the role of the pool in Solaris IP Filter. At this
time, the only role you can reference is <literal>ipf</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>type</literal></term><listitem><para>Specifies the storage format for the pool.</para>
</listitem>
</varlistentry><varlistentry><term><literal>number</literal></term><listitem><para>Specifies the reference number that is used by the filtering
rule.</para>
</listitem>
</varlistentry>
</variablelist><para>For example, to reference the group of addresses <literal>10.1.1.1 and
10.1.1.2</literal>, and the network <literal>192.16.1.0</literal> as pool
number <literal>13</literal>, you would include the following rule in the
address pool configuration file:</para><programlisting>table role = ipf type = tree number = 13 
{ 10.1.1.1/32, 10.1.1.2/32, 192.168.1.0/24 };</programlisting><para>Then, to reference pool number <literal>13</literal> in a filtering
rule, you would construct the rule similar to the following example:</para><screen>pass in from pool/13 to any</screen><para>Note that you must load the pool file before loading the rules file
that contains a reference to the pool. If you do not, the pool is undefined,
as shown in the following output:</para><screen># ipfstat -io
empty list for ipfilter(out)
block in from pool/13(!) to any</screen><para>Even if you add the pool later, the addition of the pool does not update
the kernel rule set. You also need to reload the rules file that references
the pool.</para><para>For the complete grammar and syntax used to write packet filtering rules,
see the <olink targetdoc="refman4" targetptr="ippool-4" remap="external"><citerefentry><refentrytitle>ippool</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page.</para>
</sect3>
</sect2>
</sect1><sect1 id="gdwan"><title>Packet Filter Hooks</title><para>Beginning with the Solaris Express, Developer Edition 2/07 release,
packet filter hooks replace the <literal>pfil</literal> module to enable Solaris
IP filter. In previous Solaris releases, configuration of the <literal>pfil</literal> module
was required as an additional step to set up Solaris IP Filter. This extra
configuration requirement increased the risk of errors that would cause Solaris
IP Filter to work improperly. The insertion of the <literal>pfil</literal> STREAMS
module between IP and the device driver also caused performance degradation.
Lastly, the <literal>pfil</literal> module could not perform packet interception
between zones.</para><para>The use of packet filter hooks streamlines the procedure to enable Solaris
IP Filter. Through these hooks, Solaris IP Filter uses pre-routing (input)
and post-routing (output) filter taps to control packet flow into and out
of the Solaris system.</para><para>Packet filter hooks eliminate the need for the <literal>pfil</literal> module.
Thus the following components that are associated with the module are also
removed.</para><itemizedlist><listitem><para><literal>pfil</literal> driver</para>
</listitem><listitem><para><literal>pfil</literal> daemon</para>
</listitem><listitem><para><filename>svc:/network/pfil</filename> SMF service</para>
</listitem>
</itemizedlist><para>For tasks associated with enabling Solaris IP Filter, see <olink targetptr="ipfilter-admin-1" remap="internal">Chapter&nbsp;26, Solaris IP Filter (Tasks)</olink>.</para>
</sect1><sect1 id="fxxrb"><title>IPv6 for Solaris IP Filter</title><para>Beginning with the Solaris 10 6/06 release, support for IPv6 is available
with Solaris IP Filter. IPv6 packet filtering can filter based on the source/destination
IPv6 address, pools containing IPv6 addresses, and IPv6 extension headers.</para><para>IPv6 is similar to IPv4 in many ways. However, header and packet size
differ between the two versions of IP, which is an important consideration
for IP Filter. IPv6 packets known as <emphasis>jumbograms</emphasis> contain
a datagram longer than 65,535 bytes. Solaris IP Filter does not support IPv6
jumbograms. To learn more about other IPv6 features, see <olink targetptr="ipv6-overview-8" remap="internal">Major Features of IPv6</olink>.</para><note><para>For more information on jumbograms, refer to the document IPv6
Jumbograms, RFC 2675 from the Internet Engineering Task Force (IETF). [<ulink url="http://www.ietf.org/rfc/rfc2675.txt" type="url">http://www.ietf.org/rfc/rfc2675.txt</ulink>]</para>
</note><para>IP Filter tasks associated with IPv6 do not differ substantially from
IPv4. The most notable difference is the use of the <option>6</option> option
with certain commands. Both the <command>ipf</command> command and the <command>ipfstat</command> command include the <option>6</option> option for use with IPv6
packet filtering. Use the <option>6</option> option with the <command>ipf</command> command
to load and flush IPv6 packet filtering rules. To display IPv6 statistics,
use the <option>6</option> option with the <command>ipfstat</command> command.
The <command>ipmon</command> and <command>ippool</command> commands also support
IPv6, although there is no associated option for IPv6 support. The <command>ipmon</command> command has been enhanced to accommodate the logging of IPv6 packets.
The <command>ippool</command> command supports the pools with IPv6 addresses.
You can create pools of only IPv4 or IPv6 addresses, or a pool containing
both IPv4 and IPv6 addresses within the same pool.</para><para>You can use the <filename>ipf6.conf</filename> file to create packet
filtering rule sets for IPv6. By default, the <filename>ipf6.conf</filename> configuration
file is included in the <filename>/etc/ipf</filename> directory. As with the
other filtering configuration files, the <filename>ipf6.conf</filename> file
loads automatically during the boot process when it is stored in the <filename>/etc/ipf</filename> directory. You can also create and store an IPv6 configuration
file in another location and load the file manually.</para><note><para>Network Address Translation (NAT) does not support IPv6.</para>
</note><para>Once packet filtering rules for IPv6 have been set up, activate IPv6
packet filtering capabilities by plumbing the <literal>inet6</literal> version
of the interface.</para><para>For more information on IPv6, see <olink targetptr="ipv6-overview-7" remap="internal">Chapter&nbsp;3, Planning an IPv6 Addressing Scheme (Overview)</olink>. For tasks associated
with Solaris IP Filter, see <olink targetptr="ipfilter-admin-1" remap="internal">Chapter&nbsp;26, Solaris IP Filter (Tasks)</olink>.</para>
</sect1><sect1 id="euqex"><title>Solaris IP Filter Man Pages</title><para>The following table includes the man page documentation relevant to
Solaris IP Filter.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="38.99*"/><colspec colwidth="61.01*"/><thead><row rowsep="1"><entry><para>Man Page</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><olink targetdoc="refman1m" targetptr="ipf-1m" remap="external"><citerefentry><refentrytitle>ipf</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Use the <command>ipf</command> command to complete the following tasks:</para><itemizedlist><listitem><para>Work with packet filtering rule sets.</para>
</listitem><listitem><para>Disable and enable filtering.</para>
</listitem><listitem><para>Reset statistics and resynchronize the in-kernel interface
list with the current interface status list.</para>
</listitem>
</itemizedlist>
</entry>
</row><row><entry><para><olink targetdoc="refman4" targetptr="ipf-4" remap="external"><citerefentry><refentrytitle>ipf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</entry><entry><para>Contains the grammar and syntax for creating Solaris IP Filter packet
filtering rules.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman5" targetptr="ipfilter-5" remap="external"><citerefentry><refentrytitle>ipfilter</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink></para>
</entry><entry><para>Provides open source IP Filter licensing information.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman1m" targetptr="ipfs-1m" remap="external"><citerefentry><refentrytitle>ipfs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Use the <command>ipfs</command> command to  save and restore NAT information
and state table information across reboots.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman1m" targetptr="ipfstat-1m" remap="external"><citerefentry><refentrytitle>ipfstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Use the <command>ipfstat</command> command to retrieve and display statistics
on packet processing.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman1m" targetptr="ipmon-1m" remap="external"><citerefentry><refentrytitle>ipmon</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Use the <command>ipmon</command> command to open the log device and
view logged packets for both packet filtering and NAT.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman1m" targetptr="ipnat-1m" remap="external"><citerefentry><refentrytitle>ipnat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Use the <command>ipnat</command> command to complete the following tasks:</para><itemizedlist><listitem><para>Work with NAT rules.</para>
</listitem><listitem><para>Retrieve and display NAT statistics.</para>
</listitem>
</itemizedlist>
</entry>
</row><row><entry><para><olink targetdoc="refman4" targetptr="ipnat-4" remap="external"><citerefentry><refentrytitle>ipnat</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</entry><entry><para>Contains the grammar and syntax for creating NAT rules.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman1m" targetptr="ippool-1m" remap="external"><citerefentry><refentrytitle>ippool</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Use the <command>ippool</command> command to create and manage address
pools.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman4" targetptr="ippool-4" remap="external"><citerefentry><refentrytitle>ippool</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</entry><entry><para>Contains the grammar and syntax for creating Solaris IP Filter address
pools.</para>
</entry>
</row><row><entry><para><olink targetdoc="refman1m" targetptr="ndd-1m" remap="external"><citerefentry><refentrytitle>ndd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry><entry><para>Displays current filtering parameters of the <literal>pfil</literal> STREAMS
module and the current values of the tunable parameters.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
</chapter>