mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-22 05:28:59 +01:00
More swping changes
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9356 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
7fcba909df
commit
bafa0eede5
@ -640,14 +640,22 @@
|
||||
place to start.</para>
|
||||
</important>
|
||||
|
||||
<para>The script should be copied to a directory on root's PATH such as
|
||||
<filename>/usr/local/sbin/.</filename></para>
|
||||
|
||||
<para>The script monitors two interfaces but it is a trivial exercise to
|
||||
extend it to more than two. At the top are a number of variables to
|
||||
set:</para>
|
||||
|
||||
<programlisting># The commands to run when the status of a line changes. Both commands will be executed.
|
||||
<programlisting>#
|
||||
# IP family -- 4 or 6
|
||||
#
|
||||
COMMAND1=
|
||||
COMMAND2="ip -4 route ls"
|
||||
FAMILY=4
|
||||
#
|
||||
# The commands to run when the status of a line changes. Both commands will be executed.
|
||||
#
|
||||
COMMANDA=
|
||||
COMMANDB="ip -$FAMILY route ls"
|
||||
...
|
||||
#
|
||||
# Interfaces to monitor -- you may use shell variables from your params file
|
||||
@ -676,7 +684,7 @@ UP_COUNT=5
|
||||
#
|
||||
DOWN_COUNT=2</programlisting>
|
||||
|
||||
<para>If you leave COMMAND1 empty, the script sets its value
|
||||
<para>If you leave COMMANDA empty, the script sets its value
|
||||
automatically depending on whether Shorewall-lite is installed.</para>
|
||||
|
||||
<para>When the status of an interface changes:</para>
|
||||
@ -722,11 +730,28 @@ return $status</programlisting></para>
|
||||
on <trademark>OpenSuSE</trademark> 11.0 -- YMMV. Modify the PROG and
|
||||
STATEDIR variables as needed.</para>
|
||||
|
||||
<para>As an alternative to using the init script, you can add the
|
||||
following to <filename>/etc/shorewall/started</filename>:</para>
|
||||
|
||||
<programlisting>if [ "$COMMAND" = start ]; then
|
||||
killall -9 swping 2> /dev/null #be sure that there are none left running
|
||||
/usr/local/sbin/swping &
|
||||
fi</programlisting>
|
||||
|
||||
<para>and add this to
|
||||
<filename>/etc/shorewall/stopped</filename>.</para>
|
||||
|
||||
<para><programlisting>if [ "$COMMAND" = stop -o "$COMMAND" = clear ]; then
|
||||
killall -9 swping 2> /dev/null
|
||||
fi</programlisting></para>
|
||||
|
||||
<para>This simple script has a number of limitations:</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>It only works on IPv4 (but is easy to modify for IPv6)</para>
|
||||
<para>It only works on IPv4 or IPv6 but not both at once. So if you
|
||||
want to monitor both IPv4 and IPv6, you need to clone the script are
|
||||
run two copies; one for IPv4 and one for IPv6.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@ -744,7 +769,7 @@ return $status</programlisting></para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>It is tricky to configure a system such that a system works
|
||||
<para>It is tricky to configure a system such that the system works
|
||||
correctly when one of its providers is down unless you largely don't
|
||||
care which interface is used.</para>
|
||||
</listitem>
|
||||
|
Loading…
Reference in New Issue
Block a user