LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 03-16-2007, 07:32 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Rep: Reputation: 31
where are my new iptables-rules?


Hi!
I use the default FC-iptables with the Chain RH-Firewall-1-INPUT.
I made a few modifications using iptables-save. Everything is saved and works fine, but I can't find the modifications in any file. when I look in /etc/sysconfig/iptables I don't see them. Where are saved my modifications?
 
Old 03-16-2007, 10:36 AM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,950
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
When you run iptables-save you have to redirect it into the file. Without doing that it just displays to your screen. (It should really be called iptables-dump rather than save because it doesn't "save" anything unless you've redirected the "dump" into a file.

Just do:
cp -p /etc/sysconfig/iptables /etc/sysconfig/iptables.20070316

iptables-save >/etc/sysconfig/iptables

(The first step saves your previous rule set so you can revert to it if necessary. The date on the end is just a way to let you know when you created the copy. The -p will make it preserve the original creation date on the file itself.)
 
Old 03-16-2007, 07:34 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
You can also load it from a file by using source.
For example:
service iptables stop
source /etc/sysconfig/firewall
iptables-save > /etc/sysconfig/iptables
service iptables restart
 
Old 03-21-2007, 06:31 AM   #4
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Thanks a lot! You definitly saved my computers! I can't believe that the whole time my work wasn't saved despite the iptables-save command! I really can't understand why this command is called like this!
another question: when I do
Quote:
sudo iptables-save >/etc/sysconfig/iptables
I get the message
Quote:
permission denied
. The sudo rights seem to stop with the pipes. Isn't there a possibility to save the whole thing with sudo?
 
Old 03-21-2007, 07:42 AM   #5
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,950
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
It may be it is running iptables-save as root (sudo iptables-save) but then attempting the redirect (>/etc/sysconfig/iptables) as the non-root user.

Perhaps encapsulating it in quotes would work:
sudo "iptables-save >/etc/sysconfig/iptables"

Technical note: ">" is a redirect not a pipe. "|" is a pipe.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables rules blackcat_73 Linux - Networking 3 12-06-2006 12:35 PM
Iptables Rules metallica1973 Linux - Security 26 09-14-2005 12:10 AM
IPTABLES - rules in /etc/sysconfig/iptables The_JinJ Linux - Newbie 6 11-20-2004 01:40 AM
iptables rules puding Linux - Networking 2 08-09-2004 10:46 PM
iptables rules Fatz Linux - Security 1 08-05-2004 06:04 AM


All times are GMT -5. The time now is 07:18 PM.

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