ip_forward

Joel Hammer Joel
Mon May 17 11:29:08 PDT 2004


BTW, is there a reason you wouldn't want just to put the echo statement
into your startup script right before the end of the start section?
I have found it better to modify, yea, even write, my own startup scripts,
rather then poke around the configuration files scattered around the
computer or puzzle over the GUI packaged with the particular distro I am
using at the moment. Writing startup scripts is also a good way to force
yourself to learn bash. And, you can really customize things. For example,
here is an excerpt from the start section of my network startup script. I
can't imagine how I would get this all done otherwise.

case "$1" in
 start)
echo 1 > /proc/sys/net/ipv4/ip_forward
# set up ipchains
           /sbin/ipchains -F
           cat /root/ipchains.saved | /sbin/ipchains-restore -f
#entry to enable ftp through firewall
            insmod /usr/src/linux/net/ipv4/ip_masq_ftp.o    
            insmod /usr/src/linux/net/ipv4/ip_masq_quake.o    
            insmod /usr/src/linux/net/ipv4/ip_masq_raudio.o    
            insmod /usr/src/linux/net/ipv4/ip_masq_mfw.o 
#entry to redirect internet traffic to a computer on my intranet
ipmasqadm mfw -I -m 2 -r 192.168.0.6 80 
ipmasqadm mfw -I -m 3 -r 192.168.0.6 6699 
ipmasqadm mfw -I -m 4 -r 192.168.0.6  14
ipmasqadm mfw -I -m 5 -r 192.168.0.6  6346 

/sbin/ifconfig lo 127.0.0.0
route add -net 127.0.0.0 netmask 255.0.0.0 lo
/sbin/ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 eth0
# the line below is only run if I loose my dynamically assigned IP number
# /sbin/dhcpcd -d -h pcp361333pcs-udp079123uds.towson01.md.comcast.net eth1
. /etc/dhcpcd-eth1.info
/sbin/ifconfig eth1 down
/sbin/ifconfig eth1 $IPADDR netmask $NETMASK broadcast $BROADCAST
/sbin/route add -net default gw $GATEWAY eth1
# /bin/hostname `/usr/bin/host $IPADDR $DNS | sed -n "s/.*pointer *//"`
#Entry to fix up arp table for subnet
arp -s laptop  00:D0:59:5C:DA:13  
 ;;
 stop)

Joel




More information about the Linux-users mailing list