Debian Network Configuration

0

0

I have a Debian VPS on which I am trying to open some ports like 80, 443, etc. and here's what I've done:

Creating a test iptables file:

 editor /etc/iptables.test.rules

which has some basic rules:

*filter
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -j ACCEPT
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
COMMIT

The problem is that I am getting the following error on all lines:

iptables-restore: line xx failed

and I need to enable these ports ASAP so what's wrong?

update: fixed everything but now I can't connect to the server via any form (put the address in a browser's address bar and go to it)

P.S.: I'm using this server for my home automation project as a mid point (An Android app issues the commands to the server which in turn issues it to the raspberry pi which controls the house and then the pi sends back a response of success or failure) - on which I'm trying to do the following:

1- enable some ports like 80 & 443 which I have enabled using iptables but still can't put the server's address in a browser's address bar and navigate to it.

2- how will the app communicate with the server noting that sign up & login will take place through the server as I'm right now have both the app & the Pi ready but separate (not connected together & I already know that they will communicate over HTTP but what I don't know is how ?)

user3090933

Posted 2017-05-11T20:33:50.883

Reputation: 21

line xx failed so which line is xx. That error usually is a number. That number tells you the line with the failure. If you gave us the actual error message, it would make it a lot easier to help you. – Zoredache – 2017-05-11T22:34:19.890

@Zoredache all the lines – user3090933 – 2017-05-11T23:24:05.493

Typically use a shell script so each line starts with the path to the iptables executable... /usr/bin/iptables -A INPUT -p tcp -dport 80 -j ACCEPT . Alternatively if you simply want to allow/disallow to ports use UFW and its super simple syntax of ufw allow ssh or ufw allow 80 etc – ivanivan – 2017-05-12T16:02:33.037

@ivanivan I used ufw allow ssh and still nothing happened – user3090933 – 2017-05-13T07:03:11.157

No answers