LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-13-2004, 12:27 PM   #1
GbyteSupport
LQ Newbie
 
Registered: Dec 2004
Posts: 1

Rep: Reputation: 0
Persistent iptables? Where to save the script?


Hello,

First a bit of background: I've had a dedicated server for about 3 years and am used to basic remote adminisitration. The GUI and other features are actually a bit overwhelming...I find myself in terminal pretty often.

At any rate, I'm trying to setup a basic forwarding for my home network. It's run of the mill and it works but is not persistent after reboot or restart. Here is the script I'm using (courtesy of yolinux.com):
Code:
# Delete and flush. Default table is "filter". Others like "nat" must be explicitly stated.
   iptables --flush            
   iptables --table nat --flush
   iptables --delete-chain     
   iptables --table nat --delete-chain

   # Set up IP FORWARDing and Masquerading
   iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
   iptables --append FORWARD --in-interface eth1 -j ACCEPT

   echo 1 > /proc/sys/net/ipv4/ip_forward
Right now I have it saved as an executable and if I reboot I come back and execute. The question I have is how do I execute this script at boot? Can I include it in a rc.d/file?

Now, I want to apologize to all the vets for such a simple question. I have UFSB and read 14 pages of threads as they releate to "gateway". Most are asking how to troubleshoot their networks and iptables for access. I did not find one explaining how to make a currenty working homenetwork persistent after reboot.

I am using CentOS v3.3 with 2 NIC's. eth0 -> internet, eth1 -> internal

All settings are good on boot (homenetwork functional, external access is good) but the forwarding has to be setup with the script above.

Help?

Bobby
 
Old 12-13-2004, 12:41 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,956
Blog Entries: 1

Rep: Reputation: 81
Well.... I have that kind of stuff (things that have to happen at boot time) at the rc.local file. I think that's the quasi-standard place to do that (in a RH-based distribution).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save iptables filters yhus Red Hat 3 07-30-2005 04:01 AM
Where should I save this iptables? wardialer Linux - Newbie 2 02-12-2005 04:10 AM
Priority: script to run on boot vs. "service iptables save" iheardrain Linux - General 5 09-30-2004 09:53 PM
iptables save rules Osten Debian 1 02-10-2004 04:53 PM
Iptables-save ??? gruger Linux - Security 3 05-23-2003 06:23 PM


All times are GMT -5. The time now is 05:22 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration