<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mercuric.net &#187; victories</title>
	<atom:link href="http://www.mercuric.net/tag/victories/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mercuric.net</link>
	<description>At least 80% post-consumer content</description>
	<lastBuildDate>Tue, 12 Nov 2024 18:34:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Pressing things, including but not limited to words</title>
		<link>http://www.mercuric.net/2009/07/pressing-words-pressing-buttons/</link>
		<comments>http://www.mercuric.net/2009/07/pressing-words-pressing-buttons/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 11:40:26 +0000</pubDate>
		<dc:creator>Zebranky</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[neteng]]></category>
		<category><![CDATA[shorewall]]></category>
		<category><![CDATA[victories]]></category>

		<guid isPermaLink="false">http://www.mercuric.net/?p=3</guid>
		<description><![CDATA[I will try my hand at this blogging thing, so that perhaps my escapades can prove instructive to others. As to the most recent escapade, I recently found myself fighting with Shorewall.  A hastily hand-drawn, but informative, diagram of the network: odin acts as bridge, router, and single point of catastrophic failure.  artemis and cobblebox [...]]]></description>
			<content:encoded><![CDATA[<p>I will try my hand at this blogging thing, so that perhaps my escapades can prove instructive to others.</p>
<p>As to the most recent escapade, I recently found myself fighting with <a href="http://www.shorewall.net/">Shorewall</a>.  A hastily hand-drawn, but informative, diagram of the network:</p>
<div id="attachment_9" class="wp-caption alignnone" style="width: 472px"><img class="size-full wp-image-9" title="184highnet" src="http://www.mercuric.net/wp-content/uploads/2009/07/zebnet.png" alt="184highnet" width="462" height="325" /><p class="wp-caption-text">184highnet</p></div>
<p>odin acts as bridge, router, and single point of catastrophic failure.  artemis and cobblebox have enough services running that I want them to have public IPs, so they are bridged to the cable modem segment.  Everything is also connected to the LAN, which odin NATs from its bridge interface to eth2.  odin provides DNS, DHCP, etc. to the LAN.  So far, so good (except that dhcpd still won&#8217;t update bind properly&#8230;).</p>
<p>Yes, this is far more complex than it strictly needs to be, but it means I can make pretty graphs and figure out how close I am to making Comcast angry.</p>
<div id="attachment_10" class="wp-caption alignnone" style="width: 510px"><img class="size-full wp-image-10" title="mrtg eth0-week" src="http://www.mercuric.net/wp-content/uploads/2009/07/localhost_eth0-week.png" alt="mrtg eth0-week" width="500" height="135" /><p class="wp-caption-text">mrtg eth0-week</p></div>
<p>I soon found that I need to be able to forward ports on odin&#8217;s external interface (br0) to machines on the LAN.  It&#8217;s easy with a two-interface machine: just say, for example, &#8220;any traffic in zone net with a destination port of 5121/udp goes to 192.168.10.2:5121&#8243;, or, in shorewall-speak (/etc/shorewall/rules):</p>
<pre>#ACTION        SOURCE  DEST                    PROTO   DESTPORT        SRCPORT ORIGINAL_DEST
DNAT           net     loc:192.168.10.2:5121   udp     5121</pre>
<p>Let&#8217;s give it a shot on the three-interface setup.  Oops, still can&#8217;t connect from dmz (the zone with artemis and cobblebox).  How about adding this, then?</p>
<pre>DNAT           dmz     loc:192.168.10.2:5121   udp     5121</pre>
<p>Great, now it works!  Except&#8230; oh shit, I can&#8217;t connect to <em>anything else</em> on port 5121 now.  WTF?</p>
<p>Turns out that those rules apply to <em>any</em> traffic in those zones with a destport of 5121, meaning all my outgoing traffic on 5121 was getting rewritten to go to 192.168.10.2.  To stop this, we use the original destination in the rules.  Because the original destination (read: the address of br0) is obtained via DHCP, though, it&#8217;s bad mojo to specify it in the file.  The solution to <em>that</em> is to modify /etc/shorewall/params.  The net result is:</p>
<pre>/etc/shorewall/rules:
#ACTION         SOURCE  DEST                    PROTO   DESTPORT        SRCPORT ORIGINAL_DEST
DNAT            net     loc:192.168.10.2        udp     5121            -       $BR0_IP
DNAT            dmz     loc:192.168.10.2        udp     5121            -       $BR0_IP
/etc/shorewall/params:
BR0_IP=$(find_first_interface_address br0)</pre>
<p>Yes, all this information was clearly in the FAQ if I had bothered to read, but my attention span is oh hey, I didn&#8217;t know WordPress could do that</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercuric.net/2009/07/pressing-words-pressing-buttons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
