Add NETMAP support

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1205 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2004-03-18 21:36:27 +00:00
parent 05caa78e22
commit 8d260b7da0
6 changed files with 50 additions and 2 deletions

View File

@ -7,3 +7,5 @@ Changes since 2.0.0
3) Cleanup Warning elimination. 3) Cleanup Warning elimination.
4) Add 'nobogons' 4) Add 'nobogons'
4) Add 'netmap'

View File

@ -91,6 +91,8 @@ restore_file /etc/shorewall/rules
restore_file /etc/shorewall/nat restore_file /etc/shorewall/nat
restore_file /etc/shorewall/netmap
restore_file /etc/shorewall/params restore_file /etc/shorewall/params
restore_file /etc/shorewall/proxyarp restore_file /etc/shorewall/proxyarp

View File

@ -1775,6 +1775,23 @@ delete_nat() {
[ -d ${STATEDIR} ] && touch ${STATEDIR}/nat [ -d ${STATEDIR} ] && touch ${STATEDIR}/nat
} }
#
# Setup Network Mapping (NETMAP)
#
setup_netmap() {
local allints
while read net1 interface net2 ; do
expandv net1 interface net2
addnatrule $(input_chain $interface) -d $net1 -j NETMAP --to $net2
addnatrule $(output_chain $interface) -s $net2 -j NETMAP --to $net1
echo " Network $net1 on $interface mapped to $net2"
done < $TMP_DIR/netmap
}
# #
# Setup ECN disabling rules # Setup ECN disabling rules
# #
@ -4407,6 +4424,7 @@ initialize_netfilter () {
strip_file proxyarp strip_file proxyarp
strip_file maclist strip_file maclist
strip_file nat strip_file nat
strip_file netmap
terminator=fatal_error terminator=fatal_error
@ -5118,6 +5136,10 @@ define_firewall() # $1 = Command (Start or Restart)
setup_nat setup_nat
echo "Setting up NETMAP..."
setup_netmap
echo "Adding Common Rules" echo "Adding Common Rules"
add_common_rules add_common_rules

View File

@ -270,6 +270,16 @@ else
echo "NAT file installed as ${PREFIX}/etc/shorewall/nat" echo "NAT file installed as ${PREFIX}/etc/shorewall/nat"
fi fi
# #
# Install the NETMAP file
#
if [ -f ${PREFIX}/etc/shorewall/netmap ]; then
backup_file /etc/shorewall/netmap
else
run_install -o $OWNER -g $GROUP -m 0600 netmap ${PREFIX}/etc/shorewall/netmap
echo
echo "NETMAP file installed as ${PREFIX}/etc/shorewall/netmap"
fi
#
# Install the Parameters file # Install the Parameters file
# #
if [ -f ${PREFIX}/etc/shorewall/params ]; then if [ -f ${PREFIX}/etc/shorewall/params ]; then

View File

@ -35,5 +35,14 @@ New Features:
http://shorewall.net/bridge.html http://shorewall.net/bridge.html
2) Support for NETMAP has been added. NETMAP allows NAT to be defined
between two network:
a.b.c.1 <-> x.y.z.1
a.b.c.2 <-> x.y.z.2
a.b.c.3 <-> x.y.z.3
...
http://shorewall.net/netmap.html

View File

@ -78,6 +78,7 @@ fi
%attr(0600,root,root) %config(noreplace) /etc/shorewall/interfaces %attr(0600,root,root) %config(noreplace) /etc/shorewall/interfaces
%attr(0600,root,root) %config(noreplace) /etc/shorewall/rules %attr(0600,root,root) %config(noreplace) /etc/shorewall/rules
%attr(0600,root,root) %config(noreplace) /etc/shorewall/nat %attr(0600,root,root) %config(noreplace) /etc/shorewall/nat
%attr(0600,root,root) %config(noreplace) /etc/shorewall/netmap
%attr(0600,root,root) %config(noreplace) /etc/shorewall/params %attr(0600,root,root) %config(noreplace) /etc/shorewall/params
%attr(0600,root,root) %config(noreplace) /etc/shorewall/proxyarp %attr(0600,root,root) %config(noreplace) /etc/shorewall/proxyarp
%attr(0600,root,root) %config(noreplace) /etc/shorewall/routestopped %attr(0600,root,root) %config(noreplace) /etc/shorewall/routestopped
@ -138,9 +139,11 @@ fi
%doc COPYING INSTALL changelog.txt releasenotes.txt tunnel %doc COPYING INSTALL changelog.txt releasenotes.txt tunnel
%changelog %changelog
* Web Mar 17 2004 Tom Eastep <tom@shorewall.net> * Thu Mar 18 2004 Tom Eastep tom@shorewall.net
- Added netmap file
* Wed Mar 17 2004 Tom Eastep <tom@shorewall.net>
- Update for 2.0.1 Beta 1 - Update for 2.0.1 Beta 1
* Web Mar 17 2004 Tom Eastep <tom@shorewall.net> * Wed Mar 17 2004 Tom Eastep <tom@shorewall.net>
- Add bogons file - Add bogons file
* Sat Mar 13 2004 Tom Eastep <tom@shorewall.net> * Sat Mar 13 2004 Tom Eastep <tom@shorewall.net>
- Update for 2.0.0 Final - Update for 2.0.0 Final