<?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>Robert LaThanh &#187; Networking</title>
	<atom:link href="http://robertlathanh.com/category/networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertlathanh.com</link>
	<description></description>
	<lastBuildDate>Tue, 28 Feb 2012 17:52:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Two Subnetworks on One LAN, and Linux arp_filter</title>
		<link>http://robertlathanh.com/2009/08/two-subnetworks-on-one-lan-and-linux-arp_filter/</link>
		<comments>http://robertlathanh.com/2009/08/two-subnetworks-on-one-lan-and-linux-arp_filter/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 10:01:08 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://robertlathanh.com/blog/?p=27</guid>
		<description><![CDATA[It&#8217;s a rare situation in a small networking environment that having two subnetworks on one broadcast domain can be an issue. I would normally avoid such a scenario (and it&#8217;s usually easy to do so) but I recently got AT&#38;T&#8217;s &#8230; <a href="http://robertlathanh.com/2009/08/two-subnetworks-on-one-lan-and-linux-arp_filter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a rare situation in a small networking environment that having two subnetworks on one broadcast domain can be an issue. I would normally avoid such a scenario (and it&#8217;s usually easy to do so) but I recently got AT&amp;T&#8217;s U-verse, and the do-it-all device that it requires (a 2Wire 3800HGV-B &#8220;residential gateway&#8221;) has forced me to <a href="http://robertlathanh.com/2009/08/att-u-verse-a-network-geeks-perspective/">put both my private (NAT&#8217;d) subnetwork on the same broadcast domain as my public (DMZ&#8217;d) subnetwork</a>. While undesirable, this isn&#8217;t usually a problem, except that my dual-homed Linux box had trouble behaving with the 2Wire gateway.</p>
<h3>The Two-Interface Linux Box</h3>
<p><img src="http://robertlathanh.com/wp-content/uploads/2009/08/2_subnets_1_broadcast_domain.png" alt="Two subnets on One Broadcast Domain" title="Two subnets on One Broadcast Domain" width="684" height="518" class="alignnone size-full wp-image-79" /></p>
<p>As you can see in the diagram above, there&#8217;s a Linux box on this network that has two network interfaces, <span id="more-27"></span> one for the Internet (let&#8217;s say its MAC address is 00:aa:bb:cc:22 and its IP is &#8220;a.b.c.2&#8243;), and one for the intranet (00:10:00:00:22 and 10.0.0.2). Despite that both interfaces are on the same broadcast domain, there are still benefits to having two interfaces. Among them are: most network traffic is still segmented (private traffic hits only private switches), I only need to use gigabit hardware where it matters (private network segments), and I get two ways to log into the machine (if there&#8217;s a problem with one interface, I still have another).</p>
<p>Here&#8217;s the problem with the Linux box: it, by default, responds to <a href="http://en.wikipedia.org/wiki/Address_Resolution_Protocol">Address Resolution Protocol</a> (ARP) requests for an address of either of its interfaces on both interfaces, each with its own MAC address. That is, if someone else on the network asks &#8220;Who has (What is the MAC address of) IP address 10.0.0.2?&#8221; (an ARP request), and both interfaces receive this request, the Linux box&#8217;s interfaces will respond (ARP responses):</p>
<ul>
<li>from the &#8220;private&#8221; interface: &#8220;IP 10.0.0.2 has MAC address 00:10:00:00:22&#8243; (this is correct)</li>
<li>from the &#8220;public&#8221; interface: &#8220;IP 10.0.0.2 has MAC address 00:aa:bb:cc:22&#8243; (this is <em>not</em> correct)</li>
</ul>
<p>In most cases, this is OK. The other computers on the network that want to send a packet to 10.0.0.2 will end up sending it to either interface (perhaps the wrong one), but this is okay because Linux doesn&#8217;t care that it got a packet for 10.0.0.2 on its a.b.c.2 interface – the packet still gets delivered to the software on the machine that expected it.</p>
<h3>This doesn&#8217;t Fly with the 3800HGV-B</h3>
<p>So here&#8217;s where Linux&#8217;s behavior created a problem. The Residential Gateway&#8217;s routing software keeps track of which MAC address owns an IP so that it knows where to send a packet destined for that IP.<br />
There&#8217;s a subtle quirk in this gateway&#8217;s routing software that distinguishes it from how the other systems on the network behaves. Its table maps a MAC addresses to an IP, and both MAC addresses and IPs in the table must be unique. Linux, Windows, and most other devices, on the other hand map IPs to MAC addresses, where only IPs must be unique (thus allowing multiple IPs to point to one MAC address).</p>
<p>Let’s take an example where an ARP request is first made for &#8216;a.b.c.2&#8242;, then another is made for &#8217;10.0.0.2&#8242;. Linux will produce four responses (two for each request out of each interface). The four responses could arrive in this order:</p>
<ul>
<li>a.b.c.2 &rarr; 00:10:00:00:22 (incorrect)</li>
<li>a.b.c.2 &rarr; 00:aa:bb:cc:22 (correct)</li>
<li>10.0.0.2 &rarr; 00:10:00:00:22 (correct)</li>
<li>10.0.0.2 &rarr; 00:aa:bb:cc:22 (incorrect)</li>
</ul>
<p>After all four responses, the Windows machine’s Internet-to-MAC address table would look like this:</p>
<ul>
<li>a.b.c.2 &rarr; 00:aa:bb:cc:22 (the latest response about a.b.c.2 &#8212; correct)</li>
<li>10.0.0.2 &rarr; 00:aa:bb:cc:22 (the latest response about 10.0.0.2 &#8212; incorrect)</li>
</ul>
<p>This may go unnoticed because the Windows machine will send a packet bound for either a.b.c.2 or 10.0.0.2 to 00:aa:bb:cc:22, and Linux will accept it on either interface and send it to the listening software &#8212; although &#8220;incorrectly&#8221;, it works just fine.</p>
<p>Between the 3rd and 4th response, the Residential Gateway&#8217;s table would be:</p>
<ul>
<li>a.b.c.2 &rarr; 00:aa:bb:cc:22 (the latest response about a.b.c.2 &#8212; correct)</li>
<li>10.0.0.2 &rarr; 00:10:00:00:22 (the latest response about 10.0.0.2 &#8212; correct)</li>
</ul>
<p>which is accurate until a moment later when the fourth ARP response is received that says &#8220;IP 10.0.0.2 has MAC address 00:aa:bb:cc:22,&#8221; at which point the table looks like:</p>
<ul>
<li>10.0.0.2 &rarr; 00:aa:bb:cc:22 (the latest response about 10.0.02 &#8212; incorrect)</li>
</ul>
<p>The key here is that now there&#8217;s only one entry (which happens to be wrong) because MAC addresses must be unique in the Residential Gateway. Now the routing software in the gateway doesn&#8217;t think that there&#8217;s a device on the network that has the IP address ‘a.b.c.2’ and any packets destined to it are discarded. This causes a very strange problem. If the table happened to contain ‘a.b.c.2’, I would be able to establish a connection with that machine from the Internet. However, when an ARP response hit the wire that eliminated ‘a.b.c.2’ from the table (usually within 5-60 seconds), I would lose my connection because the gateway would simply stop routing my packets to that address.</p>
<h3>ARP Flux</h3>
<p>The gateway is a victim of what the &#8220;<a href="http://linux-ip.net/html/ether-arp.html#ether-arp-flux">Guide to IP Layer Network Administration with Linux</a>&#8221; calls ARP flux, &#8220;confusion, or worse yet, non-deterministic population of the ARP cache &#8230; can lead to the possibly puzzling effect that an IP migrates non-deterministically through multiple link layer addresses.&#8221;</p>
<h3>Solution: arp_filter</h3>
<p>The solution in this situation is to <a href="http://www.linuxinsight.com/proc_sys_net_ipv4_conf_eth0_arp_filter.html">enable arp_filter</a> on the Linux box, a sysctl that prevents interfaces from responding to ARP requests that aren&#8217;t for an IP address assigned to that interface.<br />
This can be done easily-but-temporarily (until the next reboot) by running the command:</p>
<blockquote><p><code><br />
sysctl net.ipv4.conf.eth[num].arp_filter=1<br />
</code></p></blockquote>
<p>for each interface, where <code>[num]</code> is the number of the interface.</p>
<p>For this to have a permanent effect, edit <code>/etc/sysctl.conf</code>, adding a line for each interface: &#8220;<code>net.ipv4.conf.eth[num].arp_filter = 1</code>&#8220;, where <code>[num]</code> is the number of the interface. For example, these lines are in my <code>/etc/sysctl.conf</code>:</p>
<blockquote><p><code><br />
# interfaces shouldn't respond to ARPs that aren't theirs</p>
<p>net.ipv4.conf.eth0.arp_filter = 1</p>
<p>net.ipv4.conf.eth1.arp_filter = 1</p>
<p></code></p></blockquote>
<h3>An annoying problem caused by a lame default</h3>
<p>Linux&#8230; what are you doing responding to ARPs on the wrong interface with the wrong MAC address? The configuration paradigm communicated by the configuration utilities (whether via ifconfig or system-config-network) is: &#8220;10.0.0.2 is assigned to eth0 and a.b.c.1 is assigned to eth1.&#8221; None of the information gives me any reason to believe that not only will eth0 take packets intended for eth1’s address, but that it will actively tell others that it will do so (ARP responses). This behavior should not be the default &#8212; Windows and MacOSX/BSD, who don&#8217;t do this, seem to agree.</p>
]]></content:encoded>
			<wfw:commentRss>http://robertlathanh.com/2009/08/two-subnetworks-on-one-lan-and-linux-arp_filter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AT&amp;T U-verse &#8212; A Network Geek&#8217;s Perspective</title>
		<link>http://robertlathanh.com/2009/08/att-u-verse-a-network-geeks-perspective/</link>
		<comments>http://robertlathanh.com/2009/08/att-u-verse-a-network-geeks-perspective/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 19:06:53 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://robertlathanh.com/blog/?p=18</guid>
		<description><![CDATA[I just got AT&#38;T U-verse, which delivers Internet, TV (IPTV), and phone (VOIP) service to the home; all this over one pair of copper from the VRAD. My upgrades to the service include HD TV, DVR, and a static IP &#8230; <a href="http://robertlathanh.com/2009/08/att-u-verse-a-network-geeks-perspective/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just got AT&amp;T U-verse, which delivers Internet, TV (IPTV), and phone (VOIP) service to the home; all this over one pair of copper from the VRAD. My upgrades to the service include HD TV, DVR, and a static IP block for my personal servers. This article sheds some light on some peculiarities about how the 2Wire 3800HGV-B (“Residential Gateway”) they provided behaves when a public/static IP block is involved.</p>
<div style="background-color: #cccccc; border: thin solid#666666; color: #333333; padding: 8px; margin: 16px">
If instead you&#8217;re looking to learn more about &#8230;</p>
<ul>
<li>&#8230; the U-verse offering, visit the <a href="http://www.att.com/u-verse">AT&#038;T U-verse website</a></li>
<li>&#8230; the technology behind U-verse, see the <a href="http://en.wikipedia.org/wiki/AT%26T_U-verse">AT&#038;T U-verse article on Wikipedia</a></li>
<li>&#8230; the 2Wire 3800HGV-B is general (what it does, how it works, and the different ways it can be set up) and U-verse wiring options, see my other article: <a href="http://robertlathanh.com/2011/01/att-u-verse-for-the-curious-consumer-the-residential-gateway-and-wiring-options/">AT&#038;T U-verse for the Curious Consumer – The Residential Gateway and Wiring Options</a></li>
<p><a href="http://robertlathanh.com/2011/01/att-u-verse-for-the-curious-consumer-the-residential-gateway-and-wiring-options/"><img src="http://robertlathanh.com/wp-content/uploads/2009/08/telecom_closet_with_att_u-verse-150x150.jpg" alt="" title="Telecom Closet with AT&amp;T U-Verse" width="150" height="150" class="aligncenter size-thumbnail wp-image-81" /></a>
</ul>
</div>
<p>What made this setup interesting to me (from a networking perspective) was that it forced me to compromise on keeping my private network separate from my public network&#8230;<span id="more-18"></span></p>
<h3>Typical Network</h3>
<p>This first diagram, below, represents how I would typically set up small network with public IPs.<br />
<img class="alignnone size-full wp-image-25" title="Two subnets on two separate broadcast domains" src="http://robertlathanh.com/wp-content/uploads/2009/09/2_subnets_2_segments.png" alt="Two subnets on two separate broadcast domains" width="674" height="328" /><br />
Just as most people do, I have my workstations behind a typical residential gateway (viz., a “wireless router”).  What’s just a bit atypical is that I have two servers that each have two network interfaces and participate in both the Internet and intranet networks.</p>
<p>Because all devices that participate in both networks are smart enough (<a href="http://en.wikipedia.org/wiki/OSI_model">operate on the third network layer or above</a>) a packet never makes it from one network to the other unless it needs to, which is pretty much only when a workstation is communicating with the Internet (through the residential gateway).</p>
<p>Thus, the Internet subnetwork and intranet subnetwork are on different <a href="http://en.wikipedia.org/wiki/Broadcast_domain">broadcast domains</a>. Anything broadcast onto the intranet (whether by a workstation or server), such as an ARP request, will only be heard by the other devices on the intranet.</p>
<h3>Two Networks on One LAN</h3>
<p>Things got a bit more complicated when I got AT&amp;T’s U-verse. The key difference that this Residential Gateway introduced is that it joined my two networks into one broadcast domain. This is because the Gateway’s internal network interface has an intranet IP address, 10.0.0.1/24, so that it can send IPTV to the private network TV set-top-boxes that are hooked up via Ethernet, and the Gateway is routing the public IP addresses (“a.b.c.x”) for the servers, so the Gateway’s  internal network interface also has an IP address of a.b.c.7.</p>
<div id="attachment_31" class="wp-caption alignnone" style="width: 535px"><img class="size-full wp-image-31" title="Both the public and intranet networks are connected to the 2Wire 3800HGV-B's built-in switch" src="http://robertlathanh.com/wp-content/uploads/2009/09/2Wire_3800HGV-B_back.jpg" alt="back of the 2Wire 3800HGV-B" width="525" height="700" /><p class="wp-caption-text">Both the public and intranet networks are connected to the 2Wire 3800HGV-B's built-in switch</p></div>
<div id="attachment_79" class="wp-caption alignnone" style="width: 528px"><img src="http://robertlathanh.com/wp-content/uploads/2009/08/2_subnets_1_broadcast_domain.png" alt="Two subnets on One Broadcast Domain network diagram" title="Topology with the 2Wire 3800HGV-B with public/static IPs" width="684" height="518" class="alignnone size-full wp-image-79" /><p class="wp-caption-text">Topology with the 2Wire 3800HGV-B with public/static IPs</p></div>
<p>So, my 3800HGV-B Gateway is participating on both networks on one interface (technically, on two ports of its built-in layer-2 switch). Now, all devices, whether public or private, are able to communicate with each other. They usually ignore each other, but they will all hear broadcasts from any device. For example, if Workstation1 sends out a broadcast packet (such as an ARP request), it will reach the Linux server on both its Internet and intranet interfaces (because switches, including the Gateway’s built-in switch, will propagate it out to all attached networks. This is not usually a problem, except that <a href="http://robertlathanh.com/2009/08/two-subnetworks-on-one-lan-and-linux-arp_filter/">the Linux server was confusing the Gateway</a>.</p>
<h3>Network summary for the overly curious</h3>
<p>(actual IPs partially masked)</p>
<ul>
<li>AT&#038;T U-verse&#8217;s local router (my Gateway&#8217;s gateway) is: 99.27.aa.bb</li>
<li>My Gateway&#8217;s external interface IP is: 99.27.aa.cc (intranet devices NAT&#8217;d traffic appears to come from this IP)</li>
<li>My Gateway&#8217;s internal interface IP for intranet: 10.0.0.1 (workstation and other devices have this as their default gateway) </li>
<li>My Gateway&#8217;s internal interface IP for Internet servers: 99.65.dd.ee (servers with public/static IPs have this as their default gateway)</li>
<li>Server IPs look like: 99.65.dd.ff/29</li>
<li>workstation and other device IPs look like 10.0.0.gg/24</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://robertlathanh.com/2009/08/att-u-verse-a-network-geeks-perspective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

