Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables starting

Reply
Thread Tools Display Modes

iptables starting

 
 
Bernd Roth
Guest
Posts: n/a

 
      04-10-2004, 07:03 PM
Hello,

I wrote the following Iptables script,
but I always get the error message "Blocking Starting"
Bad Argument filter

Can somebody help me please, what I am doing wrong.
The message suddenly appeared, however in the beginning everything was ok
for a 2 or 3 months!

I have Suse Linux 9.0

#!/bin/sh
#
# A simple firewall initialization script
#
WHITELIST=/usr/local/etc/whitelist.txt
BLACKLIST=/usr/local/etc/blacklist.txt
ALLOWED="22 25 80 443"

#
# Drop all existing filter rules
#
iptables -F

#
# First, run through $WHITELIST, accepting all traffic from the hosts and
networks
# contained therein.
#
for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
echo "Permitting $x..."
iptables -A INPUT -t filter -s $x -j ACCEPT
done

#
# Now run through $BLACKLIST, dropping all traffic from the hosts and
networks
# contained therein.
#
for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
echo "Blocking $x..."
iptables -A INPUT -t filter -s $x -j DROP
done

#
# Next, the permitted ports: What will we accept from hosts not appearing
# on the blacklist?
#
for port in $ALLOWED; do
echo "Accepting port $port..."
iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
done

#
# Finally, unless it's mentioned above, and it's an inbound startup request,
# just drop it.
#
iptables -A INPUT -t filter -p tcp --syn -j DROP


 
Reply With Quote
 
 
 
 
Amir Malik
Guest
Posts: n/a

 
      04-10-2004, 07:18 PM
Bernd Roth wrote:

> I wrote the following Iptables script,
> but I always get the error message "Blocking Starting"
> Bad Argument filter


You haven't created the chain "filter". Create it after flushing the
firewall:
iptables -N filter

> The message suddenly appeared, however in the beginning everything was ok
> for a 2 or 3 months!


Maybe you upgraded an iptables kernel module?

> # Drop all existing filter rules
> iptables -F


In addition to flusing the rules, you might want to delete the
user-defined chains and zero the packet counters:
iptables -X
iptables -Z

You can find a lot more hints at http://www.netfilter.org/documentation/

--
Amir Malik
http://www.unoc.net/a/ | $email =~ s/SPAMBLOCK/a/;
4296 EE70 8F7C 1D1A D3C9 D885 95A9 6F83 73E7 589E
 
Reply With Quote
 
Bernd Roth
Guest
Posts: n/a

 
      04-10-2004, 08:01 PM
Thank You,

Now I tried the following thing, but the problem is still the same
I updated the kernel and everything with YOU!

#!/bin/sh
#
# A simple firewall initialization script
#
WHITELIST=/usr/local/etc/whitelist.txt
BLACKLIST=/usr/local/etc/blacklist.txt
ALLOWED="22 25 80 443"

#
# Drop all existing filter rules
#
iptables -F
iptables -X
iptables -Z
iptables -N filter
#
# First, run through $WHITELIST, accepting all traffic from the hosts and
networks
# contained therein.
#
for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
echo "Permitting $x..."
iptables -A INPUT -t filter -s $x -j ACCEPT
done

#
# Now run through $BLACKLIST, dropping all traffic from the hosts and
networks
# contained therein.
#
for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
echo "Blocking $x..."
iptables -A INPUT -t filter -s $x -j DROP
done

#
# Next, the permitted ports: What will we accept from hosts not appearing
# on the blacklist?
#
for port in $ALLOWED; do
echo "Accepting port $port..."
iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
done

#
# Finally, unless it's mentioned above, and it's an inbound startup request,
# just drop it.
#
iptables -A INPUT -t filter -p tcp --syn -j DROP


"Amir Malik" <(E-Mail Removed)> schrieb im Newsbeitrag
news:c59h62$2p6djm$(E-Mail Removed)...
> Bernd Roth wrote:
>
> > I wrote the following Iptables script,
> > but I always get the error message "Blocking Starting"
> > Bad Argument filter

>
> You haven't created the chain "filter". Create it after flushing the
> firewall:
> iptables -N filter
>
> > The message suddenly appeared, however in the beginning everything was

ok
> > for a 2 or 3 months!

>
> Maybe you upgraded an iptables kernel module?
>
> > # Drop all existing filter rules
> > iptables -F

>
> In addition to flusing the rules, you might want to delete the
> user-defined chains and zero the packet counters:
> iptables -X
> iptables -Z
>
> You can find a lot more hints at http://www.netfilter.org/documentation/
>
> --
> Amir Malik
> http://www.unoc.net/a/ | $email =~ s/SPAMBLOCK/a/;
> 4296 EE70 8F7C 1D1A D3C9 D885 95A9 6F83 73E7 589E



 
Reply With Quote
 
Christoph Scheurer
Guest
Posts: n/a

 
      04-13-2004, 06:59 PM
On Sat, 10 Apr 2004 19:03:09 GMT
"Bernd Roth" <(E-Mail Removed)> wrote:

> Hello,
>
> I wrote the following Iptables script,
> but I always get the error message "Blocking Starting"
> Bad Argument filter
>
> Can somebody help me please, what I am doing wrong.
> The message suddenly appeared, however in the beginning everything was ok
> for a 2 or 3 months!
>
> I have Suse Linux 9.0
>
> #!/bin/sh
> #
> # A simple firewall initialization script
> #
> WHITELIST=/usr/local/etc/whitelist.txt
> BLACKLIST=/usr/local/etc/blacklist.txt
> ALLOWED="22 25 80 443"
>
> #
> # Drop all existing filter rules
> #
> iptables -F
>
> #
> # First, run through $WHITELIST, accepting all traffic from the hosts and
> networks
> # contained therein.
> #
> for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
> echo "Permitting $x..."
> iptables -A INPUT -t filter -s $x -j ACCEPT
> done
>
> #
> # Now run through $BLACKLIST, dropping all traffic from the hosts and
> networks
> # contained therein.
> #
> for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
> echo "Blocking $x..."
> iptables -A INPUT -t filter -s $x -j DROP
> done
>
> #
> # Next, the permitted ports: What will we accept from hosts not appearing
> # on the blacklist?
> #
> for port in $ALLOWED; do
> echo "Accepting port $port..."
> iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
> done
>
> #
> # Finally, unless it's mentioned above, and it's an inbound startup request,
> # just drop it.
> #
> iptables -A INPUT -t filter -p tcp --syn -j DROP
>
>

Leave your script as is, just remove the "-t filter", since it is the default.

Greets
Chris


 
Reply With Quote
 
Bernd Roth
Guest
Posts: n/a

 
      04-14-2004, 01:34 PM
Ok, thanks
I will try it!!

"Christoph Scheurer" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed). ..
> On Sat, 10 Apr 2004 19:03:09 GMT
> "Bernd Roth" <(E-Mail Removed)> wrote:
>
> > Hello,
> >
> > I wrote the following Iptables script,
> > but I always get the error message "Blocking Starting"
> > Bad Argument filter
> >
> > Can somebody help me please, what I am doing wrong.
> > The message suddenly appeared, however in the beginning everything was

ok
> > for a 2 or 3 months!
> >
> > I have Suse Linux 9.0
> >
> > #!/bin/sh
> > #
> > # A simple firewall initialization script
> > #
> > WHITELIST=/usr/local/etc/whitelist.txt
> > BLACKLIST=/usr/local/etc/blacklist.txt
> > ALLOWED="22 25 80 443"
> >
> > #
> > # Drop all existing filter rules
> > #
> > iptables -F
> >
> > #
> > # First, run through $WHITELIST, accepting all traffic from the hosts

and
> > networks
> > # contained therein.
> > #
> > for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
> > echo "Permitting $x..."
> > iptables -A INPUT -t filter -s $x -j ACCEPT
> > done
> >
> > #
> > # Now run through $BLACKLIST, dropping all traffic from the hosts and
> > networks
> > # contained therein.
> > #
> > for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
> > echo "Blocking $x..."
> > iptables -A INPUT -t filter -s $x -j DROP
> > done
> >
> > #
> > # Next, the permitted ports: What will we accept from hosts not

appearing
> > # on the blacklist?
> > #
> > for port in $ALLOWED; do
> > echo "Accepting port $port..."
> > iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
> > done
> >
> > #
> > # Finally, unless it's mentioned above, and it's an inbound startup

request,
> > # just drop it.
> > #
> > iptables -A INPUT -t filter -p tcp --syn -j DROP
> >
> >

> Leave your script as is, just remove the "-t filter", since it is the

default.
>
> Greets
> Chris
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting workstation? Reidy Wireless Networks 0 02-22-2007 08:53 AM
FRS always starting OliverP Windows Networking 0 05-08-2006 05:03 PM
USB wireless not starting soon enough? Philip Colmer Wireless Networks 4 09-12-2005 01:32 PM
Starting a WISP Anthony P. Wireless Internet 8 08-21-2005 01:22 PM
Starting Fresh RJP Wireless Networks 1 01-09-2005 07:32 AM



1 2 3 4 5 6 7 8 9 10 11