LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   iptables neither systemctl or service starts it (https://www.linuxquestions.org/questions/linux-security-4/iptables-neither-systemctl-or-service-starts-it-4175638376/)

richard-g8jvm2 09-14-2018 05:29 AM

iptables neither systemctl or service starts it
 
Hi
sorry this is silly ,but
Ubuntu16.04.5 fresh install on a odroid c1
this was working and has stopped.
the rules are
Code:

# Generated by iptables-save v1.6.1 on Wed Sep 12 18:42:10 2018
*nat
:PREROUTING ACCEPT [18:4517]
:INPUT ACCEPT [18:4517]
:OUTPUT ACCEPT [52:3494]
-A PREROUTING -p tcp -m tcp --dport 8083 -j DNAT --to-destination 192.168.1.70:8083
-A PREROUTING -p tcp -m tcp --dport 8081 -j DNAT --to-destination 192.168.1.71:7776
-A PREROUTING -p tcp -m tcp --dport 8085 -j DNAT --to-destination 192.168.1.72:7777
#-A POSTROUTING -p tcp --sport 8083 -j MASQUERADE
-A POSTROUTING -d 192.168.1.70 -p tcp --dport 8083 -j MASQUERADE
#-A POSTROUTING -d 192.168.1.71 -p tcp --dport 7776 -j MASQUERADE
#-A POSTROUTING -d 192.168.1.72 -p tcp --dport 7777 -j MASQUERADE
:POSTROUTING ACCEPT [0:0]
COMMIT

iptables -t nat -vL verifies this

ps ax|grep iptables shows no process running

Code:

root@odroid:/# systemctl enable iptables
Failed to execute operation: No such file or directory
root@odroid:/# systemctl start iptables
Failed to start iptables.service: Unit iptables.service not found.
root@odroid:/# service iptables start
Failed to start iptables.service: Unit iptables.service not found.
root@odroid:/# service iptables enable
iptables: unrecognized service

iptables and iptables-persistent are installed
this is something stupid, but I cant find the solution
ideas ????

berndbausch 09-14-2018 08:12 AM

My idea is that there is nothing wrong. What process do you expect to run? iptables is a command to manage netfilter rules in the kernel, not a background process.

Is anything not working on your Odroid?

richard-g8jvm2 09-14-2018 09:24 AM

Thanks.
The only thing the odroid should be doing is forwarding
I went to flash the sd card and noticed it was slow,so I went and got a new sandisk ultra 16G card
flashed Ubuntu 18.04 on it, did a apt update and upgrade
SFTP'd a copy of the iptables rules to it, and then did a iptables-restore < /etc/iptables.rules

Code:

root@odroid:~# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target    prot opt source              destination       
DNAT      tcp  --  anywhere            anywhere            tcp dpt:8083 to:192.168.1.70:8083
DNAT      tcp  --  anywhere            anywhere            tcp dpt:tproxy to:192.168.1.71:7776
DNAT      tcp  --  anywhere            anywhere            tcp dpt:8085 to:192.168.1.72:7777

Chain INPUT (policy ACCEPT)
target    prot opt source              destination       

Chain OUTPUT (policy ACCEPT)
target    prot opt source              destination       

Chain POSTROUTING (policy ACCEPT)
target    prot opt source              destination       
MASQUERADE  tcp  --  anywhere            odroid.lan          tcp dpt:8083

so thats all there is on the odroid

from a browser on another machine http://192.168.1.80:8083
and nothing , not getting forwarded
from the same browser 192.168.1.70:8083 and straight to the port
I wondered if it was because the source port and desination port are the same, but the same happens on ports 8081 and 8085
which redirect to 7776 and 7777 ( ip cameras )
8083 is masqueraded because that machine has a VPN running so the reply gets sent to New York.

It was working, or did it work by accident with a rule I wasn't aware of ???
I'm begining to suspect the latter as three virgin images all do the same .
very difficult to spot your own mistakes, especially when I make so many
TIA

richard-g8jvm2 09-14-2018 10:09 AM

Hi
I feel like a total idiot, ip forwarding had been disabled
but , even after editing /ect/sysctl.conf and setting to 1
its still booting up with them disabled, until switched on.... very strange

berndbausch 09-14-2018 04:24 PM

Quote:

Originally Posted by richard-g8jvm2 (Post 5903318)
its still booting up with them disabled, until switched on.... very strange

What is disabled? What do you switch on to enable it?

richard-g8jvm2 09-14-2018 05:00 PM

still my fault :?(

it was ip-forwarding disabled , by my bad editing, all sorted now


All times are GMT -5. The time now is 10:27 AM.