You are not logged in.

#1 2014-09-08 13:08:04

Amanda S
Member
Registered: 2013-09-21
Posts: 276
Website

[SOLVED] iptables: bad argument "In_RULE_0"

I'm creating my firewall rules on FirewallBuilder and I noticed it has an "anti spoofing rule" it creates as RULE_0. I'm copying the compiled rules and trying to create a rules file but that rule_0 is not being accepted.

iptables -A INPUT -i enp0s7 -s $i_enp0s7   -j In_RULE_0 
iptables -A In_RULE_0  -j LOG  --log-level info --log-prefix "RULE 0 -- DENY "
iptables -A In_RULE_0  -j DROP

The output is

Bad argument `In_RULE_0'
Try `iptables -h' or 'iptables --help' for more information.

The compiled version with all other commands:

# ================ Table 'filter', rule set Policy
    # 
    # Rule 0 (enp0s7)
    # 
    echo "Rule 0 (enp0s7)"
    # 
    # anti spoofing rule
    $IPTABLES -N In_RULE_0
    for i_enp0s7 in $i_enp0s7_list
    do
    test -n "$i_enp0s7" && $IPTABLES -A INPUT -i enp0s7   -s $i_enp0s7   -j In_RULE_0 
    done
    for i_enp0s7 in $i_enp0s7_list
    do
    test -n "$i_enp0s7" && $IPTABLES -A FORWARD -i enp0s7   -s $i_enp0s7   -j In_RULE_0 
    done
    $IPTABLES -A In_RULE_0  -j LOG  --log-level info --log-prefix "RULE 0 -- DENY "
    $IPTABLES -A In_RULE_0  -j DROP

Some have suggested I put my IP address in there, but that would required extra work considering my IP changes many times a day.

Last edited by Amanda S (2014-10-12 04:00:50)


If it ain't broke, you haven't tweaked it enough...

Offline

#2 2014-09-09 16:30:02

branch
Member
Registered: 2014-03-16
Posts: 209

Re: [SOLVED] iptables: bad argument "In_RULE_0"

That probably means the chain has not been created yet. Create the chain prior to referencing it with:

iptables -N In_RULE_0

You can see if the chain exists with

iptables-save | grep In_RULE_0

Offline

#3 2014-10-12 03:59:59

Amanda S
Member
Registered: 2013-09-21
Posts: 276
Website

Re: [SOLVED] iptables: bad argument "In_RULE_0"

Solved. Instead of using

 -s $i_enp0s7 

use

 -s my-hostname 

so

 iptables -A INPUT -i enp0s7 -s junior   -j In_RULE_0 

Last edited by Amanda S (2014-10-12 04:00:30)


If it ain't broke, you haven't tweaked it enough...

Offline

#4 2014-10-12 04:01:53

Amanda S
Member
Registered: 2013-09-21
Posts: 276
Website

Re: [SOLVED] iptables: bad argument "In_RULE_0"

branch wrote:

That probably means the chain has not been created yet

I was created already. Thanks.


If it ain't broke, you haven't tweaked it enough...

Offline

Board footer

Powered by FluxBB