<?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>~/blog &#187; networking</title>
	<atom:link href="http://blog.pressure.net.nz/tag/networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pressure.net.nz</link>
	<description>Cisco, Juniper, Unix, and open source software</description>
	<lastBuildDate>Mon, 14 Nov 2011 18:29:01 +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>Configuring NAT66 on ScreenOS</title>
		<link>http://blog.pressure.net.nz/2011/11/configuring-nat66-on-screenos/</link>
		<comments>http://blog.pressure.net.nz/2011/11/configuring-nat66-on-screenos/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 16:38:07 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Juniper]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[juniper]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[screenos]]></category>

		<guid isPermaLink="false">http://blog.pressure.net.nz/?p=77</guid>
		<description><![CDATA[I recently had to deploy redeploy an old NetScreen 5GT to segregate a production LAN and create a small lab network. The production LAN has a routable IPv6 /64 prefix, delivered via a Hurricane Electric IPv6 tunnel. The lab network also required IPv6 connectivity. We also recently obtained a /48 prefix from Hurricane Electric, so [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to deploy redeploy an old NetScreen 5GT to segregate a production LAN and create a small lab network. The production LAN has a routable IPv6 /64 prefix, delivered via a Hurricane Electric IPv6 tunnel. The lab network also required IPv6 connectivity. We also recently obtained a /48 prefix from Hurricane Electric, so I could have just assigned a /64 from that to the lab network and routed it via the 5GT. However, this 5GT gets moved around to various different networks, including trade show networks. As such, the untrust interface of the 5GT needed to be auto-configuring, so that it would obtain an IPv6 prefix from router advertisements on whichever LAN it was connected to. This also meant that assigning a /64 from our Hurricane Electric /48 prefix was out of the question.</p>
<p>The first step is to enable IPv6 support on your device, if it isn&#8217;t already:</p>
<pre>set envar ipv6=yes
save
reset save-config yes</pre>
<p>After restarting your device, you should find that IPv6 configuration options are available, and the web UI will also have additional pages and config options.<span id="more-77"></span>Next, we want to configure the untrust interface as IPv6 &#8220;host&#8221; mode, and permit it to accept router advertisements from your existing upstream IPv6 router.</p>
<pre>set interface untrust ipv6 mode host
set interface untrust ipv6 enable
set interface untrust ipv6 ra accept</pre>
<p>The untrust interface should configure itself with an address in the prefix advertised on your existing LAN, and create a default IPv6 route (::/0) via your upstream router.</p>
<pre>ns5gt-&gt; get int untrust      
Interface untrust:
  description untrust
  number 1, if_info 88, if_index 0, mode route
  link up, phy-link up/full-duplex
  status change:1, last change:11/09/2011 15:55:40
  ipv6 is enable/operable, host mode.
<span style="color: #ff0000;">  ipv6 operating mtu 1472, learned mtu 1472</span>
  ipv6 Interface-ID: 0210dbfffe680eb1
  ipv6 fe80::210:dbff:fe68:eb1/64, link local, PREFIX
<span style="color: #ff0000;">  ipv6 2001:470:xxxx:xxxx:210:dbff:fe68:eb1/64, global aggregatable, PREFER, AUTO-CONF</span>
  ipv6 ff02::1:ff68:eb1(2), solicited-node scope
  vsys Root, zone Untrust, vr trust-vr
  dhcp client enabled
  PPPoE disabled
  admin mtu 0, operating mtu 1472, default mtu 1500

ns5gt-&gt; get route
IPv6 Dest-Routes for &lt;trust-vr&gt; (3 entries)
--------------------------------------------------------------------------------------
         ID                                   IP-Prefix       Interface
                                                Gateway   P Pref    Mtr     Vsys
--------------------------------------------------------------------------------------
*         3                                        ::/0         untrust
                               fe80::226:88ff:fe45:8242   D  252      2     Root
*         4                     2001:470:xxxx:xxxx::/64         untrust
                                                     ::   C    0      0     Root
*         5    2001:470:xxxx:xxxx:210:dbff:fe68:eb1/128         untrust
                                                     ::   H    0      0     Root</pre>
<p>We can see above that the untrust interface has assigned itself an address in our Hurricane 2001:470:x:x/64 prefix. Note also that it has lowered the MTU to 1472, as advertised by our perimeter SRX. The PPPoE encapsulation of our VDSL connection incurs 8 bytes overhead, and since it is an IPv6 tunnel, we have to subtract another 20 bytes to ensure that we don&#8217;t send fragmented packets via Hurricane (who seem to drop fragmented traffic).</p>
<p>The next step is to configure the trust interface of the 5GT. I tend to use policy NAT, rather than the often-configured default of interface-NAT. Note that if you have existing outbound policies that were depending on the interface being in NAT mode, you will need to adjust those policies to perform source address NAT.</p>
<pre>set interface trust route</pre>
<p>Enable IPv6 on the trust interface in &#8220;router&#8221; mode. First we should generate a <a href="http://tools.ietf.org/search/rfc4193" target="_blank">RFC 4193</a> Unique Local Address (ULA). SixXS offers an online tool to generate one of these pseudo-random, quasi-unique prefixes from a MAC address at <a href="http://www.sixxs.net/tools/grh/ula/" target="_blank">http://www.sixxs.net/tools/grh/ula/</a></p>
<p>An address from a ULA prefix has a global scope, however the fc00::/7 prefix is filtered by ISPs, so there is no chance of these addresses colliding on the Internet. The pseudo-random prefix generation is simply to minimise the chance of a prefix collision on a LAN. The SixXS tool will generate a /48 prefix for you; choose a /64 prefix from that, and assign it to the trust interface:</p>
<pre>set interface trust ipv6 mode router
set interface trust ipv6 ip fd61:b452:a23d::1/64
set interface trust ipv6 enable</pre>
<p>Enable IPv6 router advertisements from the trust interface:</p>
<pre>set interface trust ipv6 ra link-address
set interface trust ipv6 ra transmit</pre>
<p>If your MTU is less than 1500 on the untrust side, you should also advertise it on the trust side:</p>
<pre>set interface trust mtu 1472
set interface trust ipv6 ra link-mtu</pre>
<p>At this stage, you should be able to connect a host to the trust side of the 5GT and acquire an IPv6 address from the fd61:b452:a23d::/64 prefix.</p>
<pre>[root@smurfette ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr D0:27:88:65:21:B5  
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fd61:b452:a23d:0:d227:88ff:fe65:21b5/64 Scope:Global
          inet6 addr: fe80::d227:88ff:fe65:21b5/64 Scope:Link</pre>
<p>Now we just need to create a NAT policy for our IPv6 traffic. If you had any existing &#8220;IP any/any&#8221; policies, setting the envar &#8220;ipv6=yes&#8221; should have converted those policies to &#8220;Any-IPv4&#8243; policies. Create a policy for your IPv6 traffic:</p>
<pre>set policy from "Trust" to "Untrust"  "Any-IPv6" "Any-IPv6" "ANY" nat src permit</pre>
<p>At this point, you should be able to ping from your trust-side host to a host on the untrust-side, and beyond:</p>
<pre>[root@smurfette ~]# ping6 2001:470:xxxx:xxxx::1
PING 2001:470:xxxx:xxxx::1(2001:470:xxxx:xxxx::1) 56 data bytes
64 bytes from 2001:470:xxxx:xxxx::1: icmp_seq=1 ttl=63 time=3.48 ms
64 bytes from 2001:470:xxxx:xxxx::1: icmp_seq=2 ttl=63 time=2.52 ms

[root@smurfette ~]# ping6 -n ipv6.google.com
PING ipv6.google.com(2a00:1450:8004::93) 56 data bytes
64 bytes from 2a00:1450:8004::93: icmp_seq=1 ttl=53 time=43.9 ms
64 bytes from 2a00:1450:8004::93: icmp_seq=2 ttl=53 time=44.2 ms</pre>
<p>So there it is&#8230; the 5GT is performing NAT66 on the fd61:b452:a23d::/64 prefix to the globally routable 2001:470:xxxx:xxxx::/64 prefix, using the source address of the egress (untrust) interface. Using this technique, we can connect this 5GT to any IPv6-enabled LAN, and connect hosts behind the safety of our own firewall, whilst still having outbound IPv6 connectivity.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pressure.net.nz/2011/11/configuring-nat66-on-screenos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exporting a X.509 certificate public key from Junos</title>
		<link>http://blog.pressure.net.nz/2010/07/exporting-a-x-509-certificate-public-key-from-junos/</link>
		<comments>http://blog.pressure.net.nz/2010/07/exporting-a-x-509-certificate-public-key-from-junos/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 15:14:08 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Juniper]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://blog.pressure.net.nz/?p=39</guid>
		<description><![CDATA[I&#8217;ve just spent the last couple of hours trying to find a way to export the public key from a locally generated, self-signed X.509 certificate on a Juniper SRX-100 firewall. Apparently there is no Junos CLI command to do this, so after poking around the filesystem from a shell on the box, I found the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just spent the last couple of hours trying to find a way to export the public key from a locally generated, self-signed X.509 certificate on a Juniper SRX-100 firewall. Apparently there is no Junos CLI command to do this, so after poking around the filesystem from a shell on the box, I found the location where Junos stores local certificates and key-pairs.</p>
<p>In the directory <code>/cf/var/db/certs/common</code> you should see at least the following two subdirectories:</p>
<blockquote><p><code>drwx------  2 root  wheel  512 Jul 20 16:14 key-pair<br />
drwx------  2 root  wheel  512 Jul 20 16:16 local</code></p></blockquote>
<p>In the <code>key-pair</code> directory you should see files for each of your key-pairs, eg. <code>self-cert.priv</code>. In the <code>local</code> directory you will find the actual certificates, eg. <code>self-cert.cert</code>. Both the key-pairs and certificates are stored in binary DER format, which can be read by OpenSSL and converted to the more universal base64-encoded PEM format.</p>
<p>Private keys should really be left alone where they are on the Juniper, but you can safely copy the certificate to other locations, since it does not contain any private key material. Simply scp the certificate file to somewhere that has the OpenSSL tools installed, then use &#8220;<code>openssl x509</code>&#8221; to read the certificate:</p>
<blockquote><p><code>daniel@thinkpad:~$ openssl x509 -in self-cert.cert -inform DER<br />
-----BEGIN CERTIFICATE-----<br />
MIIDSDCCAjCgAwIBAgIRAKybOo9tijNXkhgT9fe0ZFMwDQYJKoZIhvcNAQEFBQAw<br />
TzELMAkGA1UEBhMCREUxJTAjBgNVBAoTHFNldmVudGggU2lnbmFsIEx0ZC4gJiBD<br />
.....<br />
co9vOYXqYv81xnIxg5I0brLqCzruKULy4zc6YHzJAGICMOw2wS9BwRkQUR1B2EZH<br />
2QWUSn4Enj2JJkT3p044U8/q4BKdJ9V52mxQfA==<br />
-----END CERTIFICATE-----</code></p></blockquote>
<p>There you have it folks&#8230; a base64-encoded PEM-format public certificate.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pressure.net.nz/2010/07/exporting-a-x-509-certificate-public-key-from-junos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cisco Wireless LAN Controllers and DHCP Option 43</title>
		<link>http://blog.pressure.net.nz/2009/01/cisco-wireless-lan-controllers-and-dhcp-option-43/</link>
		<comments>http://blog.pressure.net.nz/2009/01/cisco-wireless-lan-controllers-and-dhcp-option-43/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 17:47:51 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://blog.pressure.net.nz/?p=19</guid>
		<description><![CDATA[I recently had to install a Cisco Wireless LAN Controller (2112, if you&#8217;re interested), and had the usual fun and games with getting it to properly understand DHCP Option 43. For the uninitiated, option 43 is a vendor specific option, which, in the case of Cisco WLCs, is/are the manager IP address(es) of controllers that [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to install a Cisco Wireless LAN Controller (2112, if you&#8217;re interested), and had the usual fun and games with getting it to properly understand DHCP Option 43. For the uninitiated, option 43 is a vendor specific option, which, in the case of Cisco WLCs, is/are the manager IP address(es) of controllers that LWAPP access points should attempt to join when they boot up.</p>
<p>Different model APs require this option to be in different formats. For example, Aironet 1000 units require the option response to be type 0&#215;66, and a comma-separated ASCII list of controller IP addresses, whereas Aironet 1130, 1200, 1230 and 1240 units require the response to be type 0xF1, followed by the length (number of addresses x four), then the hexadecimal representation of the controller IP address(es).</p>
<p>Cisco <a href="http://www.cisco.com/en/US/tech/tk722/tk809/technologies_configuration_example09186a00808714fe.shtml">documentation exists</a> for this, however their documentation for ISC&#8217;s dhcpd is incorrect. Unlike most corporate customers I run into, who run Microsoft DHCP server (for better or worse), this particular customer was running ISC&#8217;s dhcpd.</p>
<p>The first step is setting the option 43 type. I&#8217;m going to concentrate on the 1130, 1200, 1230 and 1240 units here, since this is the area where Cisco&#8217;s documentation is incorrect. I&#8217;m going to follow Cisco&#8217;s documentation here.</p>
<blockquote><p><code>option space LWAPP;<br />
option LWAPP.controller code 43 = string;</code></p></blockquote>
<p>Then we have a vendor class, for the 1200 series units:</p>
<blockquote><p><code>class "Cisco AP c1200" {<br />
match if option vendor−class−identifier = "Cisco AP c1200";<br />
option vendor−class−identifier "Cisco AP c1200";<br />
vendor−option−space LWAPP;<br />
option LWAPP.controller f1:04:c0:a8:f7:05;<br />
}</code></p></blockquote>
<p>Note the &#8220;f1:04&#8243; at the start of the string. This means type 0xF1, followed by four bytes of vendor specific data. The &#8220;c0:a8:f7:05&#8243; is the hexadecimal representation of the IP address 192.168.247.5. This results in dhcpd transmitting &#8220;2b 08 2b 06 f1 04 c0 a8 f7 05&#8243; for option 43.</p>
<p><a href="http://blog.pressure.net.nz/wp-content/uploads/2009/01/option-43-cap1.png"><img class="aligncenter size-full wp-image-20" title="option 43 capture 1" src="http://blog.pressure.net.nz/wp-content/uploads/2009/01/option-43-cap1.png" alt="" width="612" height="188" /></a></p>
<p>Ok, let&#8217;s take a look at this string. The &#8220;2b&#8221; indicates this is a vendor encapsulated options field (type 43), and &#8220;08&#8243; means it&#8217;s eight bytes long. The next &#8220;2b&#8221; is where things start to go wrong. This is because the Cisco documentation told us to define LWAPP.controller as type 43 also, which is incorrect. The &#8220;06&#8243; indicates that six bytes follow for this sub-code, and then we have our &#8220;f1 04 c0 a8 f7 05&#8243; string verbatim. This causes the WLC to report an error parsing the option 43, saying that it cannot parse &#8220;2b 06 f1 04 c0 a8 f7 05&#8243;.</p>
<p>What we should have configured in dhcpd.conf is actually:</p>
<blockquote><p><code>option space LWAPP;<br />
option LWAPP.controller code 241 = string;</code></p>
<p><code>class "Cisco AP c1200" {<br />
match if option vendor−class−identifier = "Cisco AP c1200";<br />
option vendor−class−identifier "Cisco AP c1200";<br />
vendor−option−space LWAPP;<br />
option LWAPP.controller c0:a8:f7:05;<br />
}</code></p></blockquote>
<p>Note that we also dropped the &#8220;f1:04&#8243; from the hex string, since we are now correctly specifying LWAPP.controller as code 241 (0xF1), and dhcpd automatically populates the &#8220;04&#8243; for us, after counting the length of our hex string (four bytes = one IP address). This results in dhcpd sending &#8220;2b 06 f1 04 c0 a8 f7 05&#8243;.</p>
<p><a href="http://blog.pressure.net.nz/wp-content/uploads/2009/01/option-43-cap2.png"><img class="aligncenter size-full wp-image-23" title="option 43 capture 2" src="http://blog.pressure.net.nz/wp-content/uploads/2009/01/option-43-cap2.png" alt="" width="612" height="188" /></a></p>
<p>Again we have our &#8220;2b&#8221;, indicating vendor encapsulated options, but this time the field is only six bytes long. Then we have &#8220;f1 04&#8243;, indicating our LWAPP.controller code, with four bytes of data &#8211; our controller IP address. This time around, the AP will correctly see the option 43 &#8220;payload&#8221; of just &#8220;f1 04 c0 a8 f7 05&#8243;, and correctly parse the sub-option 0xF1.</p>
<p>Of course, what this field really is (and this is more clearly detailed in Cisco&#8217;s instructions for configuring Microsoft DHCP server), is an array of IP addresses. You can eliminate the need to specify the addresses in hexadecimal by defining the LWAPP.controller as:</p>
<blockquote><p><code>option LWAPP.controller code 241 = array of ip-address;</code></p></blockquote>
<p>and then simply listing your controller IP addresses:</p>
<blockquote><p><code>option LWAPP.controller 192.168.247.5, 192.168.247.6;</code></p></blockquote>
<p>This would result in dhcp server sending &#8220;2b 0a f1 08 c0 a8 f7 05 c0 a8 f7 06&#8243;. Note the &#8220;f1 04&#8243; changed to &#8220;f1 08&#8243;, since the array length is now eight bytes (two IP addresses).</p>
<p>Why Cisco didn&#8217;t simply publish this, is beyond me. They&#8217;ve made it very confusing for users who don&#8217;t understand DHCP vendor specific information. I suspect the person who wrote the dhcpd section of the Cisco documentation didn&#8217;t fully understand how ISC dhcpd handles vendor specific options.</p>
<p>In any case, our configuration can be made somewhat clearer, and consistent with dhcpd&#8217;s documentation, as follows:</p>
<blockquote><p><code>option space LWAPP;<br />
option LWAPP.controller code 241 = array of ip-address;</code></p>
<p><code>class "LWAPP" {<br />
match option vendor-class-identifier;<br />
}</code></p>
<p><code>subclass "LWAPP" "Cisco AP c1200" {<br />
vendor-option-space LWAPP;<br />
option LWAPP.controller 192.168.247.5;<br />
}</code></p></blockquote>
<p>For each additional type of AP you have to support, just add another subclass, using the appropriate vendor class identifier string.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pressure.net.nz/2009/01/cisco-wireless-lan-controllers-and-dhcp-option-43/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Amazing Unmanaged Trunk Mode Switch</title>
		<link>http://blog.pressure.net.nz/2008/11/the-amazing-unmanaged-trunk-mode-switch/</link>
		<comments>http://blog.pressure.net.nz/2008/11/the-amazing-unmanaged-trunk-mode-switch/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 11:43:26 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Juniper]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://blog.pressure.net.nz/?p=18</guid>
		<description><![CDATA[Have you ever needed to set up a bunch of equipment on a boardroom table or some other temporary location, and needed both native and 802.1q tagged VLANs, but only had one available switchport? A quick n&#8217; dirty solution is to use an unmanaged switch, such as one of the numerous 8-port desktop switches from [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to set up a bunch of equipment on a boardroom table or some other temporary location, and needed both native and 802.1q tagged VLANs, but only had one available switchport?</p>
<p>A quick n&#8217; dirty solution is to use an unmanaged switch, such as one of the numerous 8-port desktop switches from manufacturers such as D-Link, Netgear, Linksys etc. Configure its upstream switchport as a trunk port, thus allowing your required VLANs to pass tagged frames to your unmanaged desktop switch.</p>
<p>Wait a second, you say&#8230;. unmanaged switches can&#8217;t do trunk ports. How can an unmanaged switch understand VLAN frames?</p>
<p>It doesn&#8217;t need to. What is an 802.1q tagged frame, other than a standard 802.3 ethernet frame with four additional bytes inserted? These four additional bytes are the 802.1q VLAN ID field and 802.1p CoS field. As long as the unmanaged switch does not truncate frames to the 802.3 standard 1518 bytes, it will happily forward the 1522-byte 802.1q tagged frames just like any other. The last time I encountered a switch that would <strong>not</strong> forward these slightly &#8220;oversized&#8221; frames, was about four years ago&#8230; and it was a very cheap and nasty brand (name withheld to protect the <span style="text-decoration: line-through;">innocent</span> guilty).</p>
<p>This trick also comes in handy when you have a user with a two-port VoIP phone (such as most Cisco, Snom, Polycom etc phones), using a voice-VLAN, and the user requires more switchports than are currently available at his/her desk. Simply connect the 8-port unmanaged switch before the IP phone (ie. to the upstream port), and connect the IP phone to the unmanaged switch. The phone still gets its tagged voice-VLAN frames, the PC gets its untagged data-VLAN frames (tag-stripped if necessary by the IP phone), and the user has 6 other ports available to connect whatever&#8230; including, if necessary, other VLANs (so long as they&#8217;re tagged, and the end device can work with tagged frames, since the unmanaged switch won&#8217;t strip the 802.1q tag).</p>
<p>Beware though, this should only ever be used as a temporary measure, since it does open a few security holes. If the &#8220;allowed VLANs&#8221; is not carefully configured on the upstream port, the opportunity exists to VLAN-hop, or flood traffic into other VLANs. And of course, since the unmanaged switch is, well, unmanaged, there is no individual &#8220;allowed VLANs&#8221; security on those 8 ports. All ports are effectively the same as that one upstream trunk port.</p>
<p>Have you used this method before? What brand/model unmanaged switch did you use? What were your experiences with it, and did you encounter any problems?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pressure.net.nz/2008/11/the-amazing-unmanaged-trunk-mode-switch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

