Skip to contentSkip to conversation

what's wrong?

LARTC francesco messineo 2 participants 5 messages Feb 22, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines · francesco messineo
# iptables -t mangle -A POSTROUTING -m mark  --mark ! 0 -j ACCEPT

iptables v1.3.3: Bad MARK value `!'

I'm puzzled, what's wrong with this syntax?
kernel is 2.6.15.7-ubuntu1

also tried with a 2.6.20.1 compiled from source and same result. I can't make also work these two rules:

iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark

both fail with:

iptables: Invalid argument

what's wrong?

Thanks
Francesco
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#1 lore raw
Quoted 8 lines · francesco messineo
Quoted 7 lines · francesco messineo
# iptables -t mangle -A POSTROUTING -m mark  --mark ! 0 -j ACCEPT

iptables v1.3.3: Bad MARK value `!'

I'm puzzled, what's wrong with this syntax?
kernel is 2.6.15.7-ubuntu1

Not all extensions support all types of matching. Looks like MARK doesn't support an inverse match.

If you want the same effect redirect all traffic to another chain, and within that chain RETURN if you match a 0, and then with a subsequent rule ACCEPT any other packets. This way if packets are MARKed 0 then they will carry on traversing the table, otherwise they will be ACCEPTed

iptables -t mangle -A POSTROUTING -J new_chain

--

iptables -t mangle -N new_chain
iptables -t mangle -A new_chain -m mark --mark 0 -j RETURN iptables -t mangle -A new_chain -j ACCEPT

Quoted 11 lines

also tried with a 2.6.20.1 compiled from source and same result. I can't make also work these two rules:

iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark

both fail with:

iptables: Invalid argument

Looks like your iptables (or your kernel?) doesn't support CONNMARK. What version of iptables do you have?

Andy Beverley

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#2 lore raw
In reply to francesco messineo

Hi Andrew,

Quoted 18 lines · Andrew Beverley
Quoted 8 lines · francesco messineo
Quoted 7 lines · francesco messineo
# iptables -t mangle -A POSTROUTING -m mark  --mark ! 0 -j ACCEPT

iptables v1.3.3: Bad MARK value `!'

I'm puzzled, what's wrong with this syntax?
kernel is 2.6.15.7-ubuntu1

Not all extensions support all types of matching. Looks like MARK doesn't support an inverse match.

If you want the same effect redirect all traffic to another chain, and within that chain RETURN if you match a 0, and then with a subsequent rule ACCEPT any other packets. This way if packets are MARKed 0 then they will carry on traversing the table, otherwise they will be ACCEPTed

Quoted 9 lines

iptables -t mangle -A POSTROUTING -J new_chain

--

iptables -t mangle -N new_chain
iptables -t mangle -A new_chain -m mark --mark 0 -j RETURN iptables -t mangle -A new_chain -j ACCEPT

ok, that's easy enough, in fact this isn't the worst problem...

Quoted 6 lines
Quoted 6 lines

also tried with a 2.6.20.1 compiled from source and same result. I can't make also work these two rules:

iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

Quoted 8 lines
Quoted 5 lines

iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark

both fail with:

iptables: Invalid argument

Looks like your iptables (or your kernel?) doesn't support CONNMARK. What version of iptables do you have?

kernel has the CONNMARK support built as module and loaded. iptables is v1.3.3

Thanks
Francesco
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#3 lore raw
In reply to francesco messineo
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I can't make also work these two rules:

iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark

both fail with:

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

iptables: Invalid argument

Looks like your iptables (or your kernel?) doesn't support CONNMARK. What version of iptables do you have?

kernel has the CONNMARK support built as module and loaded. iptables is v1.3.3

At a guess 1.3.3 doesn't support CONNMARK. Try the latest version (1.3.7) - this is the version I'm using and it works fine.

Regards,

Andy

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#4 lore raw
In reply to francesco messineo

Hello again

Quoted 11 lines · Andrew Beverley
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

I can't make also work these two rules:

iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark

both fail with:

iptables: Invalid argument

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Looks like your iptables (or your kernel?) doesn't support CONNMARK. What version of iptables do you have?

kernel has the CONNMARK support built as module and loaded. iptables is v1.3.3

At a guess 1.3.3 doesn't support CONNMARK. Try the latest version (1.3.7) - this is the version I'm using and it works fine.

yes indeed, upgrading to 1.3.7 solved the problem. Many thanks

Francesco
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc