<?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>Long-term Memory &#187; Ethernet</title>
	<atom:link href="http://blog.dest-unreach.be/tag/ethernet/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.dest-unreach.be</link>
	<description>A collection of note-to-self&#039;s</description>
	<lastBuildDate>Sun, 29 Jan 2012 16:05:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>World IPv6 day &#8211; lessons learned</title>
		<link>http://blog.dest-unreach.be/2011/06/14/world-ipv6-day-lessons-learned</link>
		<comments>http://blog.dest-unreach.be/2011/06/14/world-ipv6-day-lessons-learned#comments</comments>
		<pubDate>Tue, 14 Jun 2011 12:22:26 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[IPsec]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MacOSX]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2032</guid>
		<description><![CDATA[Together with most of the internet, we tested IPv6 on World IPv6 day last week. I won&#8217;t go into details on what IPv6 is and why it&#8217;s important. Although IPv6 has been tested intensely in isolated networks, this is the first time it was tested on such a large scale. Technically, the participants would just [...]]]></description>
			<content:encoded><![CDATA[<p>Together with <a href="http://googleblog.blogspot.com/2011/01/world-ipv6-day-firing-up-engines-on-new.html">most</a> <a href="http://www.facebook.com/notes/facebook-engineering/world-ipv6-day-solving-the-ip-address-chicken-and-egg-challenge/484445583919">of</a> <a href="http://www.yahoo.com/">the</a> <a href="http://www.akamai.com/ipv6">internet</a>, we tested IPv6 on <a href="http://www.worldipv6day.org/">World IPv6 day</a> last week. I won&#8217;t go into details on what <a href="http://en.wikipedia.org/wiki/IPv6">IPv6</a> is and why it&#8217;s <a href="http://en.wikipedia.org/wiki/IPv6#Motivation_and_origins">important</a>. Although IPv6 has been tested intensely in isolated networks, this is the first time it was tested on such a large scale. Technically, the participants would just add <a href="http://en.wikipedia.org/wiki/IPv6_address#IPv6_addresses_in_the_Domain_Name_System">AAAA-records</a> for their websites to <a href="http://en.wikipedia.org/wiki/Domain_Name_System">DNS</a>. This small change causes a huge effect. Since most browsers are configured to prefer IPv6 AAAA-records over IPv4 A-records, this causes all IPv6-connected users to suddenly connect over IPv6 instead of IPv4.</p>
<p>For the most part, this major changeover happened without as much of a hitch. In fact, if I hadn&#8217;t known it was World IPv6 day, I wouldn&#8217;t have noticed anything. But I&#8217;m not a normal web-user, so I did notice some issues.</p>
<h3><span id="more-2032"></span>Where it did went wrong</h3>
<p>After some troubleshooting, they all boiled down to a single cause of oversight. They were not bugs or issues with IPv6 per se, just some &#8220;expected behavior&#8221; that we didn&#8217;t anticipate: IPv4-only VPNs.</p>
<p>Most servers in our datacenter are not publicly accessible; none of them are manageable over the public internet. In order to connect to them, you need a <a href="http://en.wikipedia.org/wiki/Virtual_private_network">VPN</a> connection. This serves multiple purposes: it secures all communication between client and server (so even plain-text http can be used securely to manage servers), it limits the number of users with access and most importantly (in the IPv4 world) it allows us to use <a href="http://www.apps.ietf.org/rfc/rfc1918.html">RFC1918 addresses</a> internally and still get the routing to work out. Technically it behaves an an extra (virtual) network card with a (virtual) cable connected straight to the datacenter. Additionally, some routes are configured automatically on the client to make sure traffic to the servers is sent over this &#8220;cable&#8221;.</p>
<p>We use two kinds of VPN-connections, but none of them was IPv6 enabled (i.e. could carry IPv6 data through the tunnel). Since by default client software prefers IPv6 connections, this caused the IPv6-internet connection to be preferred above the IPv4-VPN connection. Obviously, the firewall at the datacenter didn&#8217;t agree and refused access.</p>
<p>The solution was fairly obvious to state (enable IPv6 through the tunnels) but difficult to implement. In fact, I have not been able to get it to work well enough to install it on someone else&#8217;s computer.</p>
<h3>The attempts</h3>
<h4>IPsec in transport mode</h4>
<p>The &#8220;natural&#8221; solution would be to secure the IPv6 packets with <a href="http://en.wikipedia.org/wiki/IPsec">IPsec</a>, preferably in <a href="http://en.wikipedia.org/wiki/IPsec#Transport_mode">transport mode</a>, between the client and the firewall. Since there are no <a href="http://en.wikipedia.org/wiki/Network_address_translation">NAT</a>-issues, <a href="http://en.wikipedia.org/wiki/IPsec#Tunnel_mode">tunnel mode</a> is not required.</p>
<p><img class="alignnone size-full wp-image-2034" title="Network diagram" src="http://blog.dest-unreach.be/wp-content/uploads/2011/06/server-fw-client.png" alt="network diagram:  server (2001:db8:0:1::1) — (2001:db8:0:1::2) Firewall (2001:db8:1:0::2) — (2001:db8:1:1::3) client" width="700" height="143" /></p>
<p>However, I was not able to get this to work, even in manual keying mode (i.e. without <a href="http://en.wikipedia.org/wiki/Internet_Security_Association_and_Key_Management_Protocol">ISAKMP</a>). I couldn&#8217;t get <em>setkey</em> to accept the <em>src-dst</em> parameter in the SPD:</p>
<blockquote>
<pre># setkey -c
spdadd 2001:db8:0:1::1 2001:db8:1:1::3 any -P fwd ipsec esp/transport/2001:db8:1:0:2-2001:db8:1:1::3/require;
<em>^D</em>
# setkey -DP
2001:db8:0:1::1[any] 2001:db8:1:1::3[any] any
 fwd prio def ipsec
 esp/transport//require
 created: Jun 14 12:13:53 2011  lastused:                    
 lifetime: 0(s) validtime: 0(s)
 spid=1641 seq=1 pid=10485
 refcnt=1</pre>
</blockquote>
<p>This seems to be a Linux issue (Ubuntu 10.04 LTS with kernel 2.6.32-28-generic and ipsec-tools 0.7.1), since this does work on MacOSX (10.6.7).</p>
<h4>IPsec tunnel mode</h4>
<p>Since I&#8217;m not entirely sure that what I tried above (transport mode) is even supposed to work, I also tried tunnel mode. This worked, but is a pain to configure. I only tried manual keying, but using racoon to do username/password authentication will be even harder to explain to users…</p>
<p>The Mac built-in VPN client only supports &#8220;<a href="/2011/03/03/iphone-compatible-ipsec-vpn-on-an-ubuntu-server-with-ldap-authentication">Cisco IPsec</a>&#8220;. This uses the mode configuration stage to communicate the set of &#8220;networks&#8221; to tunnel (i.e. the SPD). However, according to <a href="http://netbsd.gw.com/cgi-bin/man-cgi?racoon.conf+5+NetBSD-current">racoon.conf man-page</a>, I can only push IPv4 networks in the <em>split_network</em> directive.</p>
<h4>OpenVPN with tun driver</h4>
<p>According to the <a href="http://openvpn.net/index.php/open-source/faq/77-server/287-is-ipv6-support-plannedin-the-works.html">OpenVPN FAQ</a>, IPv6 is only supported if the underlying <a href="http://en.wikipedia.org/wiki/TUN/TAP">TUN-driver</a> supports it. The <a href="http://tuntaposx.sourceforge.net/">tuntaposx-page</a> does not mention IPv6 at all and hasn&#8217;t been updated for almost 2 years, so this seems unlikely to work.</p>
<p>Also, OpenVPN does not provide configuration directives to push IPv6 routes over from server to client.</p>
<h4>OpenVPN with tap driver</h4>
<p>Even when using the TAP-driver and <a href="http://en.wikipedia.org/wiki/IPv6#Stateless_address_autoconfiguration_.28SLAAC.29">router advertisements</a>, MacOSX does not seem to like enabling IPv6… Even after manually enabling it, MacOSX still doesn&#8217;t pick up its SLAAC address:</p>
<blockquote>
<pre># ifconfig tap0
tap0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
 ether 7e:95:80:00:90:0e
 inet 192.0.2.10 netmask 0xffffff00 broadcast 10.90.9.255
 open (pid 3847)

# ip6config start-v6 tap0
Starting IPv6 on tap0.

# sleep 60 # Wait for Router advertisement to show up

# ifconfig tap0
tap0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
 ether 7e:95:80:00:90:0e
 inet 192.0.2.10 netmask 0xffffff00 broadcast 10.90.9.255
 inet6 fe80::7c95:80ff:fe00:900e%tap0 prefixlen 64 tentative scopeid 0xa
 open (pid 3847)</pre>
</blockquote>
<p>And this still doesn&#8217;t allow me to push IPv6 routes to the clients upon connecting.</p>
<h3>The conclusion</h3>
<p>IPv6 is very stable and capable, but there are certain network-issues where there is still some work to do. If you happen to know a VPN-solution which supports IPv6 and works on Windows, linux and Mac, please let me know!</p>
<p>Edit: I <a href="/2011/06/27/configuring-openvpn-to-support-ipv6">worked out my own solution</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/06/14/world-ipv6-day-lessons-learned/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting a public IPv4 address with Belgacom&#8217;s BBox-2</title>
		<link>http://blog.dest-unreach.be/2011/04/12/getting-a-public-ipv4-address-with-belgacoms-bbox-2</link>
		<comments>http://blog.dest-unreach.be/2011/04/12/getting-a-public-ipv4-address-with-belgacoms-bbox-2#comments</comments>
		<pubDate>Tue, 12 Apr 2011 12:43:30 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[b-box2]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[Ethernet]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2006</guid>
		<description><![CDATA[The new installs of Belgacom&#8217;s DSL internet connection are actually fairly descend. They provide a &#8220;b-box 2&#8221; which provides 2 wired 10/100base-T ports and an 802.11g access point. It consumes 10.1W of power once booted (21VA with a cosφ of .47, measured with 241Vac), which costs around €22/year at the current prices. The box has a [...]]]></description>
			<content:encoded><![CDATA[<p>The new installs of <a href="http://www.belgacom.be/private/en/jsp/dynamic/productCategory.jsp?dcrName=internet_l&amp;rid=B_CBUPREHPATNAinternet_EN">Belgacom&#8217;s DSL internet connection</a> are actually fairly descend. They provide a &#8220;<a href="http://support.en.belgacom.be/app/answers/detail/a_id/14453">b-box 2</a>&#8221; which provides 2 wired 10/100base-T ports and an <a href="http://en.wikipedia.org/wiki/IEEE_802.11g-2003">802.11g</a> access point. It consumes 10.1W of power once booted (21VA with a cosφ of .47, measured with 241Vac), which costs around €22/year at the current prices. The box has a built-in router which performs the <a href="http://en.wikipedia.org/wiki/PPPoE">PPPoE</a> connection and does the <a href="http://en.wikipedia.org/wiki/NAT">NAT</a>. While this setup is perfectly fine for a regular setup, obviously I wanted something more…</p>
<p><span id="more-2006"></span>So I wanted my own router to establish the PPPoE connection and obtain a public IPv4 address. It seems that even here the default setup of the b-box2 is good: PPPoE passthrough is enabled by default. This technique allows you to establish a PPPoE connection from the &#8220;LAN&#8221;-side of the router, effectively bypassing it. There are <span class="removed_link" title="http://patrick.vande-walle.eu/belgacom-bbox-2-tricks/bbox-2-in-bridge/">numerous posts</span> how to reconfigure the b-box into <a href="http://tools.ietf.org/html/rfc1483">RFC 1483 bridge-mode</a>, but this is not required! So just plugging in my router and configuring PPPoE on it was enough!</p>
<p>There are some finishing touches however that can be learned from the bridge-posts:</p>
<ul>
<li>I disabled my PPPoE connection on the b-box itself. I will not be using it, so there is no need to waste a public IPv4 address here.<br />
In the webinterface (http://192.168.1.1/ by default) go to <em>Advanced Settings</em> – <em>Network Interfaces</em>. Open the <em>Wan PPPoE</em> and <em>Disable</em> it, confirm by clicking <em>OK</em>.</li>
<li>I also disabled the built-in WiFi access point, since I have my own 802.11n access point right next to it. This is even <a href="http://support.en.belgacom.be/app/answers/detail/a_id/14608/~/how-do-i-disable-the-wireless-function-of-my-b-box2%3F">officially documented</a>.<br />
<em>Advanced Settings</em> – <em>Wireless</em> and click <em>Deactivate</em>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/04/12/getting-a-public-ipv4-address-with-belgacoms-bbox-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting a WRT320N to dd-wrt</title>
		<link>http://blog.dest-unreach.be/2010/11/30/converting-a-wrt320n-to-dd-wrt</link>
		<comments>http://blog.dest-unreach.be/2010/11/30/converting-a-wrt320n-to-dd-wrt#comments</comments>
		<pubDate>Tue, 30 Nov 2010 17:53:50 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[WiFi]]></category>
		<category><![CDATA[WRT320N]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1891</guid>
		<description><![CDATA[I bought myself a new WiFi router. When in the shop, I specifically searched for a router that is supported by dd-wrt, and has (at least) 8MB of flash. I settled for the Linksys WRT320N: it has a dual band (switchable between 2.4GHz and 5GHz, not simultaneous) 802.11a/b/g/n radio, a 4 port GbE switch, and [...]]]></description>
			<content:encoded><![CDATA[<p>I bought myself a new WiFi router. When in the shop, I specifically searched for a router that is supported by <a href="http://www.dd-wrt.com/">dd-wrt</a>, and has (at least) 8MB of flash. I settled for the <a href="http://homesupport.cisco.com/en-us/wireless/lbc/WRT320N">Linksys WRT320N</a>: it has a dual band (switchable between 2.4GHz and 5GHz, not simultaneous) <a href="http://en.wikipedia.org/wiki/IEEE_802.11">802.11a/b/g/n</a> radio, a 4 port <a title="Gigabit Ethernet aka 1000base-T" href="http://en.wikipedia.org/wiki/Gigabit_Ethernet">GbE</a> switch, and a WAN port. It houses a Broadcom BC4717 processor running at 354MHz, 8MB of flash and 32MB of RAM.</p>
<p>The default Linksys firmware is actually not bad, but dd-wrt just offers a ton more features: Multiple <a href="http://en.wikipedia.org/wiki/Service_set_%28802.11_network%29">SSIDs</a>, <a href="http://en.wikipedia.org/wiki/IPv6">IPv6</a> support (including <a href="http://www.sixxs.net/">Sixxs</a> tunneling), <a href="http://en.wikipedia.org/wiki/Bandwidth_cap">WAN volume</a> monitoring, custom firewalling, <a href="http://en.wikipedia.org/wiki/Quality_of_service">traffic shaping</a>, … So I decided to void my warranty and put my router on steroids! Mandatory note: this may very well turn your router in to a very expensive brick.</p>
<p><span id="more-1891"></span></p>
<h3>The initial flash</h3>
<p>After reading through the <a href="https://secure.dd-wrt.com/phpBB2/">dd-wrt forum</a> (most notably <a href="http://www.dd-wrt.com/phpBB2/viewtopic.php?t=49362">these</a> <a href="http://secure.dd-wrt.com/phpBB2/viewtopic.php?t=63004">three</a> <a href="http://www.dd-wrt.com/phpBB2/viewtopic.php?t=52043">posts</a>) and the <a href="http://dd-wrt.com/wiki/index.php/Linksys_WRT320N_v1.0">wiki page</a>, I learned a few things:</p>
<ul>
<li><a href="http://secure.dd-wrt.com/phpBB2/viewtopic.php?p=384525#384525">Apparently</a>, this router has its reset button wired to the wrong <a href="http://en.wikipedia.org/wiki/General_Purpose_Input/Output">GPIO</a> pin. Therefor, the <a href="http://www.dd-wrt.com/wiki/index.php/Hard_reset_or_30/30/30">30/30/30 reset</a> DOES NOT WORK on this router! There is an alternative: use at least version 13493, power down the router, push and hold the WPS button (on top), power up the router, hold the WPS button for 10-12 more seconds, then release.</li>
<li>The latest recommended firmware is <a href="ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/08-12-10-r14929/broadcom_K26/">BrainSlayer&#8217;s 14929</a></li>
</ul>
<p>This is the procedure I followed, with success, starting from Linksys version v1.0.03 (build 010Jul 24, 2009):</p>
<ol>
<li>Download the <a href="ftp://ftp.dd-wrt.com/others/eko/V24-K26/svn13491-snow/Linksys/WRT320N/dd-wrt.v24-13493_NEWD-2_K2.6_mini_wrt320n.bin">tailored build for the WRT320N</a> (for the freaks, my binary MD5s to e1d7edd368bf5259c18a0874c5e761db).</li>
<li>Connect via wired ethernet to the router. That way, you can see the link going up/down.</li>
<li>In the Linksys firmware, upload this file.</li>
<li>Wait 5 very long minutes.</li>
<li>Configure yourself a static IP in the 192.168.0.0/24 network (I use 192.168.0.8)</li>
<li>Direct your browser to http://192.168.0.1/</li>
<li>Set a temporary password</li>
<li>Wait 1 minute</li>
<li>Reset the router: Power down, push &amp; hold WPS button, power up, keep holding for 11 seconds, release.</li>
<li>Close &amp; reopen your browser to flush all cached pages and credentials</li>
<li>Direct your browser to http://192.168.0.1/</li>
<li>Enjoy</li>
</ol>
<h3>The upgrade</h3>
<p>After the initial flash, you can upgrade to <a href="http://www.dd-wrt.com/wiki/index.php/What_is_DD-WRT%3F#V24_pre_sp2_K26">any regular version</a>, but keep in mind that this unit requires a 2.6 kernel. I choose the <a href="ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/08-12-10-r14929/broadcom_K26/dd-wrt.v24-14929_NEWD-2_K2.6_mini.bin">14929-mini</a> version (md5 af9ab2ff822ab69d26fa7308d47ad05a), not because it provided all I need (it doesn&#8217;t support IPv6 for example), but because it leaves the most free space for me to fiddle with.</p>
<p>To switch versions, I always follow this overly cautious procedure:</p>
<ol>
<li>Reset to defaults: power down, push &amp; hold WPS button, power up, keep holding for 11 seconds, release</li>
<li>Make sure your IP is in the correct range (192.168.0.0/24)</li>
<li>Set a temporary password</li>
<li>Upload the new firmware</li>
<li>Wait until the browser is again at the &#8220;Set password&#8221; page</li>
<li>Set temporary password</li>
<li>Reset to defaults again</li>
</ol>
<h3>The settings</h3>
<p>Most configuration is fairly straightforward with the GUI. But setting up a second, routed SSID needed a <a href="http://www.dd-wrt.com/wiki/index.php/Multiple_WLANs">little non-intuitive work</a>:</p>
<ul>
<li>Go to <em>Wireless</em> -&gt; <em>Basic Settings</em> and add a new <em>Virtual Interface</em>
<ul>
<li>Leave <em>Network Configuration</em> to <em>Bridged</em></li>
</ul>
</li>
<li>Go to <em>Setup</em> -&gt; <em>Networking</em>
<ul>
<li>Under <em>Create Bridge</em>, click <em>Add</em></li>
<li>Name the new bridge &#8220;br1&#8243; and disable <em>STP</em></li>
<li><em>Apply Settings</em></li>
<li>Now add the desired <em>IP</em> and <em>Subnet mask</em> for this brigde-port</li>
<li><em>Apply Settings</em> again</li>
<li>Click <em>Add</em> under <em>Assign to bridge</em></li>
<li>Now assign the wl0.1 interface to this newly created bridge br1</li>
</ul>
</li>
<li>Optionally <em>Add</em> a DHCP range for br1. In this case, you need to use DNSmasq as DHCP-server.</li>
</ul>
<p>Some guides tell you to configure it in Unbridged mode. Using Bridged mode gives the potential advantage that you can link a wired port to this IP-range easily.</p>
<p>Now you can easily firewall between the two WLANs by putting iptables-lines in the startup script.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2010/11/30/converting-a-wrt320n-to-dd-wrt/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get TBF back to work</title>
		<link>http://blog.dest-unreach.be/2010/03/10/how-to-get-tbf-back-to-work</link>
		<comments>http://blog.dest-unreach.be/2010/03/10/how-to-get-tbf-back-to-work#comments</comments>
		<pubDate>Wed, 10 Mar 2010 15:32:49 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1673</guid>
		<description><![CDATA[TBF or Token Bucket Filter is a tool from the linux kernel. It can be inserted as a &#8220;queueing discipline&#8221; for an Ethernet device. TBF is usually employed to limit the bandwidth. I tried to configure TBF on my Ubuntu 9.10 VMware box, but I got disappointing results: I only got around 100kbps, no matter [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lartc.org/howto/lartc.qdisc.classless.html#AEN691">TBF</a> or Token Bucket Filter is a tool from the linux kernel. It can be inserted as a &#8220;queueing discipline&#8221; for an Ethernet device. TBF is usually employed to limit the bandwidth.</p>
<p>I tried to configure TBF on my <a href="http://www.ubuntu.com/">Ubuntu</a> 9.10 <a href="http://www.vmware.com/">VMware</a> box, but I got disappointing results: I only got around 100kbps, no matter what I configured. I tried the same setup on a physical server, with the same results.</p>
<p><span id="more-1673"></span>After a full afternoon of experimenting and Googling, I was able to solve the issue by disabling offloading:</p>
<blockquote>
<pre># ethtool -k eth0
Offload parameters for eth0:
Cannot get device flags: Operation not supported
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: off
large-receive-offload: off

# ethtool -K eth0 sg off
# ethtool -K eth0 tso off
# ethtool -K eth0 gso off

# ethtool -k eth0
Offload parameters for eth0:
Cannot get device flags: Operation not supported
rx-checksumming: on
tx-checksumming: on
scatter-gather: off
tcp-segmentation-offload: off
udp-fragmentation-offload: off
generic-segmentation-offload: off
generic-receive-offload: off
large-receive-offload: off
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2010/03/10/how-to-get-tbf-back-to-work/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethernet &#8211; 100base-TX</title>
		<link>http://blog.dest-unreach.be/2009/06/11/ethernet-100base-tx</link>
		<comments>http://blog.dest-unreach.be/2009/06/11/ethernet-100base-tx#comments</comments>
		<pubDate>Thu, 11 Jun 2009 15:27:37 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[Ethernet]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1182</guid>
		<description><![CDATA[In 10BASE-T, the Manchester-encoding guaranteed that the line would stay &#8220;active&#8221; with transitions. 100BASE-TX uses a different approach. This is done by translating every nibble (4bit) block into a 5bit block (4B5B coding). These 5bit blocks are specially designed to have the necessary transitions build in, while only adding 20% overhead, compared to 100% in [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://blog.dest-unreach.be/2009/05/11/ethernet-10base-t">10BASE-T</a>, the Manchester-encoding guaranteed that the line would stay &#8220;active&#8221; with transitions. 100BASE-TX uses a different approach. This is done by translating every nibble (4bit) block into a 5bit block (<a href="http://en.wikipedia.org/wiki/4B5B">4B5B</a> coding). These 5bit blocks are specially designed to have the necessary transitions build in, while only adding 20% overhead, compared to 100% in the Manchester case. The official code-table can be found on page 144 of <a href="http://standards.ieee.org/getieee802/download/802.3-2005_section2.pdf">section 2 of the 802.3 standard</a>.</p>
<p>100BASE-TX <a href="http://www.ertyu.org/steven_nikkel/ethernetcables.html">requires</a> UTP cables of Cat5 or higher and utilizes 1 pair for Tx and 1 pair for Rx.</p>
<p><span id="more-1182"></span></p>
<p>Note that by using the 4B5B encoding, it is no longer necessary to define a bit-order. The transmit-bit-order is specified in the 4B5B code.</p>
<p>The start of a new frame is indicated by a preamble, just as in 10BASE-T. The preamble used is slightly different: 0xJK 55 55 55 55 55 D5. J and K are special symbols that have their own 5bit-symbol in the 4B5B coding. By using a separate symbol for control purposes, it becomes easier to recover from errors: a data symbol can never be misunderstood as a control symbol or the other way around.</p>
<p>Similarly, the end of a frame is indicated with 0xTR. T and R also have a special 5-bit symbol.</p>
<h3>Bits to scrambled bits</h3>
<p>To comply to the FCC regulations, the resulting bitstream is <a href="http://en.wikipedia.org/wiki/Scrambler">scrambled</a>. This operation gives the bit-stream more desirable characteristics, especially for cross-talk.</p>
<p>The scrambler used is a simple <a href="http://en.wikipedia.org/wiki/Linear_feedback_shift_register">linear feedback shift register</a>, 11bits long, with taps at the 11th and 9th bit (x<sup>11</sup>+x<sup>9</sup>+1). This outputs a 2047bit long pseudo-random bit sequence. For those interested, <a href="http://blog.dest-unreach.be/wp-content/uploads/2009/06/x11x91lsfroutput.txt">this textfile</a> shows the output.</p>
<p>The scrambling process itself is a traditional XOR operation: the 4B5B output is XORed bit-by-bit with the scrambler output.</p>
<p>Note that 100BASE-FX (over fiber) does not scramble its bits prior to transmission.</p>
<h3>Idle</h3>
<p>A 10BASE-T connection is silent between frames (apart from a LIT pulse); 100BASE-T in contrast sends IDLE-symbols. An Idle-symbol is a special 5-bit code (0b11111) different from all data-symbols. Note that this symbol is also scrambled.</p>
<p>A receiver can use this information to synchronize its descrambler: Since the output bit-stream are all 1s, the scrambled output contains the raw scramble-code, inverted. A receiver simply needs to copy and invert 11 bits into its LSFR-scrambler to synchronize.</p>
<h3>Bits to voltage</h3>
<p>The (scrambled) bit-stream is encoded with a <a href="http://en.wikipedia.org/wiki/MLT-3">MLT-3</a> encoding. This Multi-Level Transmit method uses 3 voltage levels to encode a bit, thereby reducing the required bandwidth.</p>
<p>It acquires this goal by cycling through 4 states: 0V, +1V, 0V, -1V. A 1 input-bit changes the output-state; a 0 input-bit results in no output change. The highest attainable frequency is thus 31.25MHz (remember that there are 125M symbol bits to transmit each second after 4B5B encoding).</p>
<h3>Additional things</h3>
<p><a href="http://www.iol.unh.edu/services/testing/fe/training/100BASE-TX%20PMD.pdf">This presentation </a>contains a nice overview of 100BASE-T.</p>
<p>Auto-negotiate allows a device to negotiate its speed and duplex settings with the other side. This is especially useful for multi-speed devices such as 10/100-base-T adapters. The previous spec for auto-negotiate was open for interpretation, leading to incompatible devices. Since 1998, the debatable section was removed from the IEEE 802.3 standard.</p>
<p><a href="http://en.wikipedia.org/wiki/Autonegotiation">Auto-negotiate</a> (ANeg) works by sending a series of short pulses, +1V high, 100ns long. This signal is chosen to stay compatible with 10BASE-T&#8217;s LIT (see my <a href="http://blog.dest-unreach.be/2009/05/11/ethernet-10base-t">post on 10BASE-T</a> for details). Instead of a single pulse, ANeg sends a series of pulses, called the Fast Link Pulse (FLP).</p>
<p>These pulses encode a 16-bit word, which indicates the capabilities of the transmitting device: 10 and/or 100 Mbps, half and/or full duplex. Note that it is normal to support all lower standards as well, however this is not a requirement: A device can advertise that it only supports 100BASE-TX &#8211; Full Duplex. This is <em>not</em> the same as setting 100-full-fixed. The former case works in 100-full, but communicates this information to the other side of the link; the latter works in 100-full, but does not inform the other side.</p>
<h3>Analysis</h3>
<p>The addition of a scrambler significantly increases the unpredictability. This scrambler is not synchronized to frame boundaries, not even to frame bytes. This makes it essentially impossible to construct a frame with a known wire-level signal. Still, I gave it a try:</p>
<ul>
<li>If the 4B5B encoded output of the frame matches the output of the scrambler, the resulting (scrambled) bitstream will be a stream of 0&#8242;s. MLT-3 encodes this as &#8220;no transition&#8221;. This will give the receiver-clock a hard time.<br />
After some searching, the bytes 0xB9 20 98 6F C3 result in 50 bits of symbols that match a part of the scrambling-code. Since the scrambler is not synchronized, you need a bit of luck to allign them.<br />
<a href="http://blog.dest-unreach.be/wp-content/uploads/2009/06/100base-t-low-transition-packet.bin">By filling a 1280B frame with this bit-pattern</a>, you have 256 chances to get them alligned: a little more than 12.5% chance.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2009/06/11/ethernet-100base-tx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethernet &#8211; 10base-T</title>
		<link>http://blog.dest-unreach.be/2009/05/11/ethernet-10base-t</link>
		<comments>http://blog.dest-unreach.be/2009/05/11/ethernet-10base-t#comments</comments>
		<pubDate>Mon, 11 May 2009 20:41:11 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[Ethernet]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1213</guid>
		<description><![CDATA[10base-T is the oldest Ethernet standard that runs over regular twisted pair cable. 10base-T requires UTP cables of Cat3 or higher, with a total length of maximum 100m. I wanted to figure out if you can generate &#8220;hard&#8221; packets for Ethernet; packets that somehow may expose problems in the hardware: signals with DC offsets, high [...]]]></description>
			<content:encoded><![CDATA[<p>10base-T is the oldest Ethernet standard that runs over regular twisted pair cable. 10base-T <a href="http://www.ertyu.org/steven_nikkel/ethernetcables.html">requires</a> UTP cables of <a href="http://en.wikipedia.org/wiki/Category_3_cable">Cat3</a> or higher, with a total length of maximum 100m. I wanted to figure out if you can generate &#8220;hard&#8221; packets for Ethernet; packets that somehow may expose problems in the hardware: signals with DC offsets, high frequency signals, low frequency signals, signals where the clock might be hard to track, &#8230; This post describes the journey of an ethernet frame from memory to wire.</p>
<p><span id="more-1213"></span></p>
<p>Note that, although I try to be fairly correct in this explanation, I&#8217;m still cutting some corners. The one and only true explanation is in the <a href="http://standards.ieee.org/getieee802/802.3.html">full IEEE802.3 document</a>.</p>
<h3>Bytes to bits</h3>
<p>The first step in this process is called <em>serialization</em>. Computers usually work with a bunch of bits at a time (typically 32 or 64). While it is possible to transmit a bunch of bits at the same time as well, 10base-T only transmits a single bit at a time. Thus, we need to convert a series of bytes into a series of bits. The 10base-T standard sends out the bits of each byte with the least-significant bit first: i.e. when transmitting 0&#215;33 over the wire, the first signal will be a 1.</p>
<p>To notify the other end of the line that a frame is about to be sent, every transmission starts with a <em>preamble</em>. In 10base-T this is a series of 64 bits, alternating 1 and 0, ending with two consecutive 1s: 0&#215;55 55 55 55 55 55 55 D5. This last bytes is also called the <em>start-of-frame indicator</em>.</p>
<p>After the preamble is sent, the receiver has synchronized its clock to the incomming bitstream and is ready to accept the data. This data always starts with destination MAC address and ends with <a href="http://blog.dest-unreach.be/2009/05/10/ethernet-the-fcs">the FCS.</a></p>
<h3>Bits to voltage</h3>
<p>This bitstream needs to be converted into voltages and currents. Also, the other side should be able to determine where one bit ends and where the next bits starts. 10base-T uses <a href="http://en.wikipedia.org/wiki/Manchester_code">Manchester</a> encoding to mark the beginning and ending of bits. The Manchester code converts every bit into a transition: a 1-bit is a transition from low to high; the 0-bit is a transition from high to low. This ensures that the clocking-circuit on the receiving end will be able to see every bit. Note that this encoding may introduce extra transitions: two consecutive 1-bits need an additional high-to-low transition in between them.</p>
<p>The transmitter will put a +1V differential signal onto the TD-lines to indicate a high-state; it will put a -1V differential signal onto the lines to indicate a low state. Note that this voltage will be lower on the receiving end due to cable losses.</p>
<p>When the last bit is transmitted, the transmitter will keep the lines in a high state for approximately 2-bit-times (depending on the value of the last bit). After that, the line goes into idle with 0V.</p>
<h3>Additional things</h3>
<p>To detect the presence of a link partner, 10base-T specifies a Link Integrity Test (LIT) signal; nowadays usually referred to as the Normal Link Pulse (NLP). This is a short, 100ns, positive signal generated every 16±8ms. This is the signal that brings up the green led on most Ethernet ports.</p>
<h3>Analysis</h3>
<p>The resulting signal is fairly stable in its characteristics:</p>
<ul>
<li>It is impossible to introduce a DC-offset since the Manchester encoding delivers an equal amount of 1s and 0s, independent of the data pattern</li>
<li>The highest frequency is achieved by sending a long run of 0&#215;00 or 0xFF. This results in a 10MHz signal on the line</li>
<li>The lowest frequency is achieved by sending a long run of alternating bits 0&#215;55. This results in a 5MHz signal on the line</li>
</ul>
<h3>Links</h3>
<p><a href="http://www.fpga4fun.com/10BASE-T1.html">http://www.fpga4fun.com/10BASE-T1.html</a> &#8211; FPGA project supporting 10BASE-T</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2009/05/11/ethernet-10base-t/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethernet &#8211; The FCS</title>
		<link>http://blog.dest-unreach.be/2009/05/10/ethernet-the-fcs</link>
		<comments>http://blog.dest-unreach.be/2009/05/10/ethernet-the-fcs#comments</comments>
		<pubDate>Sun, 10 May 2009 14:42:15 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[Ethernet]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1199</guid>
		<description><![CDATA[When looking for documentation on Ethernet, one can easily find that the frame includes a Frame Check Sequence. This is a bunch of bits that allow the receiver to verify the frame. If the frame somehow got corrupted on its way from sender to receiver, the FCS will not match the frame data and the [...]]]></description>
			<content:encoded><![CDATA[<p>When looking for documentation on <a href="http://en.wikipedia.org/wiki/Ethernet">Ethernet</a>, one can easily find that the frame includes a <a href="http://en.wikipedia.org/wiki/Frame_check_sequence">Frame Check Sequence</a>. This is a bunch of bits that allow the receiver to verify the frame. If the frame somehow got corrupted on its way from sender to receiver, the FCS will not match the frame data and the receiver will discard the corrupt frame. Exactly how this FCS is calculated is not that easy to find.</p>
<p><span id="more-1199"></span>The FCS used by Ethernet is a <a href="http://en.wikipedia.org/wiki/Cyclic_redundancy_check">Cyclic Redunancy Check</a>. The CRC algorithm has some very nice features for this application:</p>
<ul>
<li>It is very efficiently implemented in hardware using shift registers</li>
<li>If sutably designed, it be tuned to detect pretty much every random alteration in the data. Note that the alterations should be random. CRCs are very weak <a href="http://en.wikipedia.org/wiki/Cryptographic_hash_function">hash functions</a> in the cryptographic sense: it is very easy to generate a message with a predetermined CRC.</li>
</ul>
<h3>How CRCs work</h3>
<p>CRCs are much like the remainder of a division. The message is the numerator; the denominator is chosen but fixed number. Here is an example with message &#8220;123456789&#8243; and denominator 3:</p>
<blockquote><p>123456789 / 3 = 41152263 with remainder 0</p>
<p>Transmitted message: 123456789; 0</p></blockquote>
<p>If the message (or the checksum) somehow got corrupted, the receiver will notice:</p>
<blockquote><p>Received message:123446789; 0</p>
<p>123446789 / 3 = 41148926 with remainder 2</p></blockquote>
<p>A real CRC works similar, but has some differences:</p>
<ul>
<li>The message is a bunch of bits instead of a number</li>
<li>The result of the division is not needed, only the remainder is needed; this allows some optimizations in the algorithm</li>
<li>Computers love to work in binary, not decimal. In binary, you can define another type of division which has very similar properties, but is much faster to calculate</li>
</ul>
<p><a href="http://www.ross.net/crc/download/crc_v3.txt">This page</a> (<a href="http://blog.dest-unreach.be/wp-content/uploads/2009/05/crc.txt">local copy</a>) has a very thorough explanation on what a CRC exactly is, including the different algorithms to calculate them. You can try the different algorithms on <a href="http://www.zorc.breitbandkatze.de/crc.html">this page</a>.</p>
<h3>The Ethernet CRC</h3>
<p>Ethernet uses a 32 bit long CRC with polynomial 0x04C11DB7.</p>
<p>Depending on your implementation, you can either initialize the CRC-register to 0x46AF6449 and feed in the unmodified data; or you can initialize the register to 0&#215;00000000 and complement the first 32 bits of the data.</p>
<p>Since Ethernet transmits bytes with their least-significant bit first, the CRC uses this same, reflected, order: the first bits of byte 0&#215;33 are two 1s.</p>
<p>After all data-bits are passed through the CRC, push an additional 32 bits of zero&#8217;s. This assures that the last 32bits of the message are pushed completely through the register. Finally, complement the content of the register, i.e. XOR it with 0xFFFFFFFF.</p>
<p>The register now contains the CRC in order ff you want to transmit the CRC right away: high polynomial coeficient first. In case you want to add it to your data, remember to reflect each byte from its least-significant-bit-first order to the normal most-significant-bit first order.</p>
<p><a href="http://www.fpga4fun.com/10BASE-T2.html">This page</a> lists a full ethernet frame, including CRC (correctly reflected from the actual register).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2009/05/10/ethernet-the-fcs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethernet over IP (L2TP) on Cisco</title>
		<link>http://blog.dest-unreach.be/2009/05/05/ethernet-over-ip-l2tp-on-cisco</link>
		<comments>http://blog.dest-unreach.be/2009/05/05/ethernet-over-ip-l2tp-on-cisco#comments</comments>
		<pubDate>Tue, 05 May 2009 11:29:23 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[GRE]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1126</guid>
		<description><![CDATA[When doing some network engineering, it&#8217;s sometimes necessary to tunnel across IP-clouds. There are multiple reasons why one would use a tunnel: Security: You don&#8217;t want the carrier-network to see your data IP conflicts and/or routing issues: You want to carry private IP addresses (eg 10.0.0.0/8 in IPv4) across a public segment (eg the Internet) [...]]]></description>
			<content:encoded><![CDATA[<p>When doing some network engineering, it&#8217;s sometimes necessary to tunnel across IP-clouds. There are multiple reasons why one would use a tunnel:</p>
<ul>
<li>Security: You don&#8217;t want the carrier-network to see your data</li>
<li>IP conflicts and/or routing issues: You want to carry private IP addresses (eg 10.0.0.0/8 in IPv4) across a public segment (eg the Internet)</li>
<li>Workarounds: for whatever reason you whised that there was a connection between A and B</li>
</ul>
<p>Technically, a tunnel consists of taking a bunch of bytes and re-packaging it. The well knows <a href="http://en.wikipedia.org/wiki/Generic_Routing_Encapsulation">GRE</a>-tunnel takes IP packets and encapsulates them in another IP packet. The outer IP-layer is used to carry the packet across to the other endpoint, where the inner IP-layer reappears. Other tunnels operate at different layers. <a href="http://en.wikipedia.org/wiki/Secure_Shell">SSH</a> for example encapsulates <a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP segments</a> inside its TCP-connection; <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security">SSL</a>-based <a href="http://en.wikipedia.org/wiki/Vpn">VPN</a> encapsulate IP packets inside their <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security">TLS</a>-session.</p>
<p>Especially in the third case, workarounds, it would be very practical to be able to build a <a href="http://en.wikipedia.org/wiki/OSI_model#Layer_2:_Data_Link_Layer">layer 2</a> tunnel: transport raw ethernet frames, including <a href="http://en.wikipedia.org/wiki/IEEE_802.1Q">IEEE802.1q VLAN tags</a>. This is called the L2TP, Layer 2 tunneling protocol. The current version (3) is defined in <a href="http://tools.ietf.org/html/rfc3931">RFC 3931</a>.</p>
<p><span id="more-1126"></span>The Cisco website has a complete <a href="http://www.cisco.com/en/US/docs/ios/12_0s/feature/guide/l2tpv325.html">page</a> on L2TP, in all its variants (Frame relay over MPLS, HDLC over ATM, &#8230;). I only wanted to do ethernet over IP. This is the (partial) router configuration I used. Items in bold need to be adapted on the receiving end.</p>
<blockquote>
<pre>pseudowire-class PW_TEST
 encapsulation l2tpv3
 protocol none
 ip local interface FastEthernet0/1
!
interface FastEthernet0/0
 no ip address
 xconnect <strong>10.0.0.3</strong> 1 encapsulation l2tpv3 manual pw-class PW_TEST
  l2tp id <strong>2 3</strong>
!
interface FastEthernet0/1
 ip address 10.0.0.2 255.255.255.</pre>
</blockquote>
<p>This is all that is needed to tunnel every frame of Fa0/0 to 10.0.0.3 (and back). I pinged through this tunnel using both the native VLAN and a tagged vlan. Here is the resulting <a href="http://blog.dest-unreach.be/wp-content/uploads/2009/05/l2tp-capture.pcap">PCAP file</a>. Wireshark shows the tunneled ethernet frame:</p>
<p><img class="alignnone size-full wp-image-1132" title="l2tp-packet-decode" src="http://blog.dest-unreach.be/wp-content/uploads/2009/05/l2tp-packet-decode.png" alt="l2tp-packet-decode" width="815" height="222" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2009/05/05/ethernet-over-ip-l2tp-on-cisco/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

