[Cialug] Home/Office Network start script

steve.phares at mchsi.com steve.phares at mchsi.com
Mon Jun 13 22:49:34 CDT 2005


Thank you in advance for your time and concideration.   

I have a new/clean install of RedHat Pro WorkStation (kernel = 2.4.21)
with two ethetnet NICs to be used primarily as a router/firewall.

One NIC pointing to the cable/broadband service provider and the second 
pointing to a number of wintel and linux boxes via a small switch on the 
inside VLAN.

I currently login as root and run, (manually) a very simple seven line script 
that I wrote/borrowed (see below). 

Four lines to cleanup/flush iptables and nat, two lines to re-establish 
iptables and nat with the last line to enable packet forwording by the kernel.

I know the script needs A LOT of firewall TLC/tweeking, but it DOES function 
and allows IP traffic to pass to/from the office network to the real world!

Inittab calls runlevel 5 (X11/GUI) as initdefault. 

Sometimes, for admin reasons, I might want or need to go to run level 3 or even
run level 2 or 1.

I Know that I can include and/or call this script from rc 3, rc 4, rc 5 or 
rc.local.  
I have ran and re-booted this script in rc.local.  It works!

My question is… 
   where Should I or Need to launch this script???


Thank you again for your time and concideration.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ScriptX
# 
#Flush and delete filters and chains
       iptables --flush
       iptables –-table nat –flush
       iptables –-delete-chain
       iptables --table nat –delete-chain
#
#Setup Forwarding and Masquerading
       iptables –table nat –append POSTROUTING –out-interface eth1 –j 
MASQUERADE
       iptables –append FORWARD –in-interface eth0 –j ACCEPT
#
#Enable IP packet forwarding by the kernel
       echo > 1 /proc/sys/net/ipv4/ip_forward


More information about the Cialug mailing list