All pastes #2047794 Raw Edit

root

public text v1 · immutable
#2047794 ·published 2011-04-18 14:35 UTC
rendered paste body
#!/bin/sh# version 2.1.1 # see , route, flush# Source function library.echo 1 > /proc/sys/net/ipv4/ip_forward. /etc/rc.d/init.d/functionsCLIC_INTERFACE="eth0"EXTERNAL_INTERFACE="eth1"		IPTABLES="/sbin/iptables"IPCLIC=`/sbin/ifconfig ${CLIC_INTERFACE} | grep "inet ad" | sed -e "s/\\ Bcast.*$//; s/.*://" | sed -e "s/ //"`IPEXTERNAL=`/sbin/ifconfig ${EXTERNAL_INTERFACE} | grep "inet ad" | sed -e "s/\\ Bcast.*$//; s/.*://" | sed -e "s/ //"`IPBASE_CLIC="`echo ${IPINTERNAL} | awk -F. '{print $1"."$2"."$3}'`"IPBASE_EXTERNAL="`echo ${IPEXTERNAL} | awk -F. '{print $1"."$2"."$3}'`"case $1 in	see)	gprintf " - Filter rules" 	${IPTABLES} -L -t filter -v -n	echo	gprintf " - NAT rules" 	${IPTABLES} -L -t nat -v -n	#gprintf "Mangle regles"	#iptables -L -t mangle -v -n	# echo	gprintf " -end-"	;;		share)	$0 flushaction "Postrouting ${IPBASE_CLIC} " ${IPTABLES} -t nat -A POSTROUTING -o ${CLIC_INTERFACE} -j MASQUERADEaction "Postrouting ${IPBASE_EXTERNAL}" ${IPTABLES} -t nat -A POSTROUTING -o ${EXTERNAL_INTERFACE} -j MASQUERADE	;;		flush)	action "flushing Rules INPUT" ${IPTABLES} -F INPUT	action "flushing Rules OUTPUT" ${IPTABLES} -F OUTPUT	action "flushing Rules FORWARD" ${IPTABLES} -F FORWARD	action "flushing Rules POSTROUTING" ${IPTABLES} -t nat --flush POSTROUTING	action "flushing Rules PREROUTING" ${IPTABLES} -t nat --flush PREROUTING	;;		*)	gprintf "usage $0 : {see|share|flush}\n"	;;esac