two negatived parameters
Quoted 1 line
I take it to mean that packets from host2 to host 3 were NOT accepted by
this
Quoted 1 line
rule? ... What do the counters for the rule say? ( iptables -L -n -v -x
).
yes, I already look after the counter. A paket from host2 to host3 dont increase the counter.
Quoted 1 line
What other rules exist that might affect said packets? -- I note the above
is
Quoted 2 lines
an ADD. Could rules farther up the FORWARD chain have already accepted/denied the said packets?
this was only a example. I tested also on a other pc, with has normal no rulesset to be sure.
Quoted 1 line
FYI -- I just tested this by inserting a double negative rule in my
firewall
Quoted 6 lines
iptables -I
tcp_packets-p tcp -s ! {internal_lan} -d ! {internal lan ip} --dport 25 -j allowedand sending myself an email from outside. The packet counter incremented appropriately.
Sorry, but why are you able to send with this rule a mail from outside to a mailserver in your internal network? I suppose, that with the "-d ! {internal lan ip}" it ist not possible to send a paket to your mailserver.
Quoted 3 lines
well... my two cents :-)
iptables -A FORWARD -s host1 -d host2 -j DROP
well sorry it is not that easy as it seems. The rule should forward pakets to a user-chain only if host1 ist not the source and host2 are is not the destination.
I also tested with the 2.6.7 kernel and 1.2.11, so I can exclude this.
Signature · 2 lines
Supergünstige DSL-Tarife + WLAN-Router für 0,- EUR* Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl
Quoted 5 lines · [email protected] wrote:
Quoted 1 line
iptables -A FORWARD -s host1 -d host2 -j DROP
well sorry it is not that easy as it seems. The rule should forward pakets to a user-chain only if host1 ist not the source and host2 are is not the destination.
Actually, it is... Let draw things out, so that you can see clearly where you made mistake...
What you have is !A AND !B, which is the same thing as !(A OR B), which gives you following table:
A B T
0 0 1
0 1 0
1 0 0
1 1 0
This obviously is not what you wanted. It matches only when both source and destination of the packet are not as specified.
What you want is logical operation that will result in this table:
A B T
0 0 1
0 1 1
1 0 1
1 1 0
Translated from table to formula, this would be !(A AND B) (it is trivial to see that above is negated AND operator table), which could also be written as !A OR !B (if you preffer this form). Now, AFAIK, neither of those can be acomplished directly in Netfilter as one liner.
You can only use and operator, and you can negate arguments only
directly, and somehow I doubt you can specify -s or -d multiple times on same line. But as a workaround, what somebody (you ommited who when quoting) suggested will do exactly what you want:
iptables -A FORWARD -s host1 -d host2 -j DROP
iptables -A FORWARD -j ACCEPT
The first line will drop what you wanted to drop. The second will accept all the rest. Unless there were more rules to follow and more checks to be done for host1 and host2 (in which case, you can do them in user defined chain, and change first line to jump there instead of dropping packet right away). Something along the lines of:
iptables -A FORWARD -s host1 -d host2 -j SOMETHING iptables -A FORWARD -j ACCEPT iptables -N SOMETHING iptables -A SOMETHING -p tcp --dport 80 -j ACCEPT iptables -A SOMETHING -j DROP
Signature · 3 lines
Aleksandar Milivojevic <[email protected]> Pollard Banknote Limited Systems Administrator 1499 Buffalo Place Tel: (204) 474-2323 ext 276 Winnipeg, MB R3T 1L7