* REJECT target not as policy
@ 2007-08-20 13:52 Bertram Scharpf
2007-08-20 14:08 ` Ruben Laban
0 siblings, 1 reply; 8+ messages in thread
From: Bertram Scharpf @ 2007-08-20 13:52 UTC (permalink / raw)
To: netfilter
Hi,
on one of my machines the REJECT target doesn't behave as I
expect. It is inserted into a chain but it is not accepted
as a policy.
myhost ~ # iptables -L
Chain INPUT (policy DROP 2 packets, 116 bytes)
pkts bytes target prot opt in out source destination
...
0 0 REJECT tcp -- any any anywhere anywhere ...
...
But:
myhost ~ # iptables -v -t filter -P INPUT REJECT
iptables: Bad policy name
How comes this? I guess it is a kernel option I have to
change. But which?
Thanks in advance,
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REJECT target not as policy
2007-08-20 13:52 REJECT target not as policy Bertram Scharpf
@ 2007-08-20 14:08 ` Ruben Laban
2007-08-20 15:52 ` Pascal Hambourg
0 siblings, 1 reply; 8+ messages in thread
From: Ruben Laban @ 2007-08-20 14:08 UTC (permalink / raw)
To: netfilter
On Monday 20 August 2007, Bertram Scharpf wrote:
> on one of my machines the REJECT target doesn't behave as I
> expect. It is inserted into a chain but it is not accepted
> as a policy.
>
> myhost ~ # iptables -L
> Chain INPUT (policy DROP 2 packets, 116 bytes)
> pkts bytes target prot opt in out source
> destination ...
> 0 0 REJECT tcp -- any any anywhere
> anywhere ... ...
>
> But:
>
> myhost ~ # iptables -v -t filter -P INPUT REJECT
> iptables: Bad policy name
>
>
> How comes this? I guess it is a kernel option I have to
> change. But which?
The REJECT target is only valid when either the tcp or udp module is loaded.
Hence it cannot be used as a policy.
HTH
--
Ruben
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REJECT target not as policy
2007-08-20 14:08 ` Ruben Laban
@ 2007-08-20 15:52 ` Pascal Hambourg
2007-08-20 17:46 ` Bertram Scharpf
0 siblings, 1 reply; 8+ messages in thread
From: Pascal Hambourg @ 2007-08-20 15:52 UTC (permalink / raw)
To: netfilter
Hello,
Ruben Laban a écrit :
> On Monday 20 August 2007, Bertram Scharpf wrote:
>
>>on one of my machines the REJECT target doesn't behave as I
>>expect. It is inserted into a chain but it is not accepted
>>as a policy.
It behaves as expected. REJECT is an extension, not a built-in target,
and cannot be used as a policy. Check man iptables.
> The REJECT target is only valid when either the tcp or udp module is loaded.
AFAIK, REJECT is not dependant on tcp or udp and can be used with any
protocol. Only the "--reject-with tcp-reset" option can be used only
with tcp.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REJECT target not as policy
2007-08-20 15:52 ` Pascal Hambourg
@ 2007-08-20 17:46 ` Bertram Scharpf
2007-08-20 18:43 ` Pascal Hambourg
0 siblings, 1 reply; 8+ messages in thread
From: Bertram Scharpf @ 2007-08-20 17:46 UTC (permalink / raw)
To: netfilter
Hi,
Am Montag, 20. Aug 2007, 17:52:02 +0200 schrieb Pascal Hambourg:
> Ruben Laban a écrit :
>> On Monday 20 August 2007, Bertram Scharpf wrote:
>>> on one of my machines the REJECT target doesn't behave as I
>>> expect. It is inserted into a chain but it is not accepted
>>> as a policy.
>
> It behaves as expected. REJECT is an extension, not a built-in target, and
> cannot be used as a policy. Check man iptables.
I wrote "as _I_ expect". Obviously I expected wrong. Now, I
found it in the manpage.
On an other list I was told it were a good idea to set
REJECT as policy. I'm so glad that I asked here. Thank you.
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REJECT target not as policy
2007-08-20 17:46 ` Bertram Scharpf
@ 2007-08-20 18:43 ` Pascal Hambourg
2007-08-20 19:11 ` Rob Sterenborg
0 siblings, 1 reply; 8+ messages in thread
From: Pascal Hambourg @ 2007-08-20 18:43 UTC (permalink / raw)
To: netfilter
Bertram Scharpf a écrit :
>
> On an other list I was told it were a good idea to set
> REJECT as policy.
I could be a good idea if it was possible. Maybe the person who told you
mixed up iptables and ipchains, its "predecessor" for 2.2 kernels. IIRC
ipchains allowed REJECT as a policy.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: REJECT target not as policy
2007-08-20 18:43 ` Pascal Hambourg
@ 2007-08-20 19:11 ` Rob Sterenborg
2007-08-20 20:27 ` Pascal Hambourg
0 siblings, 1 reply; 8+ messages in thread
From: Rob Sterenborg @ 2007-08-20 19:11 UTC (permalink / raw)
To: netfilter
>> On an other list I was told it were a good idea to set
>> REJECT as policy.
>
> I could be a good idea if it was possible. Maybe the person who told
> you mixed up iptables and ipchains, its "predecessor" for 2.2
> kernels. IIRC ipchains allowed REJECT as a policy.
You could emulate a REJECT policy by having this as the very last rules:
$ipt -A INPUT -p tcp -j REJECT --reject-with tcp-reset
$ipt -A INPUT -j REJECT
(I thought it was like this..)
But, if you dynamically add rules then you have to take care of at/from
which position you insert/delete them.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: REJECT target not as policy
2007-08-20 19:11 ` Rob Sterenborg
@ 2007-08-20 20:27 ` Pascal Hambourg
2007-08-21 5:26 ` Rob Sterenborg
0 siblings, 1 reply; 8+ messages in thread
From: Pascal Hambourg @ 2007-08-20 20:27 UTC (permalink / raw)
To: netfilter
Rob Sterenborg a écrit :
>
> You could emulate a REJECT policy by having this as the very last rules:
>
> $ipt -A INPUT -p tcp -j REJECT --reject-with tcp-reset
> $ipt -A INPUT -j REJECT
>
> (I thought it was like this..)
What was like what ?
> But, if you dynamically add rules then you have to take care of at/from
> which position you insert/delete them.
A user-defined chain comes in handy. Jump into it before the REJECT
rules and add the dynamic rules in it.
iptables -N input
iptables -A INPUT -j input
iptables -A INPUT -j REJECT
iptables -A input blah...
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: REJECT target not as policy
2007-08-20 20:27 ` Pascal Hambourg
@ 2007-08-21 5:26 ` Rob Sterenborg
0 siblings, 0 replies; 8+ messages in thread
From: Rob Sterenborg @ 2007-08-21 5:26 UTC (permalink / raw)
To: netfilter
>> You could emulate a REJECT policy by having this as the very last
>> rules:
>>
>> $ipt -A INPUT -p tcp -j REJECT --reject-with tcp-reset
>> $ipt -A INPUT -j REJECT
>>
>> (I thought it was like this..)
>
> What was like what ?
Emulating a REJECT policy. If I'm not mistaken a closed tcp port
responds with tcp-reset and others with icmp-port-unreachable (REJECT's
default).
If the OP was told to set a REJECT policy, I think it would have been
with this in mind.
>> But, if you dynamically add rules then you have to take care of
>> at/from which position you insert/delete them.
>
> A user-defined chain comes in handy. Jump into it before the REJECT
> rules and add the dynamic rules in it.
>
> iptables -N input
> iptables -A INPUT -j input
> iptables -A INPUT -j REJECT
>
> iptables -A input blah...
Yes, I that's how I would do it.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-21 5:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-20 13:52 REJECT target not as policy Bertram Scharpf
2007-08-20 14:08 ` Ruben Laban
2007-08-20 15:52 ` Pascal Hambourg
2007-08-20 17:46 ` Bertram Scharpf
2007-08-20 18:43 ` Pascal Hambourg
2007-08-20 19:11 ` Rob Sterenborg
2007-08-20 20:27 ` Pascal Hambourg
2007-08-21 5:26 ` Rob Sterenborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox