All pastes #438222 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-13 14:24 UTC
rendered paste body
Change /usr/bin/iptables_removeall.sh

#! /bin/sh
# $Id: iptables_removeall.sh,v 1.3 2006/11/23 12:32:57 nanard Exp $
+ . /etc/functions.sh
IPTABLES=iptables

#change this parameters :
- EXTIF=eth0
- EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
+ include /lib/network
+ scan_interfaces
+ config_get EXTIF wan ifname
+ config_get EXTIP wan ipaddr

#removing the MINIUPNPD chain for nat
$IPTABLES -t nat -F MINIUPNPD
#rmeoving the rule to MINIUPNPD
$IPTABLES -t nat -D PREROUTING -d $EXTIP -i $EXTIF -j MINIUPNPD
$IPTABLES -t nat -X MINIUPNPD

#removing the MINIUPNPD chain for filter
$IPTABLES -t filter -F MINIUPNPD
#adding the rule to MINIUPNPD
$IPTABLES -t filter -D FORWARD -i $EXTIF -o ! $EXTIF -j MINIUPNPD
$IPTABLES -t filter -X MINIUPNPD


Change /usr/bin/iptables_init.sh

#! /bin/sh
# $Id: iptables_init.sh,v 1.3 2006/11/23 12:32:57 nanard Exp $
+ . /etc/functions.sh
IPTABLES=iptables

#change this parameters :
- EXTIF=eth0
- EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
+ include /lib/network
+ scan_interfaces
+ config_get EXTIF wan ifname
+ config_get EXTIP wan ipaddr
echo "External IP = $EXTIP"

#adding the MINIUPNPD chain for nat
$IPTABLES -t nat -N MINIUPNPD
#adding the rule to MINIUPNPD
$IPTABLES -t nat -A PREROUTING -d $EXTIP -i $EXTIF -j MINIUPNPD

#adding the MINIUPNPD chain for filter
$IPTABLES -t filter -N MINIUPNPD
#adding the rule to MINIUPNPD
$IPTABLES -t filter -A FORWARD -i $EXTIF -o ! $EXTIF -j MINIUPNPD