LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   IPTables Question (https://www.linuxquestions.org/questions/linux-newbie-8/iptables-question-4175483427/)

monkinsane 11-05-2013 02:05 AM

IPTables Question
 
Hi there,

I have been trying to set up a FW, and ran into a snag.

I set up my script with rules, and it ran through perfectly the first time. I then rebooted and ran it again and I get the following errors when it tries to apply this rules:


Quote:

iptables -A INPUT -i enp0s3 --src ! 192.168.123.0/24 -j LOG --log-prefix "SPOOFED PKT "
Quote:

iptables -A INPUT -i enp0s3 --src ! 192.168.123.0/24 -j DROP
The error is:

Quote:

Bad argument `192.168.123.0/24'
Try `iptables -h' or 'iptables --help' for more information.
Any help would be appriciated.

acid_kewpie 11-05-2013 02:39 AM

Hmm, not sure quite what happened when, but it seems the syntax has changed at some point, so "-s ! 1.2.3.4" should now be "! -s 1.2.3.4"

monkinsane 11-05-2013 02:50 AM

Never mind,

Book I am using is a bit out of dat it would seem.

Syntax has changed, rule should be:

Quote:

iptables -A INPUT -i enp0s3 ! --src 192.168.123.0/24 -j LOG --log-prefix "SPOOFED PKT "

monkinsane 11-05-2013 02:52 AM

Quote:

Originally Posted by acid_kewpie (Post 5058582)
Hmm, not sure quite what happened when, but it seems the syntax has changed at some point, so "-s ! 1.2.3.4" should now be "! -s 1.2.3.4"

Thanx, yeah figured out that the syntax has changed.

Bit retarded to change syntax imho.

thanx for the assist.

acid_kewpie 11-05-2013 02:54 AM

I *think* I can see a grammatical reason to change it, as it makes the inversion at a higher conceptual level in the rule logic, but yeah it seems pretty petty to me.


All times are GMT -5. The time now is 01:03 PM.