Listing 7: add.forward
#!/bin/sh
IPFW="/sbin/ipfwadm"
# Assume eth0 is our trusted interface
TRUSTIF=`/sbin/ifconfig eth0|sed -n -e "s/^[ ]*inet addr\:\([0-
9\.]*\).*$/\1/p"`
if [ -x $IPFW ]; then
# Add forwarding rules for nameserver
$IPFW -F -a masquerade -P udp -V $TRUSTIF -S 193.78.174.34 53 -D 0.0.0.0/0 53
# Add forwarding rules for clients
$IPFW -F -a masquerade -P tcp -V $TRUSTIF -S 193.78.174.34 -D 0.0.0.0/0
$IPFW -F -a masquerade -P tcp -V $TRUSTIF -S 193.78.174.35 -D 0.0.0.0/0
fi
|