Hey Anousa,
Yeah, basically what I've done is created a startup script that sets my IP address and such as well as runs the iptable command on boot. Here it is:
Note that this is the same script that is given in the ipmasq documentation with my modifications:
#!/bin/sh
ifdown eth4
ifconfig eth4 67.1.1.174 netmask 255.255.254.0 up
ifconfig eth5 192.168.182.1 netmask 255.255.255.0 up
chilli
echo -e "\n\nIPMASQ *TEST* rc.firewall ruleset - v0.60\n"
#The location of the iptables program
IPTABLES=/usr/local/sbin/iptables
echo " - Verifying that all kernel modules are ok"
/sbin/depmod -a
EXTIF="eth4"
INTIF="tun0"
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe iptable_nat
modprobe ip_nat_ftp
echo "- Enabling packet fowarding in the kernel"
echo "1" > /proc/sys/net/ipv4/ip_forward
echo " - Enabling dynamic addressing measures"
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
echo "-Resetting the firewall andsetting the default FORWARD policy to
DROP"
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
#You must change eth5 to ppp0 if you are using a modem or change eth5 and
#eth4 to another network device if that is not what you are using.
echo " - FWD: Allow all connections OUT andonly existing and related ones IN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG
echo "- Enabling SNAT (MASQUERADE) funtionality on eth4"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
echo -e "\nDone.\n"
=========END CODE==========
Also remember that eth4 is my external interface and eth5 is internal.
Hope this helps! Email me at benomanspambox@gmail.com if you have any questions!
--Ben Oman