<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: IPTables: Fun with MARK</title>
	<atom:link href="http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/feed/" rel="self" type="application/rss+xml" />
	<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/</link>
	<description>random stuff from the mind of a twenty-something professional geek</description>
	<lastBuildDate>Mon, 26 Mar 2012 03:27:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Ferry</title>
		<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/comment-page-1/#comment-18426</link>
		<dc:creator>Ferry</dc:creator>
		<pubDate>Mon, 26 Mar 2012 03:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://andys.org.uk/bits/?p=10#comment-18426</guid>
		<description>Hai,

i want to limit bandwidth and route to 3 gateway, my rules show like this:
ip rule add fwmark 11 table $TABLE_1
ip rule add fwmark 12 table $TABLE_2
ip rule add fwmark 14 table $TABLE_3

iptables -t mangle -A PREROUTING -m state --state new -j MARK --set-xmark 0x1
iptables -t mangle -A PREROUTING -m state --state new -m statistic --mode random --probability 0.3 -j MARK --set-xmark 0x2
iptables -t mangle -A PREROUTING -m state --state new -m statistic --mode random --probability 0.3 -j MARK --set-xmark 0x4

for tc:

iptables -t mangle -A FORWARD -o eth0 -p tcp --sport 80 -j MARK --set-xmark 10
iptables -t mangle -A FORWARD -o eth0 -p udp --sport 80 -j MARK --set-xmark 10
iptables -t mangle -A PREROUTING -p tcp --dport 80 -j MARK --set-xmark 10

it&#039;s that mean if packet goes to port 80 and table1 will marked 11? If I have a lot of port marking rule, do i have to write complex ip rule?

Do you have something more simple? or it really have to be complicated like that?</description>
		<content:encoded><![CDATA[<p>Hai,</p>
<p>i want to limit bandwidth and route to 3 gateway, my rules show like this:<br />
ip rule add fwmark 11 table $TABLE_1<br />
ip rule add fwmark 12 table $TABLE_2<br />
ip rule add fwmark 14 table $TABLE_3</p>
<p>iptables -t mangle -A PREROUTING -m state &#8211;state new -j MARK &#8211;set-xmark 0&#215;1<br />
iptables -t mangle -A PREROUTING -m state &#8211;state new -m statistic &#8211;mode random &#8211;probability 0.3 -j MARK &#8211;set-xmark 0&#215;2<br />
iptables -t mangle -A PREROUTING -m state &#8211;state new -m statistic &#8211;mode random &#8211;probability 0.3 -j MARK &#8211;set-xmark 0&#215;4</p>
<p>for tc:</p>
<p>iptables -t mangle -A FORWARD -o eth0 -p tcp &#8211;sport 80 -j MARK &#8211;set-xmark 10<br />
iptables -t mangle -A FORWARD -o eth0 -p udp &#8211;sport 80 -j MARK &#8211;set-xmark 10<br />
iptables -t mangle -A PREROUTING -p tcp &#8211;dport 80 -j MARK &#8211;set-xmark 10</p>
<p>it&#8217;s that mean if packet goes to port 80 and table1 will marked 11? If I have a lot of port marking rule, do i have to write complex ip rule?</p>
<p>Do you have something more simple? or it really have to be complicated like that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Smith</title>
		<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/comment-page-1/#comment-14664</link>
		<dc:creator>Andy Smith</dc:creator>
		<pubDate>Fri, 04 Nov 2011 11:53:56 +0000</pubDate>
		<guid isPermaLink="false">http://andys.org.uk/bits/?p=10#comment-14664</guid>
		<description>I wasn&#039;t aware of that - thanks!

For anyone else: http://ipset.netfilter.org/

Andy.</description>
		<content:encoded><![CDATA[<p>I wasn&#8217;t aware of that &#8211; thanks!</p>
<p>For anyone else: <a href="http://ipset.netfilter.org/" rel="nofollow">http://ipset.netfilter.org/</a></p>
<p>Andy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Smith</title>
		<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/comment-page-1/#comment-14663</link>
		<dc:creator>Andy Smith</dc:creator>
		<pubDate>Fri, 04 Nov 2011 11:53:09 +0000</pubDate>
		<guid isPermaLink="false">http://andys.org.uk/bits/?p=10#comment-14663</guid>
		<description>Hi Carl,

Just had a quick look and --set-xmark is mentioned in the iptables manpage - it states that it zeroes out the bits given by the mask and XORs in the value given.

Andy.</description>
		<content:encoded><![CDATA[<p>Hi Carl,</p>
<p>Just had a quick look and &#8211;set-xmark is mentioned in the iptables manpage &#8211; it states that it zeroes out the bits given by the mask and XORs in the value given.</p>
<p>Andy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iptables MARK</title>
		<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/comment-page-1/#comment-14595</link>
		<dc:creator>Iptables MARK</dc:creator>
		<pubDate>Wed, 02 Nov 2011 15:44:37 +0000</pubDate>
		<guid isPermaLink="false">http://andys.org.uk/bits/?p=10#comment-14595</guid>
		<description>[...] to this: http://andys.org.uk/bits/2010/01/27/...fun-with-mark/  It says:  &quot;The MARK target lets us set a 32-bit value (or 0xFFFFFFFF) on a packet, which we [...]</description>
		<content:encoded><![CDATA[<p>[...] to this: <a href="http://andys.org.uk/bits/2010/01/27/" rel="nofollow">http://andys.org.uk/bits/2010/01/27/</a>&#8230;fun-with-mark/  It says:  &quot;The MARK target lets us set a 32-bit value (or 0xFFFFFFFF) on a packet, which we [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl</title>
		<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/comment-page-1/#comment-12760</link>
		<dc:creator>Carl</dc:creator>
		<pubDate>Fri, 26 Aug 2011 15:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://andys.org.uk/bits/?p=10#comment-12760</guid>
		<description>Hey,

I&#039;m learning/researching IPtables and a little confused.  I have found documentation on the option --set-mark, but nothing on --set-xmark as used in your example here.

I have seen examples like --set-mark 12/8 where the 1100 is masked by 1000 to result in 1000, but your example seems to be different.

As best I can figure out, if both examples are correct, --set-mark ANDs with the mask and --set-xmark XORs with the mask - is that what is happening here?

Thanks -</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>I&#8217;m learning/researching IPtables and a little confused.  I have found documentation on the option &#8211;set-mark, but nothing on &#8211;set-xmark as used in your example here.</p>
<p>I have seen examples like &#8211;set-mark 12/8 where the 1100 is masked by 1000 to result in 1000, but your example seems to be different.</p>
<p>As best I can figure out, if both examples are correct, &#8211;set-mark ANDs with the mask and &#8211;set-xmark XORs with the mask &#8211; is that what is happening here?</p>
<p>Thanks -</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sehcel</title>
		<link>http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/comment-page-1/#comment-2047</link>
		<dc:creator>Sehcel</dc:creator>
		<pubDate>Tue, 07 Sep 2010 13:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://andys.org.uk/bits/?p=10#comment-2047</guid>
		<description>Hi. Have you ever heard about ipsets?</description>
		<content:encoded><![CDATA[<p>Hi. Have you ever heard about ipsets?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

