LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-11-2016, 07:33 AM   #1
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Rep: Reputation: 11
Post How can I restart iptables service?


Hello.
I use Debian 8.6 amd64 and I like to restart my iptables service. How can I do it? seems no service exist with iptables name!!!

Thank you.
 
Old 12-11-2016, 09:03 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
Does Debian 8.6 use SysVinit or SystemD?
 
Old 12-11-2016, 09:10 AM   #3
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Rather than check for service iptables alone, look also for things like iptablesd, iptabled, etc. I am not running Debian 8 right now, but I seem to remember that the name was not perfectly matched to the package. (Which is, as you look around at other packages and services, pretty normal.)

You might also list out ALL services and grep for ipta and see what it returns.

LAST option: you know a reboot will cycle all services that are set to auto-start. That should NEVER be required, but does always work.
 
Old 12-11-2016, 09:49 AM   #4
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by wpeckham View Post
Rather than check for service iptables alone, look also for things like iptablesd, iptabled, etc. I am not running Debian 8 right now, but I seem to remember that the name was not perfectly matched to the package. (Which is, as you look around at other packages and services, pretty normal.)

You might also list out ALL services and grep for ipta and see what it returns.

LAST option: you know a reboot will cycle all services that are set to auto-start. That should NEVER be required, but does always work.
I can't see!!!!
Code:
$ sudo service --status-all
 [ + ]  acpid
 [ - ]  alsa-utils
 [ - ]  anacron
 [ + ]  atd
 [ + ]  avahi-daemon
 [ - ]  bootlogs
 [ - ]  bootmisc.sh
 [ - ]  checkfs.sh
 [ - ]  checkroot-bootclean.sh
 [ - ]  checkroot.sh
 [ + ]  console-setup
 [ + ]  cpufrequtils
 [ + ]  cron
 [ + ]  dbus
 [ - ]  exim4
 [ + ]  hdparm
 [ - ]  hostname.sh
 [ - ]  hwclock.sh
 [ + ]  kbd
 [ + ]  keyboard-setup
 [ - ]  killprocs
 [ + ]  kmod
 [ + ]  lightdm
 [ + ]  loadcpufreq
 [ + ]  minissdpd
 [ - ]  motd
 [ - ]  mountall-bootclean.sh
 [ - ]  mountall.sh
 [ - ]  mountdevsubfs.sh
 [ - ]  mountkernfs.sh
 [ - ]  mountnfs-bootclean.sh
 [ - ]  mountnfs.sh
 [ + ]  network-manager
 [ + ]  networking
 [ + ]  nfs-common
 [ - ]  pppd-dns
 [ + ]  procps
 [ + ]  rc.local
 [ - ]  rmnologin
 [ + ]  rpcbind
 [ - ]  rsync
 [ + ]  rsyslog
 [ - ]  saned
 [ - ]  sendsigs
 [ + ]  speech-dispatcher
 [ - ]  sudo
 [ + ]  udev
 [ + ]  udev-finish
 [ - ]  umountfs
 [ - ]  umountnfs.sh
 [ - ]  umountroot
 [ + ]  urandom
 [ - ]  uuidd
 [ - ]  x11-common
 
Old 12-11-2016, 11:42 AM   #5
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
That is not as I would have done it, but assume that list is complete. What then makes you think that you have iptables installed and running to need restarting?
Have you run anything like
Code:
ps -aef | grep iptabl
to see if it is in memory?
 
Old 12-11-2016, 01:10 PM   #6
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
If it is not in memory then how it protect my system? I write a new iptables rule and I guess that I must restart my service!!!
 
Old 12-11-2016, 04:22 PM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Try
Quote:
dpkg-query --list |grep -i iptabl
and see if it is installed, and at what status.
If it is not installed, you will need to install it using apt-get or one of the gui front-ends to apt.
 
Old 12-11-2016, 04:28 PM   #8
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
I can think of 2 options you can use:
- cook your own
- use one of the frontends
 
Old 12-11-2016, 05:43 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
debian 8 uses systemd. You can install the iptables-persistent package which is a service to load your firewall rules at boot. The service is called netfilter-persistent

The firewall is actually kernel modules that are loaded at boot up and when you add a rule using the iptables frontend ClI utility they take effect immediately. No need to restart anything. You can save your rules using the iptables-save command. There are various GUI firewall front ends to iptables like UFW or firestarter which provides an easier interface then using the CLI.

Last edited by michaelk; 12-11-2016 at 05:44 PM.
 
Old 12-12-2016, 01:07 AM   #10
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by wpeckham View Post
That is not as I would have done it, but assume that list is complete. What then makes you think that you have iptables installed and running to need restarting?
Have you run anything like
Code:
ps -aef | grep iptabl
to see if it is in memory?
Yes, It is in memory:
Code:
$ ps -aef | grep iptabl
jason    4066  4060  0 10:35 pts/2    00:00:00 grep iptabl
 
Old 12-12-2016, 01:08 AM   #11
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by wpeckham View Post
Try and see if it is installed, and at what status.
If it is not installed, you will need to install it using apt-get or one of the gui front-ends to apt.
Code:
$ dpkg-query --list |grep -i iptabl
ii  gnome-orca                            3.14.0-4+deb8u1                      all          Scriptable screen reader
ii  iptables                              1.4.21-2+b1                          amd64        administration tools for packet filtering and NAT
 
Old 12-12-2016, 01:11 AM   #12
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by michaelk View Post
debian 8 uses systemd. You can install the iptables-persistent package which is a service to load your firewall rules at boot. The service is called netfilter-persistent

The firewall is actually kernel modules that are loaded at boot up and when you add a rule using the iptables frontend ClI utility they take effect immediately. No need to restart anything. You can save your rules using the iptables-save command. There are various GUI firewall front ends to iptables like UFW or firestarter which provides an easier interface then using the CLI.
If when I remove or add a rule then it use immediately then need I "iptables-persistent" or "netfilter-persistent" ?
 
Old 12-12-2016, 01:35 AM   #13
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by hack3rcon View Post
Yes, It is in memory:
Code:
$ ps -aef | grep iptabl
jason    4066  4060  0 10:35 pts/2    00:00:00 grep iptabl
No, that is your grep process.

As stated, netfilter is part of the kernel - there is no iptables process or daemon to restart.
 
Old 12-12-2016, 01:40 AM   #14
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by hack3rcon View Post
If when I remove or add a rule then it use immediately then need I "iptables-persistent" or "netfilter-persistent" ?
No, only as an automated way to reload your rules on system boot.

The iptables binary (or netfilter) reads or writes rules in the (volatile) kernel data structure, rrporting the current state or updating it immediately.
 
Old 12-12-2016, 07:11 AM   #15
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Quote:
Originally Posted by hack3rcon View Post
Code:
$ dpkg-query --list |grep -i iptabl
ii  gnome-orca                            3.14.0-4+deb8u1                      all          Scriptable screen reader
ii  iptables                              1.4.21-2+b1                          amd64        administration tools for packet filtering and NAT
Excellent, it is installed. As descendant_command mentioned, the other output indicates that there is NOT an iptables process in memory (I HAVE been able to detect it that way, we will assume it is inactive at this point).

Have you looked up how to import and export rules? You can do this at the command line and test it before loading any additional software for automation.
 
  


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
last service restart fernfrancis Linux - Newbie 4 09-25-2012 01:26 PM
Cron service and oracle service stopped unexpectedly. Can't restart oracle. camron Linux - Newbie 6 06-10-2010 06:00 PM
Restart Service malickhat Solaris / OpenSolaris 1 02-02-2010 03:02 PM
what is the difference between service network reload and service network restart ? markraem Linux - Networking 3 11-21-2007 03:08 PM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 11:24 AM

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

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