<chapter id="ipfilter-admin-1"><title>Solaris IP Filter (Tasks)</title><highlights><para>This chapter provides step-by-step instructions for Solaris IP Filter tasks. For
overview information about Solaris IP Filter, see <olink targetptr="eupsq" remap="internal">Chapter&nbsp;25, Solaris IP Filter (Overview)</olink>.</para><para>This chapter contains the following information:</para><itemizedlist remap="jumplist"><listitem><para><olink targetptr="etmhi" remap="internal">Configuring Solaris IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="fabar" remap="internal">Deactivating and Disabling Solaris
IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="eubbd" remap="internal">Working With Solaris IP Filter Rule
Sets</olink></para>
</listitem><listitem><para><olink targetptr="faaxo" remap="internal">Displaying Statistics and Information
for Solaris IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="faavk" remap="internal">Working With Log Files for Solaris
IP Filter</olink></para>
</listitem><listitem><para><olink targetptr="ipfilter-admin-2" remap="internal">Creating and Editing Solaris
IP Filter Configuration Files</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="etmhi"><title>Configuring Solaris IP Filter</title><para>The following task map identifies the procedures associated with configuring
Solaris IP Filter.</para><table frame="topbot" id="euazt"><title>Configuring Solaris IP Filter (Task
Map)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Initially enable Solaris IP Filter.</para>
</entry><entry><para>Solaris IP Filter is not enabled by default. You must either enable
it manually or use the configuration files in the <filename>/etc/ipf/</filename> directory
and reboot the system.
Beginning with Solaris Express, Developer Edition 2/07 release,
packet filter hooks replaced the <literal>pfil</literal> module to enable
Solaris IP filter.</para>
</entry><entry><para><olink targetptr="gdwzk" remap="internal">How to Enable Solaris IP Filter</olink></para>
</entry>
</row><row><entry><para>Re-enable Solaris IP Filter.</para>
</entry><entry><para>If Solaris IP Filter is deactivated or disabled, you can re-enable Solaris
IP Filter either by rebooting the system or by using the <command>ipf</command> command.</para>
</entry><entry><para><olink targetptr="eubbr" remap="internal">How to Re-Enable Solaris IP Filter</olink></para>
</entry>
</row><row><entry><para>Enable loopback filtering</para>
</entry><entry><para>As an option, you can enable loopback filtering, for example, to filter traffic
between zones.</para>
</entry><entry><para><olink targetptr="gdwzr" remap="internal">How to Enable Loopback Filtering</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><task id="gdwzk"><title>How to Enable Solaris IP Filter</title><tasksummary><para>Use this procedure to enable Solaris IP Filter on a system that is running
at least  Solaris Express, Developer Edition 2/07 OS.</para>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Create a packet filtering rule set.</para><para>The packet filtering
rule set contains packet filtering rules that are used by Solaris IP Filter.
If you want the packet filtering rules to be loaded at boot time, edit the <filename>/etc/ipf/ipf.conf</filename> file to implement IPv4
packet filtering. Use the <filename>/etc/ipf/ipf6.conf</filename> file
for IPv6 packet filtering rules. If you do not want the packet filtering
rules loaded at boot time, put the rules in a file of your choice, and manually
activate packet filtering. For information about packet filtering, see <olink targetptr="euqfb" remap="internal">Using Solaris IP Filter's Packet Filtering Feature</olink>.
For information about working with configuration files, see <olink targetptr="ipfilter-admin-2" remap="internal">Creating and Editing Solaris IP Filter Configuration
Files</olink>.</para>
</step><step><para>(Optional) Create a network address translation (NAT) configuration
file.</para><note><para>Network Address Translation
(NAT) does not support IPv6.</para>
</note><para>Create an <filename>ipnat.conf</filename> file if you want to use network address translation. 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 the NAT rules.</para><para>For more information
about NAT, see <olink targetptr="euqfc" remap="internal">Using Solaris IP Filter's NAT Feature</olink>.</para>
</step><step><para>(Optional) Create an address pool configuration file.</para><para>Create
an <filename>ipool.conf</filename> file if you want to refer to a group of
addresses as a single address pool. If you want the address pool configuration
file to be loaded at boot time, create a file called <filename>/etc/ipf/ippool.conf</filename> in which to put the address pool. If you do not want the address
pool configuration file to be loaded at boot time, put the <filename>ippool.conf</filename> file
in a location of your choice, and manually activate the rules.</para><para>An address pool can contain only IPv4 addresses or only IPv6 addresses. It
can also contain both IPv4 and IPv6 addresses.</para><para>For more information
about address pools, see <olink targetptr="euqfe" remap="internal">Using Solaris IP Filter's
Address Pools Feature</olink>.</para>
</step><step><para>(Optional) Enable filtering of loopback traffic.</para><para>If
you intend to filter traffic between zones that are configured in your system,
you must enable loopback filtering. See <olink targetptr="gdwzr" remap="internal">How to Enable
Loopback Filtering</olink>. Make sure that you also define the appropriate
rule sets that apply to the zones.</para>
</step><step><para>Activate Solaris IP Filter.</para><screen># <userinput>svcadm enable network/ipfilter</userinput></screen>
</step>
</procedure>
</task><task id="eubbr"><title>How to Re-Enable Solaris IP Filter</title><tasksummary><para>You can re-enable packet filtering after it has been temporarily disabled.</para>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Enable Solaris IP Filter and activate filtering using one of the
following methods:</para><itemizedlist><listitem><para>Reboot the machine.</para><screen># <userinput>reboot</userinput></screen><note><para>When IP Filter is enabled, after a reboot the following files
are loaded if they are present: the <filename>/etc/ipf/ipf.conf</filename> file, the <filename>/etc/ipf/ipf6.conf</filename> file when using IPv6, or the <filename>/etc/ipf/ipnat.conf</filename>.</para>
</note>
</listitem><listitem><para>Perform the following series of commands to enable Solaris
IP Filter and activate filtering:</para><orderedlist><listitem><para>Enable Solaris IP Filter.</para><screen># <userinput>ipf -E</userinput></screen>
</listitem><listitem><para>Activate packet filtering.</para><screen># <userinput>ipf -f <replaceable>filename</replaceable></userinput></screen>
</listitem><listitem><para>(Optional) Activate NAT.</para><screen># <userinput>ipnat -f <replaceable>filename</replaceable></userinput></screen><note><para>Network Address Translation (NAT) does not support IPv6.</para>
</note>
</listitem>
</orderedlist>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="gdwzr"><title>How to Enable Loopback Filtering</title><tasksummary><note><para>You can filter loopback traffic only if your system is running
at least Solaris Express, Developer Edition 2/07 release.
In previous Solaris 10 releases, loopback filtering is not supported.</para>
</note>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Stop Solaris IP Filter if it is running.</para><screen># <userinput>svcadm disable network/ipfilter</userinput></screen>
</step><step><para>Edit the <filename>/etc/ipf.conf</filename> or <filename>/etc/ipf6.conf</filename> file by adding the following line at the beginning of the file:</para><screen>set intercept_loopback true;</screen><para>This line must precede all the IP filter rules that are defined in the
file. However, you can insert comments before the line, similar to the following
example:</para><screen># 
# Enable loopback filtering to filter between zones 
# 
set intercept_loopback true; 
# 
# Define policy 
# 
block in all 
block out all 
&lt;other rules>
...</screen>
</step><step><para>Start the Solaris IP filter.</para><screen># <userinput>svcadm enable network/ipfilter</userinput></screen>
</step><step><para>To verify the status of loopback filtering, use the following
command:</para><screen># <userinput>ipf &mdash;T ipf_loopback</userinput>
ipf_loopback    min 0   max 0x1 current 1
#</screen><para>If loopback filtering is disabled, the command would generate the following
output:</para><screen>ipf_loopback    min 0   max 0x1 current 0</screen>
</step>
</procedure>
</task>
</sect1><sect1 id="fabar"><title>Deactivating and Disabling Solaris IP Filter</title><para>You might want to deactivate or disable packet filtering and NAT under
the following circumstances:</para><itemizedlist><listitem><para>For testing purposes</para>
</listitem><listitem><para>To troubleshoot system problems when you think the problems
are caused by Solaris IP Filter</para>
</listitem>
</itemizedlist><para>The following task map identifies the procedures associated with deactivating
or disabling Solaris IP Filter features.</para><table frame="topbot" id="euazs"><title>Deactivating and Disabling Solaris
IP Filter (Task Map)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Deactivate packet filtering.</para>
</entry><entry><para>Deactivate packet filtering using the <command>ipf</command> command.</para>
</entry><entry><para><olink targetptr="ettms" remap="internal">How to Deactivate Packet Filtering</olink></para>
</entry>
</row><row><entry><para>Deactivate NAT.</para>
</entry><entry><para>Deactivate NAT using the <command>ipnat</command> command.</para>
</entry><entry><para><olink targetptr="ettmt" remap="internal">How to Deactivate NAT</olink></para>
</entry>
</row><row><entry><para>Disable packet filtering and NAT.</para>
</entry><entry><para>Disable packet filtering and NAT using the <command>ipf</command> command.</para>
</entry><entry><para><olink targetptr="ettmo" remap="internal">How to Disable Packet Filtering</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><task id="ettms"><title>How to Deactivate Packet Filtering</title><tasksummary><para>The following procedure deactivates Solaris IP Filter packet filtering
by flushing the packet filtering rules from the active filtering rule set.
The procedure does not disable Solaris IP Filter. You can reactivate Solaris
IP Filter by adding rules to the rule set.</para>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Use one of the following methods to deactivate Solaris IP Filter
rules:</para><itemizedlist><listitem><para>Remove the active rule set from the kernel.</para><screen># <userinput>ipf -Fa</userinput></screen><para>This command deactivates all packet filtering rules.</para>
</listitem><listitem><para>Remove incoming packet filtering rules.</para><screen># <userinput>ipf -Fi</userinput></screen><para>This command deactivates packet filtering rules for incoming packets.</para>
</listitem><listitem><para>Remove outgoing packet filtering rules.</para><screen># <userinput>ipf -Fo</userinput></screen><para>This command deactivates packet filtering rules for outgoing packets.</para>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="ettmt"><title>How to Deactivate NAT</title><tasksummary><para>The following procedure deactivates Solaris IP Filter NAT rules by flushing
the NAT rules from the active NAT rules set. The procedure does not disable
Solaris IP Filter. You can reactivate Solaris IP Filter by adding rules to
the rule set.</para>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Remove NAT from the kernel.</para><screen># <userinput>ipnat -FC</userinput></screen><para>The <option>C</option> option removes all entries in the current NAT
rule listing. The <option>F</option> option removes all active entries in
the current NAT translation table, which shows the currently active NAT mappings.</para>
</step>
</procedure>
</task><task id="ettmo"><title>How to Disable Packet Filtering</title><tasksummary><para>When you run this procedure, both packet filtering and NAT are removed
from the kernel. If you use this procedure, you must re-enable Solaris IP Filter in order
to reactivate packet filtering and NAT. For more information, see <olink targetptr="eubbr" remap="internal">How to Re-Enable Solaris IP Filter</olink>.</para>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Disable packet filtering and allow all packets to pass into the
network.</para><screen># <userinput>ipf &ndash;D</userinput></screen><note><para>The <command>ipf <option>D</option></command> command flushes
the rules from the rule set. When you re-enable filtering, you must add rules
to the rule set.</para>
</note>
</step>
</procedure>
</task>
</sect1><sect1 id="eubbd"><title>Working With Solaris IP Filter Rule Sets</title><para>The following task map identifies the procedures associated with Solaris
IP Filter rule sets.</para><table frame="topbot" id="euazw"><title>Working With Solaris IP Filter Rule
Sets (Task Map)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Manage, view and modify Solaris IP Filter packet filtering rule sets.</para>
</entry><entry>
</entry><entry><para><olink targetptr="ettma" remap="internal">Managing Packet Filtering Rule Sets for Solaris
IP Filter</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>View an active packet filtering rule set.</para>
</entry><entry><para><olink targetptr="ezsvx" remap="internal">How to View the Active Packet Filtering Rule
Set</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>View an inactive packet filtering rule set.</para>
</entry><entry><para><olink targetptr="fahqf" remap="internal">How to View the Inactive Packet Filtering Rule
Set</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Activate a different active rule set.</para>
</entry><entry><para><olink targetptr="ettmd" remap="internal">How to Activate a Different or Updated Packet
Filtering Rule Set</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Remove a rule set.</para>
</entry><entry><para><olink targetptr="faaff" remap="internal">How to Remove a Packet Filtering Rule Set</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Add rules to the rule sets.</para>
</entry><entry><para><olink targetptr="ettmc" remap="internal">How to Append Rules to the Active Packet Filtering
Rule Set</olink></para><para><olink targetptr="ettmk" remap="internal">How to Append Rules to the Inactive Packet
Filtering Rule Set</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Move between active and inactive rule sets.</para>
</entry><entry><para><olink targetptr="ettmj" remap="internal">How to Switch Between Active and Inactive Packet
Filtering Rule Sets</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Delete an inactive rule set from the kernel.</para>
</entry><entry><para><olink targetptr="ettmp" remap="internal">How to Remove an Inactive Packet Filtering
Rule Set From the Kernel</olink></para>
</entry>
</row><row><entry><para>Manage, view and modify Solaris IP Filter NAT rules.</para>
</entry><entry>
</entry><entry><para><olink targetptr="faafj" remap="internal">Managing NAT Rules for Solaris IP Filter</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>View active NAT rules.</para>
</entry><entry><para><olink targetptr="faafa" remap="internal">How to View Active NAT Rules</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Remove NAT rules.</para>
</entry><entry><para><olink targetptr="faafc" remap="internal">How to Remove NAT Rules</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Add additional rules to NAT rules.</para>
</entry><entry><para><olink targetptr="faafd" remap="internal">How to Append Rules to the NAT Rules</olink></para>
</entry>
</row><row><entry><para>Manage, view and modify Solaris IP Filter address pools.</para>
</entry><entry>
</entry><entry><para><olink targetptr="faafi" remap="internal">Managing Address Pools for Solaris IP Filter</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>View active address pools.</para>
</entry><entry><para><olink targetptr="faaez" remap="internal">How to View Active Address Pools</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Remove an address pool.</para>
</entry><entry><para><olink targetptr="faaey" remap="internal">How to Remove an Address Pool</olink></para>
</entry>
</row><row><entry>
</entry><entry><para>Add additional rules to an address pool.</para>
</entry><entry><para><olink targetptr="faafn" remap="internal">How to Append Rules to an Address Pool</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><sect2 id="ettma"><title>Managing Packet Filtering Rule Sets for Solaris IP
Filter</title><para>When Solaris IP Filter is enabled, both active and inactive packet filtering rule
sets can reside in the kernel. The active rule set determines what filtering
is being done on incoming packets and outgoing packets. The inactive rule
set also stores rules. These rules are not used unless you make the inactive
rule set the active rule set. You can manage, view, and modify both active
and inactive packet filtering rule sets.</para><task id="ezsvx"><title>How to View the Active Packet Filtering Rule Set</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the active packet filtering rule set that is loaded in the
kernel.</para><screen># <userinput>ipfstat -io</userinput></screen>
</step>
</procedure><example id="fahpj"><title>Viewing the Active Packet Filtering Rule Set</title><para>The following example shows output from the active packet filtering
rule set that is loaded in the kernel.</para><screen># <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
pass in quick on dmfe1 from 192.168.1.0/24 to any
pass in all
block in on dmfe1 from 192.168.1.10/32 to any</screen>
</example>
</task><task id="fahqf"><title>How to View the Inactive Packet Filtering Rule Set</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the inactive packet filtering rule set.</para><screen># <userinput>ipfstat -I -io</userinput></screen>
</step>
</procedure><example id="fahqh"><title>Viewing the Inactive Packet Filtering Rule Set</title><para>The following example shows output from the inactive packet filtering
rule set.</para><screen># <userinput>ipfstat -I -io</userinput>
pass out quick on dmfe1 all
pass in quick on dmfe1 all</screen>
</example>
</task><task id="ettmd"><title>How to Activate a Different or Updated Packet Filtering
Rule Set</title><tasksummary><para>Use the following procedure if you want to perform either of the following
tasks:</para><itemizedlist><listitem><para>Activate a packet filtering rule set other than the one that
is currently in use by Solaris IP Filter.</para>
</listitem><listitem><para>Reload the same filtering rule set that has been newly updated.</para>
</listitem>
</itemizedlist>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Choose one of the following steps:</para><itemizedlist><listitem><para>Create a new rule set in a separate file of your choice if
you want to activate an entirely different rule set.</para>
</listitem><listitem><para>Update the current rule set by editing the configuration file
that contains that rule set.</para>
</listitem>
</itemizedlist>
</step><step><para>Remove the current rule set and load the new rule set.</para><screen># <userinput>ipf -Fa -f <replaceable>filename</replaceable></userinput></screen><para>The <replaceable>filename</replaceable> can either be the new file with
the new rule set or the updated file that contains the active rule set.</para><para>The active rule set is removed from the kernel. The rules in the <replaceable>filename</replaceable> file become the active rule set.</para><note><para>You still need to issue the command even if you are reloading
the current configuration file. Otherwise, the old rule set continues to be
operative, and the modified rule set in the updated configuration file is
not applied.</para><para>Do not use commands such as <command>ipf <option>D</option></command> or <command>svcadm restart</command> to load the updated rule set. Such commands expose
your network by disabling the firewall first before loading the new rule set.</para>
</note>
</step>
</procedure><example id="fahsf"><title>Activating a Different Packet Filtering Rule Set</title><para>The following example shows how to replace one packet filtering rule
set with another packet filtering rule set in a separate configuration file, <filename>/etc/ipf/ipf.conf</filename>.</para><screen># <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
pass in quick on dmfe all
# <userinput>ipf -Fa -f /etc/ipf/ipf.conf</userinput>
# <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
block in log quick from 10.0.0.0/8 to any</screen>
</example><example id="gdltk"><title>Reloading an Updated Packet Filtering Rule Set</title><para>The following example shows how to reload a packet filtering rule set
that is currently active and which is then updated. In this example, the file
in use is <filename>/etc/ipf/ipf.conf</filename>.</para><screen># <userinput>ipfstat -io</userinput> (Optional)
empty list for ipfilter (out)
block in log quick from 10.0.0.0/8 to any

(Edit the <filename>/etc/ipf/ipf.conf</filename> configuration file.)

# <userinput>ip -Fa -f /etc/ipf/ipf.conf</userinput>
# <userinput>ipfstat -io</userinput> (Optional)
empty list for ipfilter (out)
block in log quick from 10.0.0.0/8 to any
block in quick on elx10 from 192.168.0.0/12 to any</screen>
</example>
</task><task id="faaff"><title>How to Remove a Packet Filtering Rule Set</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Remove the rule set.</para><screen># <userinput>ipf -F [a|i|o]</userinput></screen><variablelist><varlistentry><term><option>a</option></term><listitem><para>Removes all filtering rules from the rule set.</para>
</listitem>
</varlistentry><varlistentry><term><option>i</option></term><listitem><para>Removes the filtering rules for incoming packets.</para>
</listitem>
</varlistentry><varlistentry><term><option>o</option></term><listitem><para>Removes the filtering rules for outgoing packets.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="fahsh"><title>Removing a Packet Filtering Rule Set</title><para>The following example shows how to remove all filtering rules from the
active filtering rule set.</para><screen># <userinput>ipfstat -io</userinput>
block out log on dmf0 all
block in log quick from 10.0.0.0/8 to any
# <userinput>ipf -Fa</userinput>
# <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
empty list for ipfilter(in)</screen>
</example>
</task><task id="ettmc"><title>How to Append Rules to the Active Packet Filtering
Rule Set</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Use one of the following methods to append rules to the active
rule set:</para><itemizedlist><listitem><para>Append rules to the rule set at the command line using the <command>ipf <option>f</option> -</command> command.</para><screen># <userinput>echo "block in on dmfe1 proto tcp from 10.1.1.1/32 to any" | ipf -f -</userinput></screen>
</listitem><listitem><para>Perform the following commands:</para><orderedlist><listitem><para>Create a rule set in a file of your choice.</para>
</listitem><listitem><para>Add the rules you have created to the active rule set.</para><screen># <userinput>ipf -f <replaceable>filename</replaceable></userinput></screen><para>The rules in <replaceable>filename</replaceable> are added to the end
of the active rule set. Because Solaris IP Filter uses a &ldquo;last matching rule&rdquo;
algorithm, the added rules determine filtering priorities, unless you use
the <literal>quick</literal> keyword. If the packet matches a rule containing
the <literal>quick</literal> keyword, the action for that rule is taken, and
no subsequent rules are checked.</para>
</listitem>
</orderedlist>
</listitem>
</itemizedlist>
</step>
</procedure><example id="fahsj"><title>Appending Rules to the Active Packet Filtering Rule Set</title><para>The following example shows how to add a rule to the active packet filtering
rule set from the command line.</para><screen># <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
block in log quick from 10.0.0.0/8 to any
# <userinput>echo "block in on dmfe1 proto tcp from 10.1.1.1/32 to any" | ipf -f -</userinput>
# <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
block in log quick from 10.0.0.0/8 to any
block in on dmfe1 proto tcp from 10.1.1.1/32 to any</screen>
</example>
</task><task id="ettmk"><title>How to Append Rules to the Inactive Packet Filtering
Rule Set</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Create a rule set in a file of your choice.</para>
</step><step><para>Add the rules you have created to the inactive rule set.</para><screen># <userinput>ipf -I -f <replaceable>filename</replaceable></userinput></screen><para>The rules in <replaceable>filename</replaceable> are added to the end
of the inactive rule set. Because Solaris IP Filter uses a &ldquo;last matching rule&rdquo;
algorithm, the added rules determine filtering priorities, unless you use
the <literal>quick</literal> keyword. If the packet matches a rule containing
the <literal>quick</literal> keyword, the action for that rule is taken, and
no subsequent rules are checked.</para>
</step>
</procedure><example id="fahsl"><title>Appending Rules to the Inactive Rule Set</title><para>The following example shows how to add a rule to the inactive rule set
from a file.</para><screen># <userinput>ipfstat -I -io</userinput>
pass out quick on dmfe1 all
pass in quick on dmfe1 all
# <userinput>ipf -I -f /etc/ipf/ipf.conf</userinput>
# <userinput>ipfstat -I -io</userinput>
pass out quick on dmfe1 all
pass in quick on dmfe1 all
block in log quick from 10.0.0.0/8 to any</screen>
</example>
</task><task id="ettmj"><title>How to Switch Between Active and Inactive Packet Filtering
Rule Sets</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Switch the active and inactive rule sets.</para><screen># <userinput>ipf -s</userinput></screen><para>This command enables you to switch between the active and inactive rule
sets in the kernel. Note that if the inactive rule set is empty, there is
no packet filtering.</para>
</step>
</procedure><example id="fahsk"><title>Switching Between the Active and Inactive Packet Filtering Rule Sets</title><para>The following example shows how using the <command>ipf</command> <option>s</option> command
results in the inactive rule set becoming the active rule set and the active
rule set becoming the inactive rule set.</para><itemizedlist><listitem><para>Before running the <command>ipf</command> <option>s</option> command,
the output from the <command>ipfstat</command> <option>I</option> <option>io</option> command
shows the rules in the inactive rule set. The output from the <command>ipfstat</command> <option>io</option> command shows the rules in the active rule set.</para><screen># <userinput>ipfstat -io</userinput>
empty list for ipfilter(out)
block in log quick from 10.0.0.0/8 to any
block in on dmfe1 proto tcp from 10.1.1.1/32 to any
# <userinput>ipfstat -I -io</userinput>
pass out quick on dmfe1 all
pass in quick on dmfe1 all
block in log quick from 10.0.0.0/8 to any</screen>
</listitem><listitem><para>After running the <command>ipf</command> <option>s</option> command,
the output from the <command>ipfstat</command> <option>I</option> <option>io</option> and
 the <command>ipfstat</command> <option>io</option> command show that the
content of the two rules sets have switched.</para><screen># <userinput>ipf -s</userinput>
Set 1 now inactive
# <userinput>ipfstat -io</userinput>
pass out quick on dmfe1 all
pass in quick on dmfe1 all
block in log quick from 10.0.0.0/8 to any
# <userinput>ipfstat -I -io</userinput>
empty list for inactive ipfilter(out)
block in log quick from 10.0.0.0/8 to any
block in on dmfe1 proto tcp from 10.1.1.1/32 to any</screen>
</listitem>
</itemizedlist>
</example>
</task><task id="ettmp"><title>How to Remove an Inactive Packet Filtering Rule Set
From the Kernel</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Specify the inactive rule set in the &ldquo;flush all&rdquo; command.</para><screen># <userinput>ipf -I -Fa</userinput></screen><para>This command flushes the inactive rule set from the kernel. </para><note><para>If you subsequently run <command>ipf</command> <option>s</option>,
the empty inactive rule set will become the active rule set. An empty active
rule set means that <emphasis>no</emphasis> filtering will be done. </para>
</note>
</step>
</procedure><example id="fahsn"><title>Removing an Inactive Packet Filtering Rule Set From the Kernel</title><para>The following example shows how to flush the inactive packet filtering
rule set so that all rules have been removed.</para><screen># <userinput>ipfstat -I -io</userinput>
empty list for inactive ipfilter(out)
block in log quick from 10.0.0.0/8 to any
block in on dmfe1 proto tcp from 10.1.1.1/32 to any
# <userinput>ipf -I -Fa</userinput>
# <userinput>ipfstat -I -io</userinput>
empty list for inactive ipfilter(out)
empty list for inactive ipfilter(in)</screen>
</example>
</task>
</sect2><sect2 id="faafj"><title>Managing NAT Rules for Solaris IP Filter</title><para>Use the following procedures to manage, view, and modify NAT rules.</para><task id="faafa"><title>How to View Active NAT Rules</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the active NAT rules.</para><screen># <userinput>ipnat -l</userinput></screen>
</step>
</procedure><example id="fahsm"><title>Viewing Active NAT Rules</title><para>The following example shows the output from the active NAT rules set.</para><screen># <userinput>ipnat -l</userinput>
List of active MAP/Redirect filters:
map dmfe0 192.168.1.0/24 -> 20.20.20.1/32

List of active sessions:</screen>
</example>
</task><task id="faafc"><title>How to Remove NAT Rules</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Remove the current NAT rules.</para><screen># <userinput>ipnat -C</userinput></screen>
</step>
</procedure><example id="fahsr"><title>Removing NAT Rules</title><para>The following example shows how to remove the entries in the current
NAT rules.</para><screen># <userinput>ipnat -l</userinput>
List of active MAP/Redirect filters:
map dmfe0 192.168.1.0/24 -> 20.20.20.1/32

List of active sessions:
# <userinput>ipnat -C</userinput>
1 entries flushed from NAT list
# <userinput>ipnat -l</userinput>
List of active MAP/Redirect filters:

List of active sessions:</screen>
</example>
</task><task id="faafd"><title>How to Append Rules to the NAT Rules</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Use one of the following methods to append rules to the active
rule set:</para><itemizedlist><listitem><para>Append rules to the NAT rule set at the command line using
the <command>ipnat <option>f</option> -</command> command.</para><screen># <userinput>echo "map dmfe0 192.168.1.0/24 -> 20.20.20.1/32" | ipnat -f -</userinput></screen>
</listitem><listitem><para>Perform the following commands:</para><orderedlist><listitem><para>Create additional NAT rules in a file of your choice.</para>
</listitem><listitem><para>Add the rules you have created to the active NAT rules.</para><screen># <userinput>ipnat -f <replaceable>filename</replaceable></userinput></screen><para>The rules in <replaceable>filename</replaceable> are added to the end
of the NAT rules.</para>
</listitem>
</orderedlist>
</listitem>
</itemizedlist>
</step>
</procedure><example id="fahso"><title>Appending Rules to the NAT Rule Set</title><para>The following example shows how to add a rule to the NAT rule set from
the command line.</para><screen># <userinput>ipnat -l</userinput>
List of active MAP/Redirect filters:

List of active sessions:
# <userinput>echo "map dmfe0 192.168.1.0/24 -> 20.20.20.1/32" | ipnat -f -</userinput>
# <userinput>ipnat -l</userinput>
List of active MAP/Redirect filters:
map dmfe0 192.168.1.0/24 -> 20.20.20.1/32

List of active sessions:</screen>
</example>
</task>
</sect2><sect2 id="faafi"><title>Managing Address Pools for Solaris IP Filter</title><para>Use the following procedures to manage, view, and modify address pools.</para><task id="faaez"><title>How to View Active Address Pools</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the active address pool.</para><screen># <userinput>ippool -l</userinput></screen>
</step>
</procedure><example id="fahsp"><title>Viewing the Active Address Pool</title><para>The following example shows how to view the contents of the active address
pool.</para><screen># <userinput>ippool -l</userinput>
table role = ipf type = tree number = 13
        { 10.1.1.1/32, 10.1.1.2/32, 192.168.1.0/24; };</screen>
</example>
</task><task id="faaey"><title>How to Remove an Address Pool</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Remove the entries in the current address pool.</para><screen># <userinput>ippool -F</userinput></screen>
</step>
</procedure><example id="fahsq"><title>Removing an Address Pool</title><para>The following example shows how to remove an address pool.</para><screen># <userinput>ippool -l</userinput>
table role = ipf type = tree number = 13
        { 10.1.1.1/32, 10.1.1.2/32, 192.168.1.0/24; };
# <userinput>ippool -F</userinput>
1 object flushed
# <userinput>ippool -l</userinput></screen>
</example>
</task><task id="faafn"><title>How to Append Rules to an Address Pool</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Use one of the following methods to append rules to the active
rule set:</para><itemizedlist><listitem><para>Append rules to the rule set at the command line using the <command>ippool <option>f</option> -</command> command.</para><screen># <userinput>echo "table role = ipf type = tree number = 13 
{10.1.1.1/32, 10.1.1.2/32, 192.168.1.0/24};" | ippool -f -</userinput></screen>
</listitem><listitem><para>Perform the following commands:</para><orderedlist><listitem><para>Create additional address pools in a file of your choice.</para>
</listitem><listitem><para>Add the rules you have created to the active address pool.</para><screen># <userinput>ippool -f <replaceable>filename</replaceable></userinput></screen><para>The rules in <replaceable>filename</replaceable> are added to the end
of the active address pool.</para>
</listitem>
</orderedlist>
</listitem>
</itemizedlist>
</step>
</procedure><example id="fahss"><title>Appending Rules to an Address Pool</title><para>The following example shows how to add an address pool to the address
pool rule set from the command line.</para><screen># <userinput>ippool -l</userinput>
table role = ipf type = tree number = 13
        { 10.1.1.1/32, 10.1.1.2/32, 192.168.1.0/24; };
# <userinput>echo "table role = ipf type = tree number = 100
 {10.0.0.0/32, 172.16.1.2/32, 192.168.1.0/24};" | ippool -f -</userinput>
# <userinput>ippool -l</userinput>
table role = ipf type = tree number = 100
        { 10.0.0.0/32, 172.16.1.2/32, 192.168.1.0/24; };
table role = ipf type = tree number = 13
        { 10.1.1.1/32, 10.1.1.2/32, 192.168.1.0/24; };</screen>
</example>
</task>
</sect2>
</sect1><sect1 id="faaxo"><title>Displaying Statistics and Information for Solaris
IP Filter</title><table frame="topbot" id="fabah"><title>Displaying Solaris IP Filter Statistics
and Information (Task Map)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colname="colspec0" colwidth="50.00*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>View state tables.</para>
</entry><entry><para>View state tables to obtain information about packet filtering using
the <command>ipfstat</command> command.</para>
</entry><entry><para><olink targetptr="faapk" remap="internal">How to View State Tables for Solaris IP Filter</olink></para>
</entry>
</row><row><entry><para>View state statistics.</para>
</entry><entry><para>View statistics on packet state information using the <command>ipfstat</command> <option>s</option> command.</para>
</entry><entry><para><olink targetptr="faapx" remap="internal">How to View State Statistics for Solaris IP
Filter</olink></para>
</entry>
</row><row><entry><para>View NAT statistics.</para>
</entry><entry><para>View NAT statistics using the <command>ipnat</command> <option>s</option> command.</para>
</entry><entry><para><olink targetptr="faapy" remap="internal">How to View NAT Statistics for Solaris IP Filter</olink></para>
</entry>
</row><row><entry><para>View address pool statistics.</para>
</entry><entry><para>View address pool statistics using the <command>ippool</command> <option>s</option> command.</para>
</entry><entry><para><olink targetptr="faapz" remap="internal">How to View Address Pool Statistics for Solaris
IP Filter</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><task id="faapk"><title>How to View State Tables for Solaris IP Filter</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the state table.</para><screen># <userinput>ipfstat</userinput></screen><note><para>You can use the <option>t</option> option to view the state table
in the top utility format.</para>
</note>
</step>
</procedure><example id="fahst"><title>Viewing State Tables for Solaris IP Filter</title><para>The following example shows how to view a state table.</para><screen width="100"># <userinput>ipfstat</userinput>
bad packets:            in 0    out 0
 input packets:         blocked 160 passed 11 nomatch 1 counted 0 short 0
output packets:         blocked 0 passed 13681 nomatch 6844 counted 0 short 0
 input packets logged:  blocked 0 passed 0
output packets logged:  blocked 0 passed 0
 packets logged:        input 0 output 0
 log failures:          input 0 output 0
fragment state(in):     kept 0  lost 0
fragment state(out):    kept 0  lost 0
packet state(in):       kept 0  lost 0
packet state(out):      kept 0  lost 0
ICMP replies:   0       TCP RSTs sent:  0
Invalid source(in):     0
Result cache hits(in):  152     (out):  6837
IN Pullups succeeded:   0       failed: 0
OUT Pullups succeeded:  0       failed: 0
Fastroute successes:    0       failures:       0
TCP cksum fails(in):    0       (out):  0
IPF Ticks:      14341469
Packet log flags set: (0)
        none</screen>
</example>
</task><task id="faapx"><title>How to View State Statistics for Solaris IP Filter</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the state statistics.</para><screen># <userinput>ipfstat -s</userinput></screen>
</step>
</procedure><example id="fahsv"><title>Viewing State Statistics for Solaris IP Filter</title><para>The following example shows how to view state statistics.</para><screen># <userinput>ipfstat -s</userinput>
IP states added:
        0 TCP
        0 UDP
        0 ICMP
        0 hits
        0 misses
        0 maximum
        0 no memory
        0 max bucket
        0 active
        0 expired
        0 closed
State logging enabled

State table bucket statistics:
        0 in use        
        0.00% bucket usage
        0 minimal length
        0 maximal length
        0.000 average length</screen>
</example>
</task><task id="faapy"><title>How to View NAT Statistics for Solaris IP Filter</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View NAT statistics.</para><screen># <userinput>ipnat -s</userinput></screen>
</step>
</procedure><example id="fahsx"><title>Viewing NAT Statistics for Solaris IP Filter</title><para>The following example shows how to view NAT statistics.</para><screen># <userinput>ipnat -s</userinput>
mapped  in      0       out     0
added   0       expired 0
no memory       0       bad nat 0
inuse   0
rules   1
wilds   0</screen>
</example>
</task><task id="faapz"><title>How to View Address Pool Statistics for Solaris IP
Filter</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View address pool statistics.</para><screen># <userinput>ippool -s</userinput></screen>
</step>
</procedure><example id="fahsw"><title>Viewing Address Pool Statistics for Solaris IP Filter</title><para>The following example shows how to view address pool statistics.</para><screen># <userinput>ippool -s</userinput>
Pools:  3
Hash Tables:    0
Nodes:  0</screen>
</example>
</task>
</sect1><sect1 id="faavk"><title>Working With Log Files for Solaris IP Filter</title><table frame="topbot" id="faawy"><title>Working With Solaris IP Filter Log
Files (Task Map)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Create a log file.</para>
</entry><entry><para>Create a separate Solaris IP filter log file.</para>
</entry><entry><para><olink targetptr="gdfwa" remap="internal">How to Set Up a Log File for Solaris IP Filter</olink></para>
</entry>
</row><row><entry><para>View log files.</para>
</entry><entry><para>View state, NAT, and normal log files using the <command>ipmon</command> command.</para>
</entry><entry><para><olink targetptr="faaqc" remap="internal">How to View Solaris IP Filter Log Files</olink></para>
</entry>
</row><row><entry><para>Flush the packet log buffer.</para>
</entry><entry><para>Remove the contents of the packet log buffer using the <command>ipmon</command> <option>F</option> command.</para>
</entry><entry><para><olink targetptr="faaqf" remap="internal">How to Flush the Packet Log File</olink></para>
</entry>
</row><row><entry><para>Save logged packets to a file.</para>
</entry><entry><para>Save logged packets to a file for later reference.</para>
</entry><entry><para><olink targetptr="faard" remap="internal">How to Save Logged Packets to a File</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><task id="gdfwa"><title>How to Set Up a Log File for Solaris IP Filter</title><tasksummary><para>By default, all log information for Solaris IP Filter is recorded in
the <filename>syslogd</filename> file. You should set up a log file to record
Solaris IP Filter traffic information separately from other data that might
be logged in the default log file. Perform the following steps.</para>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Edit the <filename>/etc/syslog.conf</filename> file by adding
the following two lines:</para><screen># Save IPFilter log output to its own file 
local0.debug             /var/log/<replaceable>log-name</replaceable></screen><note><para>On the second line, make sure to use the Tab key, not the Spacebar,
to separate <literal>local0.debug</literal> from <filename>/var/log/<replaceable>log-name</replaceable></filename>. </para>
</note>
</step><step><para>Create the new log file.</para><screen># <userinput>touch /var/log/<replaceable>log-name</replaceable></userinput></screen>
</step><step><para>Restart the system-log service.</para><screen># <userinput>svcadm restart system-log</userinput></screen>
</step>
</procedure><example id="gdgtw"><title>Creating a Solaris IP Filter Log</title><para>The following example shows how to create <filename>ipmon.log</filename> to
archive IP filter information.</para><para>In <filename>/etc/syslog.conf</filename>:</para><screen># Save IPFilter log output to its own file 
local0.debug             /var/log/ipmon.log</screen><para>At the command line:</para><screen># <userinput>touch /var/log/ipmon.log</userinput>
# <userinput>svcadm restart system-log</userinput></screen>
</example>
</task><task id="faaqc"><title>How to View Solaris IP Filter Log Files</title><taskprerequisites><para>You should create a separate log file to record Solaris IP Filter data.
Refer to <olink targetptr="gdfwa" remap="internal">How to Set Up a Log File for Solaris IP
Filter</olink>.</para>
</taskprerequisites><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>View the state, NAT, or normal log files. To view a log file,
type the following command, using the appropriate option:</para><screen># <userinput>ipmon -o [S|N|I] <replaceable>filename</replaceable></userinput></screen><variablelist><varlistentry><term><literal>S</literal></term><listitem><para>Displays the state log file.</para>
</listitem>
</varlistentry><varlistentry><term><literal>N</literal></term><listitem><para>Displays the NAT log file.</para>
</listitem>
</varlistentry><varlistentry><term><literal>I</literal></term><listitem><para>Displays the normal IP log file.</para>
</listitem>
</varlistentry>
</variablelist><para>To view all state, NAT, and normal log files, use all the options:</para><screen># <userinput>ipmon -o SNI <replaceable>filename</replaceable></userinput></screen><stepalternatives><step><para>Provided that you have manually stopped the <literal>ipmon</literal> daemon
first, you can also use the following command to display state, NAT, and Solaris
IP filter log files:</para><screen># <userinput>ipmon -a <replaceable>filename</replaceable></userinput></screen><note><para>Do not use the <command>ipmon <option>a</option></command> syntax
if the <literal>ipmon</literal> daemon is still running. Normally, the daemon
is automatically started during system boot. Issuing the <command>ipmon <option>a</option></command> command also opens another copy of <literal>ipmon</literal>.
In such a case, both copies read the same log information, and only one gets
a particular log message.</para>
</note>
</step>
</stepalternatives><para>For more information about viewing log files, see the <olink targetdoc="refman1m" targetptr="ipmon-1m" remap="external"><citerefentry><refentrytitle>ipmon</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</step>
</procedure><example id="fapjl"><title>Viewing Solaris IP Filter Log Files</title><para>The following example shows the output from <filename>/var/ipmon.log</filename>.</para><screen># <userinput>ipmon -o SNI /var/ipmon.log</userinput>
02/09/2004 15:27:20.606626 hme0 @0:1 p 129.146.157.149 -> 
129.146.157.145 PR icmp len 20 84 icmp echo/0 IN</screen><para>or</para><screen># <userinput>pkill ipmon</userinput>
# <userinput>ipmon -aD /var/ipmon.log</userinput>
02/09/2004 15:27:20.606626 hme0 @0:1 p 129.146.157.149 -> 
129.146.157.145 PR icmp len 20 84 icmp echo/0 IN</screen>
</example>
</task><task id="faaqf"><title>How to Flush the Packet Log File</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Flush the pack log buffer.</para><screen># <userinput>ipmon -F</userinput></screen>
</step>
</procedure><example id="fapix"><title>Flushing the Packet Log File</title><para>The following example shows the output when a log file is removed. The
system provides a report even when there is nothing stored in the log file,
as in this example.</para><screen># <userinput>ipmon -F</userinput>
0 bytes flushed from log buffer
0 bytes flushed from log buffer
0 bytes flushed from log buffer</screen>
</example>
</task><?SolBook prefpagebreak?><task id="faard"><title>How to Save Logged Packets to a File</title><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Save the logged packets to a file.</para><screen># <userinput>cat /dev/ipl > <replaceable>filename</replaceable></userinput></screen><para>Continue logging packets to the <replaceable>filename</replaceable> file
until you interrupt the procedure by typing <command>Control-C</command> to
get the command line prompt back.</para>
</step>
</procedure><example id="fapjn"><title>Saving Logged Packets to a File</title><para>The following example shows the result when logged packets are saved
to a file.</para><screen># <userinput>cat /dev/ipl > /tmp/logfile</userinput>
<userinput>^C</userinput>#

# <userinput>ipmon -f /tmp/logfile</userinput>
02/09/2004 15:30:28.708294 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 52 -S IN
02/09/2004 15:30:28.708708 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 40 -A IN
02/09/2004 15:30:28.792611 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 70 -AP IN
02/09/2004 15:30:28.872000 hme0 @0:1 p 129.146.157.149,33923 -> 
 129.146.157.145,23 PR tcp len 20 40 -A IN
02/09/2004 15:30:28.872142 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 43 -AP IN
02/09/2004 15:30:28.872808 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 40 -A IN
02/09/2004 15:30:28.872951 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 47 -AP IN
02/09/2004 15:30:28.926792 hme0 @0:1 p 129.146.157.149,33923 -> 
  129.146.157.145,23 PR tcp len 20 40 -A IN 
.
.
(output truncated)</screen>
</example>
</task>
</sect1><sect1 id="ipfilter-admin-2"><title>Creating and Editing Solaris IP Filter
Configuration Files</title><para>You must directly edit the configuration files to create and modify
rule sets and address pools. Configuration files follow standard UNIX syntax
rules:</para><itemizedlist><listitem><para>The pound sign (<literal>#</literal>) indicates a line containing
comments.</para>
</listitem><listitem><para>Rules and comments can coexist on the same line.</para>
</listitem><listitem><para>Extraneous white space is allowed to keep rules easy to read.</para>
</listitem><listitem><para>Rules can be more than one line long. Use the backslash (\)
at the end of a line to indicate that the rule continues on the next line.</para>
</listitem>
</itemizedlist><task id="fahpp"><title>How to Create a Configuration File for Solaris IP
Filter</title><tasksummary><para>The following procedure describes how to set up the following:</para><itemizedlist><listitem><para>Packet filtering configuration files</para>
</listitem><listitem><para>NAT rules configuration files</para>
</listitem><listitem><para>Address pool configuration files</para>
</listitem>
</itemizedlist>
</tasksummary><procedure><step><para>Assume a role that includes the IP Filter Management rights profile,
or become superuser.</para><para>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>
</step><step><para>Start the file editor of your choice. Create or edit the configuration
file for the feature you want to configure.</para><itemizedlist><listitem><para>To create a configuration file for packet filtering rules,
edit the <filename>ipf.conf</filename> file.</para><para>Solaris IP Filter
uses the packet filtering rules that you put in to the <filename>ipf.conf</filename> file.
If you locate the rules file for packet filtering in the <filename>/etc/ipf/ipf.conf</filename> file, this file is loaded when the system is booted. If you do
not want the filtering rules to be loaded at boot time, put the in a file
of your choice. You can then activate the rules with the <command>ipf</command> command,
as described in <olink targetptr="ettmd" remap="internal">How to Activate a Different or Updated
Packet Filtering Rule Set</olink>.</para><para>See <olink targetptr="euqfb" remap="internal">Using
Solaris IP Filter's Packet Filtering Feature</olink> for information about
creating packet filtering rules.</para><note><para>If the <filename>ipf.conf</filename> file is empty, there is no
filtering. An empty <filename>ipf.conf</filename> file is the same as having
a rule set that reads:</para><screen>pass in all
pass out all</screen>
</note>
</listitem><listitem><para>To create a configuration file for NAT rules, edit the <filename>ipnat.conf</filename> file.</para><para>Solaris IP Filter uses the NAT rules
that you put in to the <filename>ipnat.conf</filename> file. If you locate
the rules file for NAT in the <filename>/etc/ipf/ipnat.conf</filename> file,
this file is loaded when the system is booted. 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. You can then activate the NAT rules with the <command>ipnat</command> command.</para><para>See <olink targetptr="euqfc" remap="internal">Using Solaris
IP Filter's NAT Feature</olink> for information about creating rules for NAT.</para>
</listitem><listitem><para>To create a configuration file for address pools, edit the <filename>ippool.conf</filename> file.</para><para>Solaris IP Filter uses the pool of
addresses that you put in to the <filename>ippool.conf</filename> file. If
you locate the rules file for the pool of addresses in the <filename>/etc/ipf/ippool.conf</filename> file, this file is loaded when the system is booted. If you do
not want the pool of addresses loaded at boot time, put the <filename>ippool.conf</filename> file in a location of your choice. You can then activate the pool
of addresses with the <command>ippool</command> command.</para><para>See <olink targetptr="euqfe" remap="internal">Using Solaris IP Filter's Address Pools Feature</olink> for
information about creating address pools.</para>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><sect2 id="ezecy"><title>Solaris IP Filter Configuration File Examples</title><para>The following examples provide an illustration of packet filtering rules
used in filtering configurations.</para><example id="eywvr"><title>Solaris IP Filter Host Configuration</title><para>This example shows a configuration on a host machine with an <literal>elxl</literal> network
interface.</para><screen width="100"># pass and log everything by default
pass in log on elxl0 all
pass out log on elxl0 all

# block, but don't log, incoming packets from other reserved addresses
block in quick on elxl0 from 10.0.0.0/8 to any
block in quick on elxl0 from 172.16.0.0/12 to any

# block and log untrusted internal IPs. 0/32 is notation that replaces 
# address of the machine running Solaris IP Filter.
block in log quick from 192.168.1.15 to &lt;thishost>
block in log quick from 192.168.1.43 to &lt;thishost>

# block and log X11 (port 6000) and remote procedure call 
# and portmapper (port 111) attempts
block in log quick on elxl0 proto tcp from any to elxl0/32 port = 6000 keep state
block in log quick on elxl0 proto tcp/udp from any to elxl0/32 port = 111 keep state</screen><para>This rule set begins with two unrestricted rules that allow everything
to pass into and out of the <literal>elxl</literal> interface. The second
set of rules blocks any incoming packets from the private address spaces <literal>10.0.0.0</literal> and <literal>172.16.0.0</literal> from entering the firewall.
The next set of rules blocks specific internal addresses from the host machine.
Finally, the last set of rules blocks packets coming in on port 6000 and port
111.</para>
</example><example id="eywvs"><title>Solaris IP Filter Server Configuration</title><para>This example shows a configuration for a host machine acting as a web
server. This machine has an <literal>eri</literal> network interface.</para><screen width="100"># web server with an eri interface
# block and log everything by default; then allow specific services
# group 100 - inbound rules
# group 200 - outbound rules
# (0/32) resolves to our IP address)
*** FTP proxy ***


# block short packets which are packets fragmented too short to be real.
block in log quick all with short


# block and log inbound and outbound by default, group by destination
block in log on eri0 from any to any head 100
block out log on eri0 from any to any head 200


# web rules that get hit most often
pass in quick on eri0 proto tcp from any \
to eri0/32 port = http flags S keep state group 100
pass in quick on eri0 proto tcp from any \
to eri0/32 port = https flags S keep state group 100


# inbound traffic - ssh, auth
pass in quick on eri0 proto tcp from any \
to eri0/32 port = 22 flags S keep state group 100
pass in log quick on eri0 proto tcp from any \
to eri0/32 port = 113 flags S keep state group 100
pass in log quick on eri0 proto tcp from any port = 113 \
to eri0/32 flags S keep state group 100


# outbound traffic - DNS, auth, NTP, ssh, WWW, smtp
pass out quick on eri0 proto tcp/udp from eri0/32 \
to any port = domain flags S keep state group 200
pass in quick on eri0 proto udp from any port = domain to eri0/32 group 100

pass out quick on eri0 proto tcp from eri0/32 \
to any port = 113 flags S keep state group 200
pass out quick on eri0 proto tcp from eri0/32 port = 113 \
to any flags S keep state group 200

pass out quick on eri0 proto udp from eri0/32 to any port = ntp group 200
pass in quick on eri0 proto udp from any port = ntp to eri0/32 port = ntp group 100

pass out quick on eri0 proto tcp from eri0/32 \
to any port = ssh flags S keep state group 200

pass out quick on eri0 proto tcp from eri0/32 \
to any port = http flags S keep state group 200
pass out quick on eri0 proto tcp from eri0/32 \
to any port = https flags S keep state group 200

pass out quick on eri0 proto tcp from eri0/32 \
to any port = smtp flags S keep state group 200


# pass icmp packets in and out
pass in quick on eri0 proto icmp from any to eri0/32  keep state group 100
pass out quick on eri0 proto icmp from eri0/32 to any keep state group 200


# block and ignore NETBIOS packets
block in quick on eri0 proto tcp from any \
to any port = 135 flags S keep state group 100

block in quick on eri0 proto tcp from any port = 137 \
to any flags S keep state group 100
block in quick on eri0 proto udp from any to any port = 137 group 100
block in quick on eri0 proto udp from any port = 137 to any group 100

block in quick on eri0 proto tcp from any port = 138 \
to any flags S keep state group 100
block in quick on eri0 proto udp from any port = 138 to any group 100

block in quick on eri0 proto tcp from any port = 139 to any flags S keep state
group 100
block in quick on eri0 proto udp from any port = 139 to any group 100</screen>
</example><example id="eywvu"><title>Solaris IP Filter Router Configuration</title><para>This example shows a configuration for a router that has an internal
interface, <literal>ce0</literal>, and an external interface, <literal>ce1</literal>.</para><screen width="100"># internal interface is ce0 at 192.168.1.1
# external interface is ce1 IP obtained via DHCP
# block all packets and allow specific services
*** NAT ***
*** POOLS ***


# Short packets which are fragmented too short to be real.
block in log quick all with short


# By default, block and log everything.
block in log on ce0 all
block in log on ce1 all
block out log on ce0 all
block out log on ce1 all


# Packets going in/out of network interfaces that aren't on the loopback
# interface should not exist.
block in log quick on ce0 from 127.0.0.0/8 to any
block in log quick on ce0 from any to 127.0.0.0/8
block in log quick on ce1 from 127.0.0.0/8 to any
block in log quick on ce1 from any to 127.0.0.0/8


# Deny reserved addresses.
block in quick on ce1 from 10.0.0.0/8 to any
block in quick on ce1 from 172.16.0.0/12 to any
block in log quick on ce1 from 192.168.1.0/24 to any
block in quick on ce1 from 192.168.0.0/16 to any


# Allow internal traffic
pass in quick on ce0 from 192.168.1.0/24 to 192.168.1.0/24
pass out quick on ce0 from 192.168.1.0/24 to 192.168.1.0/24


# Allow outgoing DNS requests from our servers on .1, .2, and .3
pass out quick on ce1 proto tcp/udp from ce1/32 to any port = domain keep state
pass in quick on ce0 proto tcp/udp from 192.168.1.2 to any port = domain keep state
pass in quick on ce0 proto tcp/udp from 192.168.1.3 to any port = domain keep state


# Allow NTP from any internal hosts to any external NTP server.
pass in quick on ce0 proto udp from 192.168.1.0/24 to any port = 123 keep state
pass out quick on ce1 proto udp from any to any port = 123 keep state


# Allow incoming mail
pass in quick on ce1 proto tcp from any to ce1/32 port = smtp keep state
pass in quick on ce1 proto tcp from any to ce1/32 port = smtp keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = smtp keep state


# Allow outgoing connections: SSH, WWW, NNTP, mail, whois
pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = 22 keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = 22 keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = 80 keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = 80 keep state
pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = 443 keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = 443 keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = nntp keep state
block in quick on ce1 proto tcp from any to any port = nntp keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = nntp keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = smtp keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = whois keep state
pass out quick on ce1 proto tcp from any to any port = whois keep state


# Allow ssh from offsite
pass in quick on ce1 proto tcp from any to ce1/32 port = 22 keep state


# Allow ping out
pass in quick on ce0 proto icmp all keep state
pass out quick on ce1 proto icmp all keep state


# allow auth out
pass out quick on ce1 proto tcp from ce1/32 to any port = 113 keep state
pass out quick on ce1 proto tcp from ce1/32 port = 113 to any keep state


# return rst for incoming auth
block return-rst in quick on ce1 proto tcp from any to any port = 113 flags S/SA


# log and return reset for any TCP packets with S/SA
block return-rst in log on ce1 proto tcp from any to any flags S/SA


# return ICMP error packets for invalid UDP packets
block return-icmp(net-unr) in proto udp all </screen>
</example>
</sect2>
</sect1>
</chapter>