Starting/Stopping and Monitoring the Firewall


If you have a permanent internet connection such as DSL or Cable, I recommend that you start the firewall automatically at boot. Once you have installed "firewall" in your init.d directory, simply type "chkconfig --add firewall". This will start the firewall in run levels 2-5 and stop it in run levels 1 and 6. If you want to configure your firewall differently from this default, you can use the "--level" option in chkconfig (see "man chkconfig") or using your favorite graphical run-level editor.

Important Notes:

  1. Shorewall startup is disabled by default. Once you have configured your firewall, you can enable startup by removing the file /etc/shorewall/startup_disabled. Note: Users of the .deb package must edit /etc/default/shorewall and set 'startup=1'.
  2. If you use dialup, you may want to start the firewall in your /etc/ppp/ip-up.local script. I recommend just placing "shorewall restart" in that script.

You can manually start and stop Shoreline Firewall using the "shorewall" shell program. Please refer to the Shorewall State Diagram is shown at the bottom of this page.

If you include the keyword debug as the first argument, then a shell trace of the command is produced as in:
	shorewall debug start 2> /tmp/trace

The above command would trace the 'start' command and place the trace information in the file /tmp/trace

Beginning with version 1.4.7, shorewall can give detailed help about each of its commands:

The "shorewall" program may also be used to monitor the firewall.

Beginning with Shorewall 1.4.6, /sbin/shorewall supports a couple of commands for dealing with IP addresses and IP address ranges:
There is a set of commands dealing with dynamic blacklisting:
Finally, the "shorewall" program may be used to dynamically alter the contents of a zone.
Examples:
shorewall add ipsec0:192.0.2.24 vpn1 -- adds the address 192.0.2.24 from interface ipsec0 to the zone vpn1
shorewall delete ipsec0:192.0.2.24 vpn1 -- deletes the address 192.0.2.24 from interface ipsec0 from zone vpn1

The shorewall start, shorewall restart, shorewall check, and shorewall try commands allow you to specify which Shorewall configuration to use:

shorewall [ -c configuration-directory ] {start|restart|check}
shorewall try configuration-directory

If a configuration-directory is specified, each time that Shorewall is going to use a file in /etc/shorewall it will first look in the configuration-directory . If the file is present in the configuration-directory, that file will be used; otherwise, the file in /etc/shorewall will be used.

When changing the configuration of a production firewall, I recommend the following:

If the configuration starts but doesn't work, just "shorewall restart" to restore the old configuration. If the new configuration fails to start, the "try" command will automatically start the old one for you.

When the new configuration works then just

The Shorewall State Diargram is depicted below.

(State Diagram)

 

You will note that the commands that result in state transitions use the word "firewall" rather than "shorewall". That is because the actual transitions are done by /usr/share/shorewall/firewall; /sbin/shorewall runs 'firewall" according to the following table:

/sbin/shorewall Command
Resulting /usr/share/shorewall/firewall Command
Effect if the Command Succeeds
shorewall start
firewall start
The system filters packets based on your current Shorewall Configuration
shorewall stop
firewall stop
Only traffic to/from hosts listed in /etc/shorewall/hosts is passed to/from/through the firewall. For Shorewall versions beginning with 1.4.7, if ADMINISABSENTMINDED=Yes in /etc/shorewall/shorewall.conf then in addition, all existing connections are retained and all connection requests from the firewall are accepted.
shorewall restart
firewall restart
Logically equivalent to "firewall stop;firewall start"
shorewall add
firewall add
Adds a host or subnet to a dynamic zone
shorewall delete
firewall delete
Deletes a host or subnet from a dynamic zone
shorewall refresh
firewall refresh
Reloads rules dealing with static blacklisting, traffic control and ECN.
shorewall clear
firewall clear
Removes all Shorewall rules, chains, addresses, routes and ARP entries.
shorewall try
firewall -c <new configuration> restart
If unsuccessful then firewall start (standard configuration)
If timeout then firewall restart (standard configuration)


Updated 8/25/2003 - Tom Eastep

Copyright © 2001, 2002, 2003 Thomas M. Eastep.