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

Notices


Reply
  Search this Thread
Old 03-22-2014, 10:32 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
How to start/stop default iptables


Hi all,

Debian 7.3 64bit

Is there an easier way to stop/start the default iptables? (I haven't added any rules other than the default)

On searching I found;
HowTo Disable The Iptables Firewall in Linux
http://www.cyberciti.biz/faq/turn-on...wall-in-linux/

RE: A note about other Linux distribution
Code:
If you are using other Linux distribution such as Debian / Ubuntu / Suse / Slakcware Linux etc., try the following generic proc
1)
First, run
# iptables-save > /root/firewall.rules

2)
Then run following commands as root
Code:
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
Or create shell script as advised to stop iptables.

3)
To restore or turn on firewall type the following command:
# iptables-restore < /root/firewall.rules

Advice would be appreciated. Thanks.

Rgds
satimis
 
Old 03-22-2014, 01:32 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,344

Rep: Reputation: Disabled
That's just it; you can't "stop" iptables because it's an integral part of the Linux kernel, not a running process.

You prevent iptables from blocking/redirecting/modifying packets by clearing the ruleset and setting the policies on all chains in all tables to ACCEPT, which is what the commands in 2) above, do.
 
Old 03-22-2014, 06:55 PM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by Ser Olmy View Post
That's just it; you can't "stop" iptables because it's an integral part of the Linux kernel, not a running process.

You prevent iptables from blocking/redirecting/modifying packets by clearing the ruleset and setting the policies on all chains in all tables to ACCEPT, which is what the commands in 2) above, do.
Hi,

Thanks for your advice.

How about ufw on following link
How to start/stop iptables in Ubuntu 12.04?
http://askubuntu.com/questions/16155...n-ubuntu-12-04

Can it work on Debian 7.3?

satimis
 
Old 03-22-2014, 07:09 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,344

Rep: Reputation: Disabled
I was waiting for a referance to those services.

Several distributions have, for various reasons, introduced a daemon for managing the iptables ruleset. ufw is the "uncomplicated firewall" in Ubuntu; it's quite easy to manage and generates a very much non-uncomplicated iptables ruleset.

Then there is firewalld in Fedora, which up until quite recently used what was possibly the most ham-fisted approach imaginable to manage firewall rules, and was unable to reload the ruleset without breaking every existing connection.

I don't know what happens if you "stop" (that is, send a SIGTERM to) these daemons. Perhaps they clean up by flushing the ruleset before they exit. Perhaps they do nothing at all and leave the ruleset intact. You'll have to read the documentation for the service in question to find out.

In any case, such daemons are distribution-specific and only act as an abstraction layer on top of the real firewall, iptables. Flushing the ruleset with a script containing the commands you listed will work on any distribution (although one should probably kill off any "firewall" daemons first to prevent them from partially or fully reloading the ruleset).
 
Old 03-23-2014, 07:41 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by satimis View Post
How about ufw on following link
How to start/stop iptables in Ubuntu 12.04?
http://askubuntu.com/questions/16155...n-ubuntu-12-04

Can it work on Debian 7.3?
ufw is one of many firewall frontends packaged for Debian 7. You can install it with apt-get or synaptic etc. If you just want to do basic stuff, eg block a few ports and perhaps do some natting, then arno-iptables-firewall with the debconf management is a pretty good option.

Evo2.
 
  


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
Default service start/stop priorities ? Vilius Debian 1 06-29-2010 05:44 AM
Informix start/stop along with redhat start/stop gxgtudor Red Hat 2 03-06-2009 02:13 AM
AWK- processing data inside start/stop pairs but ignoring start/stop lines cliffoij Programming 2 10-15-2008 06:17 AM
How to install default start/stop script links for deamon directoryserver? kim0 Linux - Newbie 0 12-25-2007 06:37 AM
how to stop/start/restart iptables? plan9 Linux - Newbie 8 08-06-2004 04:40 PM

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

All times are GMT -5. The time now is 03:06 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