<?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>froztbyte.getBlog() &#187; veth</title>
	<atom:link href="http://blog.froztbyte.net/tag/veth/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.froztbyte.net</link>
	<description>returns the contents of froztbyte.blog</description>
	<lastBuildDate>Mon, 13 Oct 2014 20:19:25 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0</generator>
	<item>
		<title>DHCP, LXC, phy-less (?) bridges, and checksums</title>
		<link>http://blog.froztbyte.net/2014/07/dhcp-lxc-phy-less-bridges-and-checksums/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dhcp-lxc-phy-less-bridges-and-checksums</link>
		<comments>http://blog.froztbyte.net/2014/07/dhcp-lxc-phy-less-bridges-and-checksums/#comments</comments>
		<pubDate>Sun, 20 Jul 2014 13:09:59 +0000</pubDate>
		<dc:creator><![CDATA[froztbyte]]></dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[brctl]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dhclient]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[lxc]]></category>
		<category><![CDATA[veth]]></category>

		<guid isPermaLink="false">http://blog.froztbyte.net/?p=489</guid>
		<description><![CDATA[tl;dr: if your lxc container on a bridged/veth network is randomly failing to get a dhcp address, you can probably fix it with `ethtool br0 x off  tx off` (br0 being the bridge interface). With my home DSL acting up &#8230;<p class="read-more"><a href="http://blog.froztbyte.net/2014/07/dhcp-lxc-phy-less-bridges-and-checksums/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>tl;dr: if your lxc container on a bridged/veth network is randomly failing to get a dhcp address, you can probably fix it with `ethtool br0 x off  tx off` (br0 being the bridge interface).</p>
<p>With my home DSL acting up quite a bit lately (&#8220;lately&#8221; == month and a half now. &#8220;acting up&#8221; == ground fault, and waiting for the telco to fix it..), I&#8217;ve been doing a lot of sandboxing work on my microserver at home. But because of its resource scarcity (2GB RAM, and I just haven&#8217;t bought more yet), I&#8217;ve been giving LXC a go[0] (where I&#8217;d normally just do libvirt&#8217;d kvm). It&#8217;s pretty easy to get started (check <a href="https://wiki.debian.org/LXC">this post</a> for pretty all much info you need), but I did deviate from the norm slightly.</p>
<p>I like my eth interfaces a server like this to be non-bridged, mostly because of a lack of ipmi (but also because brctl is a clown sometimes). So my setup for this at home looks like so:</p>
<pre>auto lxc0
iface lxc0 inet static
  address 192.168.2.1
  broadcast 192.168.2.255
  netmask 255.255.255.0
  bridge_stp on
  pre-up /sbin/brctl addbr lxc0
  post-down /sbin/brctl delbr lxc0</pre>
<p>I&#8217;ve also got dnsmasq listening on everything, although I hadn&#8217;t had it doing dhcp on that interface yet. Today I decided to change that, which is what led me to discovering this: (afaict) if you don&#8217;t have a phy interface attached to your bridge, checksum offloading behaviour on that bridge appears to be fucked-by-default.</p>
<p>How this manifested in my case was that lxc containers couldn&#8217;t succesfully DHCP (mostly silent failure), but doing a pcap or dhcpdump on the inside interface would show responses actually getting to your container. After some various derpery with dhclient&#8217;s options and applying enough patience, I finally managed to see a message: &#8216;5 bad udp checksums in 5 packets&#8217;. Some quick searching revealed people advising doing `iptables -A POSTROUTING -t mangle -p udp &#8211;dport bootpc -j CHECKSUM &#8211;checksum-fill` to fix this. Not just liking magic patches, I did check into why this is the case, and as mentioned earlier, it seems that this happens when you don&#8217;t have a phy attached to the bridge[0].</p>
<p>My network config for that interface now has a `post-up /sbin/ethtool tor0 rx off tx off` in it, and things seem dandy.</p>
<p>[0] &#8211; Mostly works pretty well. On debian wheezy you need some backported stuff for the various cgroups support. I think I got them from sid.<br />
[1] &#8211; &#8220;seems&#8221;, because a) I don&#8217;t feel like testing this by attach a real phy to the bridge now, and b) I haven&#8217;t run into this before when using various other things (KVM usually) that were running on phy-attached bridges so I can only guess this is what happens. Feel free to test and let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.froztbyte.net/2014/07/dhcp-lxc-phy-less-bridges-and-checksums/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
