LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-25-2011, 10:42 AM   #1
dave247
Member
 
Registered: May 2004
Posts: 206

Rep: Reputation: 30
trouble reloading iptables rules in Debian


I am running Debian Bigmem and iptables v1.3.6

I am not updating or upgrading anything so please dont say things about that or using anything else. I am doing something specific.

My problem/confusion is this: I added a new rule to iptables
Code:
iptables -A INPUT -p tcp  --dport 25 -j ACCEPT
and now I want to reload iptables so the change will take effect. First: do I even need to reload it or are the changes dynamic?

I have tried iptables-reload, iptables-restart, iptables -reload, iptables -restart, uptables restart, /etc/init.d/iptables restart, etc... but nothing works to get it reloaded.

So how could I restart iptables? Do I even need to?

thanks
 
Old 01-25-2011, 10:47 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Hi,

You need to safe the rule, if you want it to work after a reboot.
Take a look at
http://www.debian-administration.org/articles/445

Kind regards
 
Old 01-25-2011, 11:09 AM   #3
dave247
Member
 
Registered: May 2004
Posts: 206

Original Poster
Rep: Reputation: 30
ah I always leave out some important info in my posts!!!!

I did save the iptables using iptables-save and it does save the changes. But then are the changes alive now, or do I actually need to reboot Linux?
 
Old 01-25-2011, 11:11 AM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can verify with
Quote:
iptables -L
Kind regards
 
Old 01-25-2011, 11:14 AM   #5
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Using iptables-save will save the current iptables configuration to a file. You can then use the iptables-restore command to restore the rule set. By default, on reboot the iptables queue is flushed. A common place to put the iptables-restore command is in your networking configuration so that it is called just after the interface is enabled. To use these commands in this fashion, code them as follows:

Code:
iptables-save > to_file
iptables-restore < from_file
Be sure you set appropriate permissions on the file such as root write only. I usually make the the to/from file something like /etc/iptables-rules.
 
Old 01-25-2011, 11:17 AM   #6
dave247
Member
 
Registered: May 2004
Posts: 206

Original Poster
Rep: Reputation: 30
yes the changes get saved. iptables -L shows me the newly added ports.... so then its working? the changes take effect in the firewall immediatly? thats all I was wondering. I was under the assumption that I needed to issue some sort of iptables restart to get the changes to work... but it makes more sense that you wouldnt have to... -A is appending new rules, so it only makes sense.

as long as I dont need to restart iptables, then i have no issue here.

thanks
 
Old 01-25-2011, 11:29 AM   #7
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Any rule entered to iptables takes effect immediately.

The Debian way of setting up iptables is to create a bash script file containing all rules. Every time the script is run, iptables is cleaned and completely set up again. That is a huge advantage, because a script file is much easier to read and edit as compared to iptable -L output.

Have a look at the Debian ipmasq package to understand this philosophy. You have to google it, it is not installed by default.

jlinkels
 
  


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
[SOLVED] I have some trouble while applying iptables firewall rules deltamaster Linux - Security 2 01-09-2011 11:45 AM
Debian - Iptables (and other server services): my rules "change by themselves cocchiararo Linux - Networking 4 01-08-2011 03:41 PM
Trouble reloading servlets in Tomcat 5.5 gatsby Linux - Software 0 03-18-2008 01:45 PM
iptables 1.27a still loading rules after installing iptables 1.3.0 yawe_frek Linux - Software 1 06-07-2007 09:50 PM
Where to put iptables rules from Red Hat in Debian aubrey Debian 2 03-03-2004 06:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:45 AM.

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