LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 09-22-2006, 01:37 PM   #1
outshined
LQ Newbie
 
Registered: Apr 2006
Posts: 26

Rep: Reputation: 15
Question Adding an iptables script to boot


Howdy, I'm wondering what is the best solution to add a command line to startup? I'm using FC5.

Here is the line :
Code:
iptables -t nat -A PREROUTING -s 192.168.0.0/255.255.255.0 
         -p tcp -m tcp --dport 80 -j REDIRECT --to-port 3128
-First option

Use iptables-save to save current state. Does it loads back by itself?


-Second option

Put the script into /etc/rc.d/init.d/scriptname
chmod 755
Then add a link into /etc/rc.d/rc3.d/S09scriptname


Just not sure which one to use.


Thanks
 
Old 09-22-2006, 02:00 PM   #2
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
The second option is the most appropriate one.
 
Old 09-22-2006, 02:29 PM   #3
outshined
LQ Newbie
 
Registered: Apr 2006
Posts: 26

Original Poster
Rep: Reputation: 15
And what will happen in case there is an error in the script? will boot keep going?
 
Old 09-22-2006, 02:47 PM   #4
bio_informatics
LQ Newbie
 
Registered: May 2006
Posts: 5

Rep: Reputation: 0
just add the rule to iptables

and in order to save the current state of iptables, which will be load on startup use

service iptables save

.
 
Old 09-22-2006, 02:50 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
You can add the lines to the /etc/rc.local if you do not want to worry about rc.d scripts. rc.local is the last to run and it is independent of runlevel.

If you use "service iptables save" when the system reboots and the iptables script runs it will reload the saved rules.

Your PC will keep booting if there is an error.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script adding autostart gnome script Coolrunr Programming 3 01-01-2009 02:23 PM
Adding a script to boot kipper2258 Linux - General 11 11-13-2005 02:33 PM
Priority: script to run on boot vs. "service iptables save" iheardrain Linux - General 5 09-30-2004 09:53 PM
RH8 - how to automatically run iptables rules shell script at boot time nu-B Linux - General 1 10-29-2003 08:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 09:44 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration