zfyseu
Posts: 29
Joined: Fri Jun 10, 2016 12:31 pm

How to start iptables on raspbian?

Sun Jul 03, 2016 2:14 am

Hello,everyone!

when I run the command "service iptables start", it returns the error: "Unit iptables.service failed to load: No such file or directory"
How to start iptables on Rpi2 based on raspbian?

Thanks!

FlexibleSigmoid
Posts: 61
Joined: Sun Jul 03, 2016 1:33 am

Re: How to start iptables on raspbian?

Sun Jul 03, 2016 2:20 am

Hi, I think iptables are built into the kernel for Raspbian.

Do you get an output when you type

Code: Select all

sudo iptables -L
?

knute
Posts: 568
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: How to start iptables on raspbian?

Sun Jul 03, 2016 4:05 am

Unless you are up to something really tricky, like making a router, using one of the wrappers for iptables is a boat load easier. I like ufw but the syntax is a little funky. What are you really trying to do?

zfyseu
Posts: 29
Joined: Fri Jun 10, 2016 12:31 pm

Re: How to start iptables on raspbian?

Sun Jul 03, 2016 4:30 am

I just want to add some rules of iptables like "iptables -A INPUT -p tcp --dport 80 -j ACCEPT", however when I reboot the RPi, the rules are missing.
How should I do ?

FlexibleSigmoid
Posts: 61
Joined: Sun Jul 03, 2016 1:33 am

Re: How to start iptables on raspbian?

Sun Jul 03, 2016 4:46 am

You could either install a package to set your IPTABLES rules persistent, or as knute mentioned, learn UFW.

Code: Select all

sudo ufw allow http
sudo ufw enable
sudo ufw status

zfyseu
Posts: 29
Joined: Fri Jun 10, 2016 12:31 pm

Re: How to start iptables on raspbian?

Sun Jul 03, 2016 6:36 am

I have solved the problem.

I worte a bash file executed automaticlly at boot time.

Another way maybe be "# apt-get install iptables-persistent" seen as the link http://blog.mxard.com/persistent-iptabl ... i-raspbian

Return to “General discussion”