<?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>Felipe Alfaro Solana &#187; Networking</title>
	<atom:link href="http://www.felipe-alfaro.org/blog/category/networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.felipe-alfaro.org/blog</link>
	<description>A little bit of technology, security and networking with Linux, FreeBSD and Mac OS X, plus some personal opinions.</description>
	<lastBuildDate>Sun, 23 Oct 2011 16:46:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Anonymous FTP server under Solaris</title>
		<link>http://www.felipe-alfaro.org/blog/2008/08/11/anonymous-ftp-server-under-solaris/</link>
		<comments>http://www.felipe-alfaro.org/blog/2008/08/11/anonymous-ftp-server-under-solaris/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 21:58:29 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=241</guid>
		<description><![CDATA[Setting up an anonymous FTP server under Solaris, when using the built-in in.ftpd daemon, is a little bit different than setting it up under GNU/Linux using WUftpd. First, let&#8217;s create the ftp user and ftp group. Then, let&#8217;s create the home directory for the ftp user: mkdir -p /export/home/ftp groupadd -g 99 ftp useradd -u [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up an anonymous FTP server under Solaris, when using the built-in <code>in.ftpd</code> daemon, is a little bit different than setting it up under GNU/Linux using WUftpd.</p>
<p>First, let&#8217;s create the <code>ftp</code> user and <code>ftp</code> group. Then, let&#8217;s create the home directory for the <code>ftp</code> user:</p>
<div>
<pre>
mkdir -p /export/home/ftp
groupadd -g 99 ftp
useradd -u 99 -g 99 -s /bin/false -d /export/home/ftp
chgrp ftp:ftp /export/home/ftp
</pre>
</div>
<p>If you want anonymous users to upload files under <code>/pub</code>, add the following line to <code>/etc/ftpd/ftpaccess</code>:</p>
<div>
<pre>
upload          class=anonusers /export/home/ftp /pub yes ftp ftp 0600 nodirs
</pre>
</div>
<p>Next, copy the minimal set of dynamic libraries and binaries to make possible browse and list files for anonymous users:</p>
<div>
<pre>
mkdir -p ~ftp/bin
mkdir -p ~ftp/usr/bin
ln -s ../bin ~ftp/usr/bin
cp /usr/lib/{ld,libc,libdl,libgen}.so.1 ~ftp/usr/lib
cp /bin/ls ~ftp/bin
</pre>
</div>
<p>To enable the FTP server, uncomment the following line in <code>/etc/inetd.conf</code>:</p>
<div>
<pre>
ftp     stream  tcp6    nowait  root    /usr/sbin/in.ftpd       in.ftpd -a
</pre>
</div>
<p>and notify the <code>inetd</code> daemon of the change by sending the <code>HUP</code> signal to it:</p>
<div>
<pre>
pkill -1 inetd
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2008/08/11/anonymous-ftp-server-under-solaris/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mac OS X, Bluetooth and Motorola UMTS phones</title>
		<link>http://www.felipe-alfaro.org/blog/2007/02/14/mac-os-x-bluetooth-and-motorola-umts-phones/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/02/14/mac-os-x-bluetooth-and-motorola-umts-phones/#comments</comments>
		<pubDate>Tue, 13 Feb 2007 22:19:21 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/02/14/mac-os-x-bluetooth-and-motorola-umts-phones/</guid>
		<description><![CDATA[NOTE: This post is a based on Mac OS X, Bluetooth and Nokia UMTS phones that I wrote some days ago, but adapted to Motorola 3G phones. This brief post explains how to pair Mac OS X with a Motorola 3G/UMTS phone in order to access the Internet via a data packet connection. In my [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: This post is a based on <a href="http://felipe-alfaro.org/blog/2007/02/11/mac-os-x-bluetooth-and-nokia-umts-phones/">Mac OS X, Bluetooth and Nokia UMTS phones</a> that I wrote some days ago, but adapted to Motorola 3G phones.</strong></p>
<p>This brief post explains how to pair Mac OS X with a Motorola 3G/UMTS phone in order to access the Internet via a data packet connection. In my case, I&#8217;m using a Motorola RAZR V3xx phone but any other Motorola 3G phone should work.</p>
<p>Before you start, please make sure that your phone is properly configured and that you can browse the Web via a GPRS/UMTS connection. Also, make sure that Bluetooth support in your phone is configured and activated and, for phones that have temporary visibility (are only visible via Bluetooth for a limited period of time), make sure to enable Bluetooth just before the pairing process.</p>
<h3>Initial configuration</h3>
<p>First, download the Motorola 3G Modem Scripts for Mac OS X from <a href="http://www.taniwha.org.uk/">Ross Barkman&#8217;s Home Page</a> (the official site) or from <a href="/blog/wp-content/Mac-OSX-RAZR-V3xx/Motorola-3G.zip">here</a>.</p>
<p>Second, uncompress the file and copy the files named &#8220;<code>Motorola 3G CID1</code>&#8221; and &#8220;<code>Motorola 3G CID2</code>&#8221; into &#8220;<code>/Library/Modem Scripts</code>&#8220;.</p>
<p>Next, pair your Mac OS X computer with the Motorola phone by clicking on the Bluetooth icon in the menu bar and then <strong>Set up Bluetooth Device&#8230;</strong>. When pairing make you sure you choose <strong>Use a direct, higher speed connection to reach your Internet Service Provider *GPRS, 1xRTT)</strong>.</p>
<p>Enter <code>guest</code> as the <strong>Username</strong>, <code>guest</code> as the <strong>Password</strong>, the <strong>APN (CID String or Telephone number)</strong> and make sure <code>Motorola 3G CID1</code> is selected as the <strong>Modem Script</strong>. For example:</p>
<p><img src="/blog/wp-content/Mac-OSX-RAZR-V3xx/Mac-OSX-Bluetooth-Setup-Assistant.png"/></p>
<p>For a detailed list of possible combinations of username, password and APN CID for a lot of providers around the world visit <a href="http://www.taniwha.org.uk/gprs.html">Ross Barkman&#8217;s GPRS Info Page</a>.</p>
<h3>Dialing out</h3>
<p>To dial out, open <strong>Internet Connect</strong>, browse to the <strong>Bluetooth</strong> tab and make sure the right entry is selected from the drop down menu. Then click <strong>Connect</strong>. Mac OS X will authenticate to the remote PPP server and a new dynamic PPP subinterface should be configured:</p>
<div>
<pre>
$ ifconfig ppp0
ppp0: flags=8051<up ,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
        inet 10.142.15.9 --> 10.6.6.6 netmask 0xffffff00
</up></pre>
</div>
<p>In my case, browsing speed is very good (around 384Kbps), but it might vary according to placement, coverage, whether you are moving and so on (by the way, UMTS network planning, deployment and coverage is something not trivial).</p>
<h3>Troubleshooting</h3>
<p>Make sure all the information for the connection have been entered correctly, specially the APN/Telephone number. If it doesn&#8217;t work, try using <code>Motorola 3G CID2</code> as the <strong>Modem Script instead.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/02/14/mac-os-x-bluetooth-and-motorola-umts-phones/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mac OS X, Bluetooth and Nokia UMTS phones</title>
		<link>http://www.felipe-alfaro.org/blog/2007/02/11/mac-os-x-bluetooth-and-nokia-umts-phones/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/02/11/mac-os-x-bluetooth-and-nokia-umts-phones/#comments</comments>
		<pubDate>Sat, 10 Feb 2007 22:53:10 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/02/11/mac-os-x-bluetooth-and-nokia-umts-phones/</guid>
		<description><![CDATA[This brief post explains how to pair Mac OS X with a Nokia 3G/UMTS phone in order to access the Internet via a data packet connection. In my case, I&#8217;m using a Nokia 6234 phone but any other Nokia phone should work. Before you start, please make sure that your phone is properly configured and [...]]]></description>
			<content:encoded><![CDATA[<p>This brief post explains how to pair Mac OS X with a Nokia 3G/UMTS phone in order to access the Internet via a data packet connection. In my case, I&#8217;m using a Nokia 6234 phone but any other Nokia phone should work.</p>
<p>Before you start, please make sure that your phone is properly configured and that you can browse the Web via a GPRS/UMTS connection. Also, make sure that Bluetooth support in your phone is configured and activated and, for phones that have temporary visibility (are only visible via Bluetooth for a limited period of time), make sure to enable Bluetooth just before the pairing process.</p>
<h3>Initial configuration</h3>
<p>First, download the Nokia 3G Modem Scripts for Mac OS X from <a href="http://www.taniwha.org.uk/">Ross Barkman&#8217;s Home Page</a> (the official site) or from <a href="/blog/wp-content/Mac-OSX-Nokia-3G/Nokia-3G.zip">here</a>.</p>
<p>Second, uncompress the file and copy the files named &#8220;<code>Nokia 3G CID1</code>&#8221; and &#8220;<code>Nokia 3G CID2</code>&#8221; into &#8220;<code>/Library/Modem Scripts</code>&#8220;.</p>
<p>Next, pair your Mac OS X computer with the Nokia phone by clicking on the Bluetooth icon in the menu bar and then <strong>Set up Bluetooth Device&#8230;</strong>. When pairing make you sure you choose <strong>Use a direct, higher speed connection to reach your Internet Service Provider *GPRS, 1xRTT)</strong>.</p>
<p>Enter <code>guest</code> as the <strong>Username</strong>, <code>guest</code> as the <strong>Password</strong>, the <strong>APN (CID String or Telephone number)</strong> and make sure <code>Nokia 3G CID1</code> is selected as the <strong>Modem Script</strong>. For example:</p>
<p><img src="/blog/wp-content/Mac-OSX-Nokia-3G/Mac-OSX-Bluetooth-Setup-Assistant.png"/></p>
<p>For a detailed list of possible combinations of username, password and APN CID for a lot of providers around the world visit <a href="http://www.taniwha.org.uk/gprs.html">Ross Barkman&#8217;s GPRS Info Page</a>.</p>
<h3>Dialing out</h3>
<p>To dial out, open <strong>Internet Connect</strong>, browse to the <strong>Bluetooth</strong> tab and make sure the right entry is selected from the drop down menu. Then click <strong>Connect</strong>. Mac OS X will authenticate to the remote PPP server and a new dynamic PPP subinterface should be configured:</p>
<div>
<pre>
$ ifconfig ppp0
ppp0: flags=8051<up ,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
        inet 10.142.15.9 --> 10.6.6.6 netmask 0xffffff00
</up></pre>
</div>
<p>In my case, browsing speed is very good (around 384Kbps), but it might vary according to placement, coverage, whether you are moving and so on (by the way, UMTS network planning, deployment and coverage is something not trivial).</p>
<h3>Troubleshooting</h3>
<p>Make sure all the information for the connection have been entered correctly, specially the APN/Telephone number. If it doesn&#8217;t work, try using <code>Nokia 3G CID2</code> as the <strong>Modem Script instead.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/02/11/mac-os-x-bluetooth-and-nokia-umts-phones/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Xen network configuration and multiple VLANs</title>
		<link>http://www.felipe-alfaro.org/blog/2006/07/21/xen-network-configuration-and-multiple-vlans/</link>
		<comments>http://www.felipe-alfaro.org/blog/2006/07/21/xen-network-configuration-and-multiple-vlans/#comments</comments>
		<pubDate>Thu, 20 Jul 2006 21:50:10 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[VLAN]]></category>
		<category><![CDATA[XEN]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2006/07/21/xen-network-configuration-and-multiple-vlans/</guid>
		<description><![CDATA[Xen networking is powerful enough to allow for extreme customization. Although the default networking configuration is usually more than enough for simple scenarios, it can fall short when trying to support multiple guests standing on different VLANs. In this short article, I describe the steps needed to configure Xen to attach itself to multiple VLANs [...]]]></description>
			<content:encoded><![CDATA[<p>Xen networking is powerful enough to allow for extreme customization. Although the default networking configuration is usually more than enough for simple scenarios, it can fall short when trying to support multiple guests standing on different VLANs.</p>
<p>In this short article, I describe the steps needed to configure Xen to attach itself to multiple VLANs using a one-bridge-per-VLAN network interface mapping, then attaching each Xen domainU on as many VLANs as needed.</p>
<p>In the sample scenario, we will use a Cisco Catalyst 3560G-24TS switch carrying traffic from five different VLANs:</p>
<ul>
<li>VLAN2 is the administrative VLAN used to administer all the networking gear and boxes.</li>
<li>VLAN10 carries Internet traffic coming from the first ISP.</li>
<li>VLAN20 carries Internet traffic coming from the second ISP.</li>
<li>VLAN100 carries the access network traffic.</li>
<li>VLAN200 carries the core network traffic.</li>
</ul>
<p>The final Xen configuration will provide five bridging network interfaces, one per VLAN. Each Xen domainU can freely attach to any of these bridging network interfaces in order to gain access to the traffic being carried by each VLAN.</p>
<p>The bridging interface, <code><em>|brname|</em></code> is named after the following convention: <code>xenbr<em>|vlan|</em></code>:</p>
<ul>
<li><code>xenbr2</code> is the bridging interface standing on VLAN2.</li>
<li><code>xenbr10</code> is the bridging interface standing on VLAN10.</li>
<li><code>xenbr20</code> is the bridging interface standing on VLAN20.</li>
<li><code>xenbr100</code> is the bridging interface standing on VLAN100.</li>
<li><code>xenbr200</code> is the bridging interface standing on VLAN200.</li>
</ul>
<p>Also, Xen creates an manages several virtual network interfaces, named in the form of <code>vif|X|.|Y|</code>, where <code>|X|</code> equals the Xen domain numeric ID and <code>|Y|</code> is a sequential interface index. Thus, starting up a Xen domainU given the following virtual network interface definition:</p>
<div>
<pre>
vif = [ 'mac=00:16:3e:00:00:44, bridge=xenbr10',
        'mac=00:16:e3:00:00:45, bridge=xenbr20' ]
</pre>
</div>
<p>Will cause the Xen domain to get assigned, let&#8217;s say, a domain ID of 2, and two virtual network interfaces named <code>vif2.0</code> &#8212; attached to <code>xenbr10</code> &#8212; and <code>vif2.1</code> &#8212; attached to <code>xenbr20</code>.</p>
<h2>Setting up the bridging interfaces:</h2>
<p>This can be done manually, by invoking <code>brctl addbr |brname|</code> in order to create a new bridging interface.</p>
<p>For example, the following commands will create five bridging interfaces, one for each supported VLAN:</p>
<div>
<pre>
brctl addbr xenbr2
brctl addbr xenbr10
brctl addbr xenbr20
brctl addbr xenbr100
brctl addbr xenbr200
</pre>
</div>
<p>or else can be automated to get done during system startup, by creating a file named <code>/etc/sysconfig/network-scripts/ifcfg-|brname|</code>, where <code>|brname|</code> is the name assigned to the bridging interface, like <code>/etc/sysconfig/network-scripts/ifcfg-xenbr2</code> (the configuration file for the bridging interface standing on VLAN2):</p>
<div>
<pre>DEVICE=xenbr2
BOOTPROTO=static
IPADDR=192.168.0.10
NETMASK=255.255.0.0
ONBOOT=yes
TYPE=Bridge
</pre>
</div>
<h2>Setting up the VLAN interfaces and add them up to the existing bridging interfaces:</h2>
<p>This can be done manually, by invoking <code>vconfig add |ifname| |vlan|</code> to configure VLAN number <code>|vlan|</code> by using 802.1q tagging on interface <code>|ifname|</code>. This will active a virtual interface named <code>|ifname|.|vlan|</code>:</p>
<ul>
<li>Any traffic sent to this interface will get tagged for VLAN <code>|vlan|</code>.</li>
<li>Any traffic received from interface <code>|ifname|</code> carrying an 802.1q VLAN tag matching <code>|vlan|</code> will be untagged and received by this interface.</li>
</ul>
<div>
<pre>
vconfig add eth0 2
vconfig add eth0 10
vconfig add eth0 20
vconfig add eth0 100
vconfig add eth0 200
</pre>
</div>
<p>This will add five new VLAN interfaces, one for every supported VLAN.</p>
<p>Once the VLAN interfaces are ready, we add them to their corresponding bridging interfaces by using <code>brctl addif |brname| |ifname|.|vlan|</code>:</p>
<pre>
<div>
brctl addif xenbr2 eth0.2
brctl addif xenbr10 eth0.10
brctl addif xenbr20 eth0.20
brctl addif xenbr100 eth0.100
brctl addif xenbr200 eth0.200
</div>
</pre>
<p>The process of adding up a new VLAN interface and then adding it up to an existing bridging interface can be configured using a single configuration file named <code>ifcfg-|ifname|.|vlan|</code>, like <code>/etc/sysconfig/network-scripts/ifcfg-eth0.2</code>:</p>
<pre>
<div>
DEVICE=eth0.2
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
VLAN=yes
BRIDGE=xenbr2
</div>
</pre>
<h2>Keeping Xen from reconfiguring the network:</h2>
<p>Since we have already configured the network manually, we don&#8217;t want Xen to mess up with the configuration. In order to keep Xen from reconfiguring the network, simply make sure none of the following lines appear <strong>uncommented</strong> in the file <code>/etc/xen/xend-config.sxp</code>:</p>
<div>
<pre>
(network-script network-bridge)
(network-script network-route)
(network-script network-nat)
</pre>
</div>
<h2>Additional notes:</h2>
<p>I have been experiencing a very strange behavior on Xen domainU guests while using this network configuration: it seems that UDP traffic gets stuck at the network stack  and does not flow through unless I load the <code>ip_conntrack.ko</code> kernel module.</p>
<p>Failing to load the <code>ip_conntrack.ko</code> kernel module, even with an unconfigured, empty firewall, allows ICMP and TCP traffic to flow from and to the guest network stack, but UDP traffic, like DNS queries, gets stuck and doesn&#8217;t even touch the physical network interface.</p>
<p>This is really strange, isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2006/07/21/xen-network-configuration-and-multiple-vlans/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Linksys, OpenWRT and multiple VLANs</title>
		<link>http://www.felipe-alfaro.org/blog/2006/07/19/linksys-openwrt-and-multiple-vlans/</link>
		<comments>http://www.felipe-alfaro.org/blog/2006/07/19/linksys-openwrt-and-multiple-vlans/#comments</comments>
		<pubDate>Wed, 19 Jul 2006 10:32:14 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[OpenWRT]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[VLAN]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2006/07/19/linksys-openwrt-and-multiple-vlans/</guid>
		<description><![CDATA[The Cisco Linksys WRT54G/GS/GL is made up of a six-port configurable switch, a standard Ethernet controller (usually a Broadcom controller named eth0) and a Wireless controller (usually a Broadcom controller named eth1). The following diagram tries to illustrate the different components that made up the Cisco Linksys and how are they interconnected: Linksys rear Trunk [...]]]></description>
			<content:encoded><![CDATA[<p>The Cisco Linksys WRT54G/GS/GL is made up of a six-port configurable switch, a standard Ethernet controller (usually a Broadcom controller named <code>eth0</code>) and a Wireless controller (usually a Broadcom controller named <code>eth1</code>).</p>
<p>The following diagram tries to illustrate the different components that made up the Cisco Linksys and how are they interconnected:</p>
<div>
<pre>
                                            Linksys rear
 Trunk    Internet    1     2     3     4   port number
  ---        ---     ---   ---   ---   ---
  |5|        |4|     |3|   |2|   |1|   |0|  switch port number
  ---        ---     ---   ---   ---   ---
  |           |       |                 |
  |         vlan1     |----- vlan0 -----|
  |
  | Miniswitch
  ----------------------------------------
  | Linux
  |
  |           ---- vlan0 -> LAN
  |           |
  |----- eth0 -
              |
              ---- vlan1 -> Internet/WAN
</pre>
</div>
<p>The standard Ethernet controller is attached to the sixth port (port #5) of the switch and is configured as a 802.1q VLAN trunk port. This allows running several VLANs using a single connection to the switch.</p>
<p>By default, OpenWRT configures two per-VLAN network interfaces:</p>
<ul>
<li><strong><code>vlan0</code></strong>:
<p>stands on the VLAN0 (the Local Area Network which comprises the four ports labeled as 1, 2, 3 and 4 at the rear of the box).</li>
<li><strong><code>vlan1</code></strong>:
<p>stands on the WAN network (the port labeled Internet at the rear of the box).</li>
</ul>
<p>The VLAN configuration is controlled using NVRAM variables. The variable labeled <code>vlan0ports</code> defines which switch ports are assigned onto the VLAN0, while <code>vlan1ports</code> defines which switch ports are assigned onto the VLAN1.</p>
<p>This is the default NVRAM configuration:</p>
<div>
<pre>
nvram set vlan0ports="3 2 1 0 5*"
nvram set vlan0hwname=et0
nvram set vlan1ports="4 5"
nvram set vlan1hwname=et0
</pre>
<div>
<ul>
<li><strong><code>vlan0ports</code></strong>:
<p>states that ports #3, #2, #1 and #0 (the ports labeled as 1, 2, 3 and 4 at the rear of the box) are assigned onto VLAN0. Additionally, port #5 is also assigned onto VLAN0.</p>
<p>The asterisk sitting besides the 5 means VLAN0 is the default, native VLAN for this port, so any untagged traffic is considered to belong to VLAN0.</p>
</li>
<li><strong><code>vlan1ports</code></strong>:
<p>states that port #4 (the port labeled as Internet at the rear of the box) is assigned onto VLAN1. Additionally, port #5 is also assigned onto VLAN1 since it&#8217;s a trunk port.</p>
<p>The lack of an asterisk means VLAN1 is <strong>not</strong> the default, native VLAN for this port.</li>
</ul>
<p><strong>NOTE</strong>: <code>vlan<em>n</em>hwname</code> needs to have a value assigned to it, even when it&#8217;s value is never used by the init scripts. This value is usually <code>et0</code>.</p>
<p><strong>NOTE</strong>: Care must be exercised as ports numbers are zero-based, as illustrated before, and the sixth-port (port #5) must be assigned to every VLAN, since it is an VLAN trunk port.</p>
<p>The following code snippet from <code>/etc/init.d/S10boot</code> shows how the init script tells the switch which ports are onto which VLANs:</p>
<div>
<pre>
# configure the switch based on nvram
[ -d /proc/switch/eth0 ] &#038;&#038; {
  for nr in $(seq 0 15); do
    vp="$(nvram get vlan${nr}ports)"
    [ -z "$vp" -o -z "$(nvram get vlan${nr}hwname)" ] || {
        echo "$vp" > /proc/switch/eth0/vlan/$nr/ports
    }
  done
}
</pre>
</div>
<p>We can also see that up to sixteen VLANs are supported by the switch.</p>
<h4>Custom VLANs</h4>
<p>The Linksys and OpenWRT combination is so flexible that we can configure additional VLANs. In fact, I was looking to add an additional administrative VLAN (VLAN2) granting me full access to the box while I could restrict access from the LAN and WAN to the minimum &#8212; for example, by using additional firewall rules.</p>
<p>This is depicted in the following figure:</p>
<div>
<pre>
                                            Linksys rear
 Trunk    Internet    1     2     3     4   port number
  ---        ---     ---   ---   ---   ---
  |5|        |4|     |3|   |2|   |1|   |0|  switch port number
  ---        ---     ---   ---   ---   ---
  |           |       |     |           |
  |         vlan1   vlan2   |-- vlan0 --|
  |
  | Linksys
  ----------------------------------------
  | Linux
  |
  |           ---- vlan0 -> LAN
  |           |
  |----- eth0 ---- vlan1 -> Internet/WAN
              |
              ---- vlan2 -> Administrative VLAN
</pre>
</div>
<p>To achieve this configuration, we need to remove port #3 (labeled as 1 at the rear of the box) from VLAN0 and assign it onto VLAN2. We also need to add port #5 to the VLAN2 since it is the VLAN trunk port used to carry the traffic from the switch to Linux through the standard Ethernet controller:</p>
<div>
<pre>
nvram set vlan0ports="2 1 0 5*"
nvram set vlan0hwname=et0
nvram set vlan1ports="4 5"
nvram set vlan1hwname=et0
nvram set vlan2ports="3 5"
nvram set vlan2hwname=et0
</pre>
</div>
<p>I&#8217;ve defined three custom NVRAM variables that will get used by an additional init script to configure the VLAN2 as an administrative VLAN, granting full access to the box:</p>
<ul>
<li><strong><code>adm_ifname</code></strong>:
<p>defines the Linux network interface name assigned to the administrative VLAN, in the form of <code>vlan</code><em>n</em>, where <em>n</em> is the VLAN number.</li>
<li><strong><code>adm_ipaddr</code></strong>:
<p>defines the IP address for the administrative interface.</li>
<li><strong><code>adm_netmask</code></strong>:
<p>defines the network mask for the administrative interface.</li>
</ul>
<p>For example:</p>
<div>
<pre>
nvram set adm_ifname=vlan2
nvram set adm_ipaddr=192.168.0.100
nvram set adm_netmask=255.255.0.0
</pre>
</div>
<p>I&#8217;ve also coded up an additional init script, named <code>/etc/init.d/S41network</code>, used to bring up the administrative interface. I&#8217;ve decided not to fiddle with <code>/etc/init.d/S40network</code> to avoid breaking things and having problems during upgrades.</p>
<p>These are the contents of <code>/etc/init.d/S41network</code>:</p>
<div>
<pre>
#!/bin/sh
IFNAME=$(nvram get adm_ifname)
VLAN=${IFNAME##vlan}
IPADDR=$(nvram get adm_ipaddr)
NETMASK=$(nvram get adm_netmask)
vconfig add eth0 $VLAN
ifconfig vlan${VLAN} up ${IPADDR} netmask ${NETMASK}
</pre>
</div>
<h4>Testing</h4>
<p>To test this custom configuration, I recommend disabling the firewall, my removing the executable permission bit from <code>/etc/init.d/S45firewall</code> and <code>/etc/init.d/S41network</code> just to prevent being locked out from the box in case problems arise.</p>
<h4>Firewalling</h4>
<p>I&#8217;ve also replaced the firewalling init script, <code>/etc/init.d/S45firewall</code>, with my own version. This allows for a fine-grained and thighter configuration.</p>
<p>Since the box will act as a routing firewall, and since it has 3 VLANs, I wanted to apply the following policy:</p>
<ul>
<li><strong>Any traffic coming from or going to the administrative VLAN (VLAN2) is allowed:</strong>
<p>This rule allows administering the box from a computer attached to the VLAN2, while blocking administrative access from other VLANs.</li>
<li><strong>Incoming ICMP Echo Requests and ICMP Time Exceeded control messages are allowed from any interface:</strong>
<p>This rule allows certain ICMP control messages to reach the box. ICMP Echo Request is needed in order for the box to respond to <code>ping</code> and ICMP Time Exceeded (TTL) so we don&#8217;t break the PMTU discovery algorithm.</li>
<li><strong>Any other incoming traffic from the LAN is rejected:</strong>
<p>This rule rejects any other traffic which does not match previous rules. Traffic is explicitly rejected, so we avoid having clients blocked waiting for an RST TCP segment.</li>
<li><strong>Any other incoming traffic from the WAN is dropped:</strong>
<p>This rule silently drops any traffic coming from the WAN which does not match any previous rule. This will make external scan attacks much slower.</li>
<li><strong>Local DNS queries coming from the local box going to configured DNS servers are allowed:</strong>
<p>This rule allows the local machine to resolve DNS queries sent against configured DNS servers (those configured in the <code>wan_dns</code> NVRAM variable). This is rarely needed, but the <code>ipkg</code> command requires a working DNS name resolution.</li>
<li><strong>HTTP traffic from the local machine to the WAN is allowed:</strong>
<p>This rule allows upgrading and installing packages using the <code>ipkg</code> command.</li>
<li><strong>Outgoing ICMP Echo Requests and ICMP Time Exceeded control messages are allowed from any interface:</strong>
<p>This rule allows certain ICMP control messages to depart from the box. ICMP Echo Request is needed in order for the box to invoke <code>ping</code> and ICMP Time Exceeded (TTL) so we don&#8217;t break the PMTU discovery algorithm.</li>
<li><strong>Forwarding SSH/NX traffic coming from WAN to the designated SSH/NX server in the LAN:</strong>
<p>This rule allows accesing the SSH/NX traffic from the WAN. In addition, I apply SNAT to make IP datagrams appear to come from the firewall box since I have multiple DSL links.</li>
<li><strong>Forwarding HTTP and HTTP/S traffic coming from the LAN targeted to the WAN:</strong>
<p>This rule allows using HTTP and HTTP/S services from the LAN.</li>
<li><strong>DNS queries coming from the LAN going to configured DNS servers are allowed:</strong>
<p>This rule allows the machines in the LAN to resolve DNS queries sent against configured DNS servers (those configured in the <code>wan_dns</code> NVRAM variable).</li>
<li><strong>Forwarding ICMP Echo Requests coming from the LAN to the WAN:</strong>
<p>This allows pinging external hosts from the LAN. ICMP Time Exceeded, however, is not forwarded, since the firewall sits in the middle between the LAN and the WAN (and I do use SNAT and DNAT).</li>
</ul>
<p>Here is the complete <code>/etc/init.d/S45firewall</code> script:</p>
<div>
<pre>
#!/bin/sh
IPTABLES=/usr/sbin/iptables
FW_INET_IFACE=$(nvram get wan_ifname)
FW_INET_IP=$(nvram get wan_ipaddr)
FW_PRIVATE_IFACE=$(nvram get lan_ifname)
FW_PRIVATE_IP=$(nvram get lan_ipaddr)
FW_ADM_IFACE=$(nvram get adm_ifname)
NX_IP=10.200.0.10

$IPTABLES -F
$IPTABLES -t nat -F

# Configure SNAT/DNAT/MASQUERADE
$IPTABLES -t nat -A PREROUTING -i ${FW_INET_IFACE} -p tcp \
                               -d ${FW_INET_IP} --dport 179 \
                               -j DNAT --to-destination ${NX_IP}:22
$IPTABLES -t nat -A POSTROUTING -o ${FW_PRIVATE_IFACE} -p tcp \
                                -d ${NX_IP} --dport 22 \
                                -j SNAT --to-source ${FW_PRIVATE_IP}
$IPTABLES -t nat -A POSTROUTING -o ${FW_INET_IFACE} -j MASQUERADE

# Configure input firewall filtering:
# Allow:
#   - Traffic flowing from the loopback interface
#   - Traffic coming from the administrative VLAN
#   - ICMP Echo Request coming from WAN
#   - ICMP Time Exceeded (TTL) coming from WAN
#   - Traffic from an already established or related connection
# Block:
#   - Any traffic coming from the WAN
# Reject:
#   - Any other traffic coming from the LAN
$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A INPUT -i ${FW_ADM_IFACE} -j ACCEPT
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type time-exceeded -j ACCEPT
$IPTABLES -A INPUT -i ${FW_INET_IFACE} -j DROP
$IPTABLES -A INPUT -j REJECT

# Configure output firewall filtering:
# Allow:
#   - Traffic flowing to the loopback interface
#   - HTTP traffic
#   - ICMP Echo Request going to WAN
#   - ICMP Time Exceeded (TTL) going to WAN
#   - DNS queries to configured WAN name servers
#   - Traffic from an already established or related connection
# Reject:
#   - Any other traffic
$IPTABLES -A OUTPUT -o lo -j ACCEPT
$IPTABLES -A OUTPUT -o ${FW_INET_IFACE} -p tcp -m tcp \
                     --dport 80 -m state --state NEW -j ACCEPT
$IPTABLES -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
$IPTABLES -A OUTPUT -p icmp --icmp-type time-exceeded -j ACCEPT
for ns in $(nvram get wan_dns); do
        $IPTABLES -A OUTPUT -o ${FW_INET_IFACE} -p udp -m udp \
                            -d "$ns" --dport 53 -j ACCEPT
        $IPTABLES -A OUTPUT -o ${FW_INET_IFACE} -p tcp -m tcp \
                            -d "$ns" --dport 53 -j ACCEPT
done
$IPTABLES -A OUTPUT -j REJECT

# Configure forward firewall filtering:
# Allow:
#   - Incoming SSH/NX traffic -> the filtering takes place after the
#     PREROUTING chain has been processed and, since DNAT has been already
#     being performed, the traffic is filtered accordingly to its final
#     destination (the SSH/NX server)
#   - Outgoing DNS queries to configured WAN name servers
#   - Outgoing HTTP and HTTP/S traffic
#   - ICMP Echo Request coming from LAN going to WAN
#   - Trafic from an already established or related connection
# Drop:
#   - Any other traffic
$IPTABLES -A FORWARD -i ${FW_INET_IFACE} -o ${FW_PRIVATE_IFACE} -p tcp -m tcp \
                     -d ${NX_IP} --dport 22 -m state --state NEW -j ACCEPT
$IPTABLES -A FORWARD -i ${FW_PRIVATE_IFACE} -o ${FW_INET_IFACE} -p tcp -m tcp \
                     --dport 80 -m state --state NEW -j ACCEPT
$IPTABLES -A FORWARD -i ${FW_PRIVATE_IFACE} -o ${FW_INET_IFACE} -p tcp -m tcp \
                     --dport 443 -m state --state NEW -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i ${FW_PRIVATE_IFACE} -o ${FW_INET_IFACE} \
                     -p icmp --icmp-type echo-request -j ACCEPT
for ns in $(nvram get wan_dns); do
        $IPTABLES -A FORWARD -i ${FW_PRIVATE_IFACE} -o ${FW_INET_IFACE} \
                             -p udp -m udp -d "$ns" --dport 53 -j ACCEPT
        $IPTABLES -A FORWARD -i ${FW_PRIVATE_IFACE} -o ${FW_INET_IFACE} \
                             -p tcp -m tcp -d "$ns" --dport 53 -j ACCEPT
done
$IPTABLES -A FORWARD -j DROP
</pre>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2006/07/19/linksys-openwrt-and-multiple-vlans/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Resetting Cisco IOS configuration</title>
		<link>http://www.felipe-alfaro.org/blog/2006/07/17/resetting-cisco-ios-configuration/</link>
		<comments>http://www.felipe-alfaro.org/blog/2006/07/17/resetting-cisco-ios-configuration/#comments</comments>
		<pubDate>Mon, 17 Jul 2006 09:25:35 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2006/07/17/resetting-cisco-ios-configuration/</guid>
		<description><![CDATA[You can use the following Cisco IOS commands to reset the Cisco configuration back to factory defaults: write erase This will clear the startup-config and fill it up with factory defaults. delete flash:vlan.dat Most Cisco IOS switches keep VLAN configuration data &#8212; like VTP protocol data, active VLANs, and so on &#8212; in flash memory, [...]]]></description>
			<content:encoded><![CDATA[<p>You can use the following Cisco IOS commands to reset the Cisco configuration back to factory defaults:</p>
<pre>write erase</pre>
<p>This will clear the <code>startup-config</code> and fill it up with factory defaults.</p>
<pre>delete flash:vlan.dat</pre>
<p>Most Cisco IOS switches keep VLAN configuration data &#8212; like VTP protocol data, active VLANs, and so on &#8212; in flash memory, in a file called <code>vlan.dat</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2006/07/17/resetting-cisco-ios-configuration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>QEMU and TUN/TAP networking</title>
		<link>http://www.felipe-alfaro.org/blog/2006/07/05/qemu-and-tuntap-networking/</link>
		<comments>http://www.felipe-alfaro.org/blog/2006/07/05/qemu-and-tuntap-networking/#comments</comments>
		<pubDate>Wed, 05 Jul 2006 12:11:50 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2006/07/05/qemu-and-tuntap-networking/</guid>
		<description><![CDATA[Using TUN/TAP networking with QEMU grant guest machines access to some or all networks reachable by the host machine. This also allows accessing services offered by guests machines from any other host. To be able to use TUN/TAP network, instead of directly configuring the physical Ethernet network device &#8212; my Realtek 8169 Gigabit Ethernet, which [...]]]></description>
			<content:encoded><![CDATA[<p>Using TUN/TAP networking with QEMU grant guest machines access to some or all networks reachable by the host machine. This also allows accessing services offered by guests machines from any other host.</p>
<p>To be able to use TUN/TAP network, instead of directly configuring the physical Ethernet network device &#8212; my Realtek 8169 Gigabit Ethernet, which in my computer it&#8217;s named <code>eth1</code> &#8211;, we need to reconfigure the network in order to get a bridge device, named <code>br0</code>, with the physical Ethernet <code>eth1</code> device attached to it. We can achieve this by editing <code>/etc/network/interfaces</code> to look like this:</p>
<div>
<pre>
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto eth1
#iface eth1 inet static

auto br0
iface br0 inet static
        address a.b.c.d
        netmask 255.255.255.128
        gateway v.w.x.y
        bridge_ports eth1
        bridge_fd 1
        bridge_hello 1
        bridge_stp off
</pre>
</div>
<p>The helper script <code>/etc/qemu-ifup</code>, which QEMU uses to bring up a TAP network interface used by the guest and bind it to the existing bridge <code>br0</code>, should look like this:</p>
<div>
<pre>
#!/bin/sh
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
</pre>
</div>
<p>To allow running QEMU as an unprivileged user, we need to edit <code>/etc/sudoers</code> in order to grant access for running <code>/sbin/ifconfig</code> and <code>/usr/sbin/brctl</code>. It&#8217;s recommended to edit that file using <code>visudo</code>. The file should could look like this:</p>
<div>
<pre>
# Cmnd alias specification
Cmnd_Alias      QEMU=/sbin/ifconfig, \\
                     /sbin/modprobe, \\
                     /usr/sbin/brctl

# Defaults
Defaults        !lecture,tty_tickets,!fqdn,rootpw

# User privilege specification
root    ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Grant access to Cmnd_Alias to user jdoe
jdoe ALL=NOPASSWD:QEMU
</pre>
</div>
<p>Now, we can launch <code>qemu</code> from the command line:</p>
<pre>
XLIB_SKIP_ARGB_VISUALS=1 \\
qemu -hda hda -cdrom *iso -boot d \\
-m 512 -localtime -net nic,vlan=0 \\
-net tap,ifname=tap0,script=/etc/qemu-ifup \\
-kernel-kqemu
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2006/07/05/qemu-and-tuntap-networking/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Configuring WPA2 Enterprise with EAP-TLS in Mac OS X and Linux</title>
		<link>http://www.felipe-alfaro.org/blog/2006/01/29/wpa2-eap-tls/</link>
		<comments>http://www.felipe-alfaro.org/blog/2006/01/29/wpa2-eap-tls/#comments</comments>
		<pubDate>Sun, 29 Jan 2006 17:52:19 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2006/01/29/wpa2-enterprise/</guid>
		<description><![CDATA[Setting up the CA Follow the steps on setting up a Certificate Authority (CA) using OpenSSL. Issuing the client certificate and private key Once the CA has been configured, we will generate a private key and an unsigned public key digital certificate. # openssl req -new -days 365 -newkey rsa:1024 \ -keyout sslkey.pem -out unsigned.pem [...]]]></description>
			<content:encoded><![CDATA[<h3>Setting up the CA</h3>
<p>Follow the steps on <a href="/blog/2005/11/18/setting-up-certificate-authority-ca-using-openssl/" title="Setting up a Certificate Authority (CA) using OpenSSL">setting up a Certificate Authority (CA) using OpenSSL</a>.</p>
<h3>Issuing the client certificate and private key</h3>
<p>Once the CA has been configured, we will generate a private key and an unsigned public key digital certificate.</p>
<p><code># openssl req -new -days 365 -newkey rsa:1024 \<br />
-keyout sslkey.pem -out unsigned.pem</code></p>
<p>The unsigned public key digital certificate, stored in a PEM-encoded file named <code>unsigned.pem</code> will be sent to the CA for signing:</p>
<p><code># openssl ca -in unsigned.pem -out cert.pem</code></p>
<h3>Installing the client certificate and private key</h3>
<p>The next step consists in installing the private key, public key digital certificate and CA public key certificate.</p>
<h4>Linux</h4>
<p>The private key, public key digital certificate and CA certificate files should get installed into a location where only root and wpa_supplicant can access them, for example, <b>/etc/wpa</b>:</p>
<p><code># mkdir /etc/wpa</code><br />
<code># chown root.root /etc/wpa</code><br />
<code># chmod 700 /etc/wpa</code></p>
<h4>Mac OS X</h4>
<p>Mac OS X can only import private keys in PKCS#12 so we need to export all the previous items to a suitable format:</p>
<p><code># openssl pkcs12 -export -in cert.pem -inkey key.pem \<br />
-out client.p12 -name "host.domain"</code></p>
<p>Where <code>"host.domain"</code> denotes the FQDN of the host which this digital certificate and private key are intended for.</p>
<p>The output file <b>client.p12</b> contains the private key and public key digital certificate. This bundle should get moved to the host using a secure distribution channel, like an SSH/SCP/SFTP session or a USB key. Also, the CA digital certificate, usually named <b>cacert.pem</b>, should also get copied to the host.</p>
<p>On Mac OS X, using the GUI, double click the <b>cacert.pem</b> file, and install the CA certificate into the <b>X509Anchors</b> keychain. This a system-wide keychain intended to store X.509 CA root digital certificates.</p>
<p><img src="/blog/wp-content/WPA2/cacert.png"/></p>
<p>Next, using the GUI, double click on <b>client.p12</b> file, supply the password that protects the private key stored in this file, and choose to install both the private key and public key into the <b>login</b> keychain. Next, make sure the private key has been installed:</p>
<p><img src="/blog/wp-content/WPA2/keychain.png" width="100%"/></p>
<h3>Configuring the AirPort Express Wireless Access Point</h3>
<p>Launch <b>AirPort Admin Utility</b>, select the desired base station and click the <b>Configure</b> icon from the toolbar:</p>
<p><img src="/blog/wp-content/WPA2/ap.png" width="100%"/></p>
<p>Click the <b>Change Wireless Security&#8230;</b> button:</p>
<p><img src="/blog/wp-content/WPA2/ap_wpa2.png" width="100%"/></p>
<p>In this new window, fill in the information about the RADIUS server, like its IP address, shared secret and so on.</p>
<h3>Configuring the Supplicant for WPA2 Enterprise</h3>
<h4>Linux</h4>
<p>Create <b>/etc/wpa_supplicant.conf</b> using the following data:</p>
<div>
<pre>ctrl_interface=/var/run/wpa_supplicant
ap_scan=2
network={
  scan_ssid=1
  ssid="iTunes"
  proto=WPA2
  key_mgmt=WPA-EAP
  pairwise=CCMP
  group=CCMP
  ca_cert="/etc/wpa/cacert.pem"
  client_cert="/etc/wpa/cert.pem"
  private_key="/etc/wpa/key.pem"
  eap=TLS
  identity="anonymous"
}</pre>
</div>
<p>The <b>identity</b> directive is required, or else the EAP-TLS negotiation will fail.</p>
<p><b>ap_scan=2</b> and <b>scan_ssid=1</b> are needed when the Wireless Acccess Point is configured to not broadcast the ESSID.</p>
<h4>Mac OS X</h4>
<p>Launch <b>Internet Connect</b> from the Wireless menu:</p>
<p><img src="/blog/wp-content/WPA2/ic.png" width="100%"/></p>
<p>If no 802.1X icon appears on the toolbar, choose <b>File -> New 802.1X Conection&#8230;</b>. Click the 802.1X icon. The window will look like this:</p>
<p><img src="/blog/wp-content/WPA2/8021X.png" width="100%"/></p>
<p>From the <b>Configuration</b> drop-down, select <b>Edit Configurations&#8230;</b>:</p>
<p><img src="/blog/wp-content/WPA2/8021X_new.png" width="100%"/></p>
<p>A window like this will open:</p>
<p><img src="/blog/wp-content/WPA2/8021X_data.png" width="100%"/></p>
<p>Fill in both the <em>&#8220;Description&#8221;</em> and <em>&#8220;Wireless Network&#8221;</em> fields with the ESSID of the Wireless network. Leave <em>&#8220;User Name&#8221;</em> and <em>&#8220;Password&#8221;</em> blanked, since we are not using password-based authentication.</p>
<p>From the <em>&#8220;Authentication&#8221;</em> listbox, clear the checkbox for all the protocols except for <b>TLS</b>. Select the TLS protocol and click the Configure button. A new window will open for you to select the private key that will be used for the EAP-TLS authentication mechanism:</p>
<p><img src="/blog/wp-content/WPA2/8021X_key.png" width="100%"/></p>
<p>From the drop-down listbox, select the name of the private key that matches the name of the private key installed in the previous section.</p>
<p>Click the <b>Connect</b> button. The Supplicant will authenticate against the Wireless Access Point. At this point, it is possible that Mac OS X asks confirmation for accessing the private key stored in your keychain. It is recommended to &#8220;Always Allow&#8221; the Supplicant access to the private key.</p>
<p><img src="/blog/wp-content/WPA2/8021X_connected.png" width="100%"/></p>
<p>Launch <b>System Preferences -> Network</b> and <b>Configure&#8230;</b> the AirPort interface:</p>
<p><img src="/blog/wp-content/WPA2/network.png" width="100%"/></p>
<p>Click the <b>&#8220;+&#8221;</b> button to add a Preferred network:</p>
<p><img src="/blog/wp-content/WPA2/preferred.png" width="100%"/></p>
<p>Just enter the ESSID of the Wireless network and choose <b>WPA2 Enterprise</b> from the <b>Wireless Security</b> drop-down listbox. Also, make sure the <b>Configuration</b> field shows the name of the 802.1X configuration we created previously using Internet Connect.</p>
<p>Leave the rest of the fields blank, since we are not using password-based authentication.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2006/01/29/wpa2-eap-tls/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Managing multiple NICs in Linux</title>
		<link>http://www.felipe-alfaro.org/blog/2006/01/04/managing-multiple-nics-in-linux/</link>
		<comments>http://www.felipe-alfaro.org/blog/2006/01/04/managing-multiple-nics-in-linux/#comments</comments>
		<pubDate>Wed, 04 Jan 2006 01:37:32 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/?p=92</guid>
		<description><![CDATA[When running a Linux kernel 2.6, it&#8217;s very difficult to tell network interfaces apart when they use the same driver or chipset. This can also be confusing even on systems with multiple network interfaces using different chipsets or drivers. Which one is eth0? Which one is eth1? What&#8217;s even worse is that it seems udev [...]]]></description>
			<content:encoded><![CDATA[<p>When running a Linux kernel 2.6, it&#8217;s very difficult to tell network interfaces apart when they use the same driver or chipset. This can also be confusing even on systems with multiple network interfaces using different chipsets or drivers. Which one is <em>eth0</em>? Which one is <em>eth1</em>? What&#8217;s even worse is that it seems <em>udev</em> doesn&#8217;t always assign the same name to each network interface between reboots, so the same card sometimes is named <em>eth0</em>, and sometimes <em>eth2</em>, for example.</p>
<p>Fortunately, there is a way to tie each network interface card with a fixed network interface name by using <em>udev</em> rules.</p>
<p>My system has four network interfaces:</p>
<ul>
<li>2 Ethernet 3Com 3C905 10/100, using the <em>3c59x</em> linux driver.</li>
<li>1 Ethernet SMC 9452TX 10/100/1000, using the <em>skge</em> linux driver.</li>
<li>1 Wireless 802.11g SMC 2835W V3, using <em>ndiswrapper</em>.</li>
</ul>
<p>Let&#8217;s suppose <em>udev</em> has given the name <em>eth2</em> to the SMC 9452TX. Now, let&#8217;s suppose we want to rename this network interface to <em>eth0</em> or a more meaningful name like <em>lan</em> or <em>e1000</em>. We can write a <em>udev</em> rule to perform the renaming, thus making a persistent device-name association.</p>
<p>To write this rule, first we need to use some attribute which is unique to the device. For network devices, we can use the MAC address. Using <em>udevinfo</em> we can retrieve all attributes for the <em>eth2</em> device:</p>
<pre>
<div># udevinfo -a -p /sys/class/net/eth2
  looking at class device '/sys/class/net/eth2':
    KERNEL=="eth2"
    SUBSYSTEM=="net"
    SYSFS{addr_len}=="6"
    SYSFS{address}=="00:13:AA:AA:AA:AA"
    SYSFS{broadcast}=="ff:ff:ff:ff:ff:ff"
    SYSFS{carrier}=="1"
    SYSFS{features}=="0x1023"
    SYSFS{flags}=="0x1003"
    SYSFS{ifindex}=="4"
    SYSFS{iflink}=="4"
    SYSFS{mtu}=="1500"
    SYSFS{tx_queue_len}=="1000"
    SYSFS{type}=="1"
    SYSFS{weight}=="64"</div>
</pre>
<p><code>SYSFS{address}=="00:13:AA:AA:AA:AA"</code> is the <em>udev</em> attribute used to refer to this network interface MAC address, the SMC 9452TX that is being named <em>eth2</em> by default. We can repeat this step to retrieve the attribute for every network interface for which we want to write a <em>udev</em> rule.</p>
<p>Once we&#8217;ve got all the attributes, we can place the <em>udev</em> rules in a file named code>/etc/udev/rules.d/99-user.rules:</p>
<pre>
<div>KERNEL=="eth*", SYSFS{address}=="00:13:AA:AA:AA:AA", NAME="e1000"
KERNEL=="eth*", SYSFS{address}=="00:04:BB:BB:BB:BB", NAME="e100"
KERNEL=="eth*", SYSFS{address}=="00:04:CC:CC:CC:CC", NAME="e10"</div>
</pre>
<p>Now, the easiest way of making these changes take effect is rebooting. Next time, <em>udev</em> will rename the network interfaces to <em>e1000</em>, <em>e100</em> and <em>e10</em> instead of <em>eth0</em>, <em>eth1</em> or <em>eth2</em>. What&#8217;s more, now it&#8217;s easier to tell the interfaces apart from each one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2006/01/04/managing-multiple-nics-in-linux/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>QoS with OpenWRT</title>
		<link>http://www.felipe-alfaro.org/blog/2005/12/30/qos-with-openwrt/</link>
		<comments>http://www.felipe-alfaro.org/blog/2005/12/30/qos-with-openwrt/#comments</comments>
		<pubDate>Thu, 29 Dec 2005 20:48:27 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[OpenWRT]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/?p=89</guid>
		<description><![CDATA[I use the following script for my Linksys WRT54GS Wireless router running OpenWRT White Russian -RC4 to setup a QoS firewall that uses Hierarchical Token Bucket (HTB) and Stochastic Fair Queueing (SFQ) to classify the traffic in three cathegories: Interactive, high priority traffic: This class is used for DNS traffic and SSH traffic. Interactive, normal [...]]]></description>
			<content:encoded><![CDATA[<p>I use the following script for my Linksys WRT54GS Wireless router running OpenWRT White Russian -RC4 to setup a QoS firewall that uses Hierarchical Token Bucket (HTB) and Stochastic Fair Queueing (SFQ) to classify the traffic in three cathegories:</p>
<ol>
<li><b>Interactive, high priority traffic:</b><br />
This class is used for DNS traffic and SSH traffic.</li>
<li><b>Interactive, normal priority traffic:</b><br />
This class is used for HTTP and HTTP/S traffic.</li>
<li><b>Low priority traffic:</b><br />
This class is used for traffic which doesn&#8217;t fit any of the previous classes.</li>
</ol>
<p>Each class is also subclassed with Stochastic Fair Queueing (SFQ) to distribute traffic utilization among the same class evenly.</p>
<p>To make the script run every time the router is powered up, save the script as <code>/etc/init.d/S41qos</code> and turn the executable bit on it.</p>
<pre>
<div>
#!/bin/ash

# Executables
GREP=/bin/grep
INSMOD=/sbin/insmod
TC=/usr/sbin/tc
DEV=vlan1

# Load kernel modules
$GREP -q ^sch_htb /proc/modules || $INSMOD /lib/modules/`uname -r`/sch_htb.o
$GREP -q ^sch_sfq /proc/modules || $INSMOD /lib/modules/`uname -r`/sch_sfq.o
$GREP -q ^cls_u32 /proc/modules || $INSMOD /lib/modules/`uname -r`/cls_u32.o

# Hierarchical Token Bucket (HTB)
$TC qdisc add dev $DEV root handle 1: htb default 30
$TC class add dev $DEV parent 1: classid 1:1 htb rate 1mbit burst 20k cburst 20k

# HTB Classes
$TC class add dev $DEV parent 1:1 classid 1:10 htb \
   rate 768kbit ceil 1mbit burst 15k cburst 15k
$TC class add dev $DEV parent 1:1 classid 1:20 htb \
   rate 256kbit ceil 1mbit burst 20k cburst 20k
$TC class add dev $DEV parent 1:1 classid 1:30 htb \
   rate 128kbit ceil 512kbit burst 5k cburst 5k

$TC qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
$TC qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10

# Filters
$TC filter add dev $DEV protocol ip parent 1:0 prio 1 \
   u32 match ip dport 53 0xffff flowid 1:10
$TC filter add dev $DEV protocol ip parent 1:0 prio 2 \
   u32 match ip dport 22 0xffff flowid 1:10
$TC filter add dev $DEV protocol ip parent 1:0 prio 10 \
   u32 match ip dport 80 0xffff flowid 1:20
$TC filter add dev $DEV protocol ip parent 1:0 prio 10 \
   u32 match ip dport 443 0xffff flowid 1:20
</div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2005/12/30/qos-with-openwrt/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

