Академический Документы
Профессиональный Документы
Культура Документы
Firewall
A firewall filters packets based on a set of filter
rules.
Packets that pass the rule set are forwarded
through the firewall from one network interface
to another. Packets that dont, are dropped.
Software Needed
Iptables Software that filters IP based
traffic based on a set of rules.
Ebtables Software that allows Iptables to
see the packets as they go through the
Bridge interface.
Hardware Needed
Any old Pentium based computer
128MB of RAM
~1GB Harddrive
2 - Network Cards (Minimum)
BRCTL=/usr/sbin/brctl
IFCONFIG=/sbin/ifconfig
$BRCTL show
echo -e "$return"
;;
return=$rc_done
case "$1" in
start)
echo "Starting service bridge br0"
# Create bridge interface
$BRCTL addbr br0 || return=$rc_failed
# Turn Spanning Tree Protocall off
$BRCTL stp br0 off || return=$rc_failed
# Add interfaces to bridge
$BRCTL addif br0 eth1 || return=$rc_failed
$BRCTL addif br0 eth2 || return=$rc_failed
# Reset to clean state
$IFCONFIG eth1 down || return=$rc_failed
$IFCONFIG eth2 down || return=$rc_failed
# Set interfaces to Promiscuous Mode
$IFCONFIG eth1 0.0.0.0 promisc || return=$rc_failed
$IFCONFIG eth2 0.0.0.0 promisc || return=$rc_failed
#Bring bridge interface up
$IFCONFIG br0 promisc up || return=$rc_failed
stop)
echo "Shutting down service bridge br0"
$IFCONFIG br0 down || return=$rc_failed
$BRCTL delif br0 eth1 || return=$rc_failed
$BRCTL delif br0 eth2 || return=$rc_failed
$BRCTL delbr br0 || return=$rc_failed
echo -e "$return"
;;
status)
$IFCONFIG br0
$BRCTL show
;;
restart)
$0 stop && $0 start || return=$rc_failed
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
test "$return" = "$rc_done" || exit 1
exit 0
Useful Application
Ethereal A powerful network protocol/packet
analyzer that can be used to aid in the development
of your filter rules.
Resources
Linux bridging how-to
http://bridge.sourceforge.net
Ebtables
http://ebtables.sourceforge.net
Ethereal
http://www.ethereal.com/