<?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>Cademuir &#187; Solaris</title>
	<atom:link href="http://www.cademuir.eu/blog/category/solaris/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cademuir.eu/blog</link>
	<description></description>
	<lastBuildDate>Wed, 01 Feb 2012 12:59:34 +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>Setting a static IP address in Solaris 11</title>
		<link>http://www.cademuir.eu/blog/2011/12/08/setting-a-static-ip-address-in-solaris-11/</link>
		<comments>http://www.cademuir.eu/blog/2011/12/08/setting-a-static-ip-address-in-solaris-11/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 11:58:21 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=633</guid>
		<description><![CDATA[I installed a Solaris 11 system yesterday but needed to give it a static IP rather than the dhcp that it picked up by default. Since netoworking has changed in S11 here&#8217;s a guide of what to do. Firstly you need to disable nwam. Check that there are no nwamd process left running. To set [...]]]></description>
			<content:encoded><![CDATA[<p>I installed a Solaris 11 system yesterday but needed to give it a static IP rather than the dhcp that it picked up by default. Since netoworking has changed in S11 here&#8217;s a guide of what to do.</p>
<p>Firstly you need to disable nwam.</p>
<pre class="brush: plain; title: ; notranslate">svcadm disable svc:/network/physical:nwam
svcadm enable svc:/network/physical:default</pre>
<p>Check that there are no nwamd process left running.</p>
<p>To set your address you need to see what interface you have availble. On a typical install that already has a working DHCP interface you can see what is already in use by:</p>
<pre class="brush: plain; title: ; notranslate"># ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
net0/_b           dhcp     ok           12.34.56.78/21
# </pre>
<p>So to set your static IP you would just do:</p>
<pre class="brush: plain; title: ; notranslate"># ipadm create-addr -T static -a 12.34.56.78/21 net0/v4</pre>
<p>However you may notice that this fails:</p>
<pre class="brush: plain; title: ; notranslate"># ipadm create-addr -T static -a 12.34.56.78/21 net0/v4
ipadm: cannot create address: Persistent operation on temporary object</pre>
<p>The issue here is that net0 has been created as a temporary object by the system. Which you can verify by noticing the missing entries on the PERSISTENT column of the output of show-if:</p>
<pre class="brush: plain; title: ; notranslate"># ipadm show-if -o all
IFNAME     CLASS    STATE    ACTIVE CURRENT       PERSISTENT OVER
lo0        loopback ok       yes    -m46-v------  46--       --
net0       ip       down     no     bm46--------  ----       --</pre>
<p>In this case delete and re-create the interface, then set your address:</p>
<pre class="brush: plain; title: ; notranslate"> # ipadm delete-ip net0
# ipadm create-ip net0
# ipadm create-addr -T static -a 12.34.56.78/21 net0/v4</pre>
<p>The last thing you need to do is set your default route which is is done by:</p>
<pre class="brush: plain; title: ; notranslate"># route -p add default 12.34.56.1</pre>
<p>Next you may need to set up your system as a DNS client. This is now done by SMF and not by editing files by hand. To set DNS servers:</p>
<pre class="brush: plain; title: ; notranslate">root@sionnach:/home/albwhite# svccfg -s dns/client
svc:/network/dns/client&gt; listprop config
config                      application
config/value_authorization astring     solaris.smf.value.name-service.dns.client
config/domain              astring     ie.oracle.com
svc:/network/dns/client&gt; setprop config/nameserver = (12.34.56.17 192.168.82.46)
svc:/network/dns/client&gt; listprop config
config                      application
config/value_authorization astring     solaris.smf.value.name-service.dns.client
config/domain              astring     ie.oracle.com
config/nameserver          net_address 12.34.56.17 192.168.82.46
svc:/network/dns/client&gt; exit
root@sionnach:/home/albwhite# svcadm refresh dns/client
root@sionnach:/home/albwhite# svcadm restart dns/client</pre>
<p>Similarly to set the resolv.conf entries you would do:</p>
<pre class="brush: plain; title: ; notranslate">svccfg -s name-service/switch
&gt; setprop config/host = &quot;files dns&quot;</pre>
<p>Official documentation: <a href="http://docs.oracle.com/cd/E23824_01/html/821-1458/gdyrf.html">http://docs.oracle.com/cd/E23824_01/html/821-1458/gdyrf.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2011/12/08/setting-a-static-ip-address-in-solaris-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python : generating unittests on the fly</title>
		<link>http://www.cademuir.eu/blog/2011/10/23/python-generating-unittests-on-the-fly/</link>
		<comments>http://www.cademuir.eu/blog/2011/10/23/python-generating-unittests-on-the-fly/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 01:09:39 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=523</guid>
		<description><![CDATA[When creating python unit tests you need to create a method in a unittest class. The problem however is when you don&#8217;t know until the code is running what these tests will be. In my particular case I need to run a series of tests against a number of Solaris packages. But I won&#8217;t know [...]]]></description>
			<content:encoded><![CDATA[<p>When creating python unit tests you need to create a method in a unittest class. The problem however is when you don&#8217;t know until the code is running what these tests will be. In my particular case I need to run a series of tests against a number of Solaris packages. But I won&#8217;t know what the packages will be in advance.</p>
<p>Thankfully python allows to to add a method to a class on the fly:</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; class test:
...     pass
...
&gt;&gt;&gt; def foo(self):
...     print &quot;hello, world&quot;
...
&gt;&gt;&gt; dir(test)
['__doc__', '__module__']
&gt;&gt;&gt; test.foo=foo
&gt;&gt;&gt; dir(test)
['__doc__', '__module__', 'foo']
&gt;&gt;&gt; bar=test()
&gt;&gt;&gt; bar.foo()
hello, world
&gt;&gt;&gt;
</pre>
<p>Here we initially create an empty class &#8216;test&#8217; and a function &#8216;foo&#8217;. Then add the function &#8216;foo&#8217; to the class &#8216;test&#8217;, so that when we create a &#8216;test&#8217; object, we can call the &#8216;foo&#8217; method in it.</p>
<p>We use the same trick to add a unittest test to a unittest class:</p>
<pre class="brush: python; title: ; notranslate">

&gt;&gt;&gt; import unittest
&gt;&gt;&gt; class mytest(unittest.TestCase):
...     pass
...
&gt;&gt;&gt; def test_testcase(self):
...     self.assertEqual(&quot;hello&quot;,&quot;hello&quot;)
...
&gt;&gt;&gt; suite = unittest.TestLoader().loadTestsFromTestCase(mytest)
&gt;&gt;&gt; unittest.TextTestRunner(verbosity=2).run(suite)

----------------------------------------------------------------------
Ran 0 tests in 0.015s

OK
&lt;unittest.runner.TextTestResult run=0 errors=0 failures=0&gt;
&gt;&gt;&gt; mytest.test_testcase=test_testcase
&gt;&gt;&gt; unittest.TextTestRunner(verbosity=2).run(suite)

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
&lt;unittest.runner.TextTestResult run=0 errors=0 failures=0&gt;
&gt;&gt;&gt; suite = unittest.TestLoader().loadTestsFromTestCase(mytest)
&gt;&gt;&gt; unittest.TextTestRunner(verbosity=2).run(suite)
test_testcase (__main__.mytest) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
&lt;unittest.runner.TextTestResult run=1 errors=0 failures=0&gt;
&gt;&gt;&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2011/10/23/python-generating-unittests-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: Searching for a string within a list &#8211; List comprehension</title>
		<link>http://www.cademuir.eu/blog/2011/10/20/python-searching-for-a-string-within-a-list-list-comprehension/</link>
		<comments>http://www.cademuir.eu/blog/2011/10/20/python-searching-for-a-string-within-a-list-list-comprehension/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 23:38:39 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=509</guid>
		<description><![CDATA[The simple way to search for a string in a list is just to use &#8216;if string in list&#8217;. eg: But what if you need to search for just &#8216;cat&#8217; or some other regular expression and return a list of the list items that match, or a list of selected parts of list items that [...]]]></description>
			<content:encoded><![CDATA[<p>The simple way to search for a string in a list is just to use &#8216;if string in list&#8217;. eg:</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; list=['a cat','a dog','a yacht']
&gt;&gt;&gt; string='a cat'
&gt;&gt;&gt; if string in list:
...     print 'found a cat!'
...
found a cat!
&gt;&gt;&gt;
</pre>
<p>But what if you need to search for just &#8216;cat&#8217; or some other regular expression and return a list of the list items that match, or a list of selected parts of list items that match.<br />
Then you need list comprehension.</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; import re
&gt;&gt;&gt; list=['a cat','a dog','a yacht','cats']
&gt;&gt;&gt; regex=re.compile(&quot;.*(cat).*&quot;)
&gt;&gt;&gt; [m.group(0) for l in list for m in [regex.search(l)] if m]
['a cat', 'cats']
&gt;&gt;&gt; [m.group(1) for l in list for m in [regex.search(l)] if m]
['cat', 'cat']
&gt;&gt;&gt;
</pre>
<p>Lets work through that. Firstly we&#8217;re going to use the <a href="http://docs.python.org/library/re.html">regular expression library so</a> we import that. <a href="http://docs.python.org/library/re.html#re.compile">re.compile</a> lets us create a regular expression that we can later use for search and matching. </p>
<p>Now lets look at a simpler comprehension line:</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; [m for l in list for m in [regex.search(l)]]
[&lt;_sre.SRE_Match object at 0x10cfbb0a8&gt;, None, None, &lt;_sre.SRE_Match object at 0x10cfbb6c0&gt;]
</pre>
<p>This is creating a list of the results of running regex.search() on each item in l.  </p>
<p>Next we want to exclude the None values. So we use an if statement to only include the not None values:</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; [m for l in list for m in [regex.search(l)] if m ]
[&lt;_sre.SRE_Match object at 0x10cfbb6c0&gt;, &lt;_sre.SRE_Match object at 0x10cfd0be8&gt;]
&gt;&gt;&gt;
</pre>
<p>Lastly rather than returning just a list of the m&#8217;s, which are RE match objects, we get the information we want from them.</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; [m.group(0) for l in list for m in [regex.search(l)] if m]
['a cat', 'cats']
&gt;&gt;&gt; [m.group(1) for l in list for m in [regex.search(l)] if m]
['cat', 'cat']
&gt;&gt;&gt;
</pre>
<p>Very useful if you have say a list of Solaris 11 package fmri&#8217;s and want to extract a set of package names based on a regular expression of their version number for instance <img src='http://www.cademuir.eu/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2011/10/20/python-searching-for-a-string-within-a-list-list-comprehension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Booting different boot environments on SPARC</title>
		<link>http://www.cademuir.eu/blog/2011/06/08/booting-different-boot-environments-on-sparc/</link>
		<comments>http://www.cademuir.eu/blog/2011/06/08/booting-different-boot-environments-on-sparc/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 13:19:05 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[Solaris]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=460</guid>
		<description><![CDATA[&#8216;boot -L&#8217; will give you the list of boot environments to boot from. So then you can just use the -Z option to boot the corresponding root fs. Handy when you screw up boot environment activation On x86 you can just select the be you want in grub.]]></description>
			<content:encoded><![CDATA[<p>&#8216;boot -L&#8217; will give you the list of boot environments to boot from. So then you can just use the -Z option to boot the corresponding root fs.</p>
<p>Handy when you screw up boot environment activation <img src='http://www.cademuir.eu/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>On x86 you can just select the be you want in grub.</p>
<pre class="brush: plain; title: ; notranslate">
{0} ok boot -L
Boot device: /pci@400/pci@0/pci@8/scsi@0/disk@0,0:a  File and args: -L
1 Oracle Solaris
2 solaris-1
Select environment to boot: [ 1 - 2 ]: 2

To boot the selected entry, invoke:
boot &lt;root-device&gt; -Z rpool/ROOT/solaris-1

Program terminated
{0} ok boot /pci@400/pci@0/pci@8/scsi@0/disk@0,0:a -Z rpool/ROOT/solaris-1
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2011/06/08/booting-different-boot-environments-on-sparc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tonidoplug Power Supply failure</title>
		<link>http://www.cademuir.eu/blog/2011/05/21/tonidoplug-power-supply-failure/</link>
		<comments>http://www.cademuir.eu/blog/2011/05/21/tonidoplug-power-supply-failure/#comments</comments>
		<pubDate>Sat, 21 May 2011 16:14:20 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[Solaris]]></category>
		<category><![CDATA[codelathe]]></category>
		<category><![CDATA[sheevaplug]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[tonido]]></category>
		<category><![CDATA[tonidoplug]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=428</guid>
		<description><![CDATA[I&#8217;ve been using my tonidoplug as a home NAS server for almost a couple of years now. It&#8217;s performed as well as can be expected for 2 mirrored 1.5TB disks attached on a USB hub. One evening recently though I noticed that it was unreachable. A quick look at the box showed that all was [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using my <a href="http://www.tonidoplug.com/">tonidoplug </a> as a home NAS server for almost a couple of years now. It&#8217;s performed as well as can be expected for 2 mirrored 1.5TB disks attached on a USB hub.</p>
<p>One evening recently though I noticed that it was unreachable. A quick look at the box showed that all was not well, both lights on the network interface were on as was the green light on the box. After trying to reflash the unit I contacted support but they would not replace a nearly 2 year old unit. Though to be fair to them they did offer to sell me a replacement at a discount.</p>
<p>So with the unit dead and no chance of a replacement the &#8216;void if removed&#8217; sticker was quickly discarded. Here&#8217;s the box in its faulted state with the LEDs on:</p>
<p style="text-align: left;"><a href="http://www.cademuir.eu/blog/wp-content/uploads/2011/05/IMAG0193.jpg"><img class="aligncenter size-full wp-image-429" title="IMAG0193" src="http://www.cademuir.eu/blog/wp-content/uploads/2011/05/IMAG0193.jpg" alt="" width="560" height="375" /></a>From experience the most likely thing to die in electronics is the power supply. It clearly isn&#8217;t dead here since the lights come on, but a quick check of the outputs with a multimeter showed that what should have been a +5V output was actually +2.5V. Luckily I have a sheevaplug that I use for another home project that uses an equivalent power supply so after a quick swap the Tonido was booting again.</p>
<p>Looking a plug computer forums it appears that there are <a title="known issues" href="http://http://plugcomputer.org/plugforum/index.php?topic=1318.0">known issues </a>with some of these power supplies. The Tonidos original power supply was contained in a metal box, as was the original sheevaplug ones that are mentioned in the forums, but my sheevaplug has the circuit board glued to the case with protective black plastic around it. Whether that is to try to reduce the heat build up I can&#8217;t say.</p>
<p style="text-align: center;"><a href="http://www.cademuir.eu/blog/wp-content/uploads/2011/05/IMAG0194.jpg"><img class="aligncenter size-full wp-image-430" title="IMAG0194" src="http://www.cademuir.eu/blog/wp-content/uploads/2011/05/IMAG0194.jpg" alt="" width="560" height="344" /></a></p>
<p>Anyway the unit powered back up and the disks and mirror seem to be working fine.</p>
<pre class="brush: bash; title: ; notranslate">
root@TonidoPlug:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[1]
1465135936 blocks [2/2] [UU]

unused devices:
root@TonidoPlug:~#
</pre>
<p>This does mean that my plans to build a mini-ITX Atom based Solaris ZFS NAS box are now on hold. But at least so are my plans to spend about €500 on it when I can just by a £20 power supply to fix what I have!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2011/05/21/tonidoplug-power-supply-failure/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using NAT with Zones</title>
		<link>http://www.cademuir.eu/blog/2011/03/22/using-nat-with-zones/</link>
		<comments>http://www.cademuir.eu/blog/2011/03/22/using-nat-with-zones/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 12:50:12 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[ipfilter]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[zones]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=383</guid>
		<description><![CDATA[This post originally appeared at http://blogs.sun.com/ford/entry/using_nat_in_the_global Since sun.com is going away soon (thank a bunch Oracle&#8230;) I&#8217;m going to mirror it here because I found it useful. Tuesday September 27, 2005 Using NAT in the Global Zone There have been requests to use IPFilter on Solaris 10 as a tool to allow use of networking [...]]]></description>
			<content:encoded><![CDATA[<p>This post originally appeared at http://blogs.sun.com/ford/entry/using_nat_in_the_global</p>
<p>Since sun.com is going away soon (thank a bunch Oracle&#8230;) I&#8217;m going to mirror it here because I found it useful.</p>
<div><a href="http://blogs.sun.com/ford/date/20050927"><img title="Permanent link to this day" src="http://blogs.sun.com/images/permalink.gif" alt="20050927" /></a> Tuesday September 27, 2005</div>
<p><a id="using_nat_in_the_global" name="using_nat_in_the_global"></a> <strong>Using NAT in the Global Zone</strong></p>
<p>There have been requests to use <a href="http://docs.sun.com/app/docs/doc/816-5175/6mbba7f16?a=view">IPFilter</a> on Solaris 10 as a tool to allow use of networking by <a href="http://docs.sun.com/app/docs/doc/816-5175/6mbba7f4t?a=view">non-global zones</a> without allocating an IP address for each zone.  The general idea is to use <a href="http://en.wikipedia.org/wiki/NAT">network address translation (NAT)</a> so that packets sent from a non-global zone configured with only a private IP address are modified before leaving the machine to use the global zone&#8217;s public IP address.  Each zone will be assigned a private IP address that will never be used &#8220;on the wire&#8221; and has no meaning in the public internet.</p>
<p>I set out to see if this can be accomplished with the existing IPFilter implementation in Solaris 10. My experiments showed that it is possible with some unorthodox system configuration hacks.  Special configuration of IP is needed to trick the system into sending this traffic through the right paths so that it is</p>
<ul>
<li>allowed by the zones networking restrictions,</li>
<li>passes through IPFilter,</li>
<li>is transmitted on the correct interface, and</li>
<li>ultimately reaches the proper next-hop router.</li>
</ul>
<p>My experiment was done using a Solaris 10 (FCS) system with only a DHCP-based connection to the net.  My physical network interface was bge0.</p>
<p>This technique requires the use of a block of private IP addresses expressible as an address prefix.  I refer to this block as the &#8220;imaginary network.&#8221;  For my experiment I chose 10.10.10.0/24.  Two special addresses in the block are allocated:  one for the global zone (I chose 10.10.10.1) and one for the imaginary router (I chose 10.10.10.254).  It is assumed that the all-zeroes and all-ones node addresses, 10.10.10.0 and 10.10.10.255, are unusable.  All other addresses in the block are available for assignment to non-gobal zones (each zone will need one address).</p>
<p>The configuration steps were:</p>
<p>(0) Configure the system (global zone) with normal networking connectivity.</p>
<p>(1) Enable IPFilter.</p>
<pre class="brush: plain; title: ; notranslate">  ed /etc/ipf/pfil.ap
	/bge/s/#//
	w
	q
	svcadm enable svc:/network/ipfilter
	shutdown -y -i6 -g0</pre>
<p>(2) Configure NAT</p>
<pre class="brush: plain; title: ; notranslate">	echo &quot;map bge0 10.10.10.0/24 -&amp;gt; 0&quot; | ipnat -f -</pre>
<p>(3) Assign the global zone&#8217;s imaginary address to the physical interface:</p>
<pre class="brush: plain; title: ; notranslate">ifconfig bge0 addif 10.10.10.1/24 up</pre>
<p>(4) Add a default route to the imaginary router.</p>
<pre class="brush: plain; title: ; notranslate">route  add default 10.10.10.254</pre>
<p>(5) Create a fake ARP entry for the imaginary router using the real router&#8217;s     MAC address.</p>
<pre class="brush: plain; title: ; notranslate">
	netstat -r | grep default
	arp therouter.my.org			# Look up the real router.
	arp -s 10.10.10.254 0:0:c:7:ac:6c	# Use the imaginary router's
						# IP address and the real
						# router's MAC address.</pre>
<p>(6) Create one (or more) zone(s) with the same physical net interface as     the global zone&#8217;s physical interface, and an address on the imaginary     network.</p>
<pre class="brush: plain; title: ; notranslate">zonecfg -z neutral
	...
	add net
	set address=10.10.10.2/24	# a different address for each zone
	set physical=bge0
	end
	commit
	exit</pre>
<p>(7) Boot and use the zone(s).</p>
<p>I have only done light testing.  Of course it only works with things for which NAT works.  If you do something wrong, like forget to enable IPFilter or fail to create the fake ARP entry, you will probably be sending strange packets onto your LAN and network admins may hunt you down and give you dirty looks. The sample commands I list above were typed into this document and may have typos or be rough approximations.  Some of the example commands are not persistent across reboot and require other steps to store them persistently. My experiment was on a single user system with simple network connectivity; in a more complex environment the steps to configure it would be very different and it may not work at all.</p>
<p>Conclusion:  The technique I used is a hack.  I think using it in a production system should be viewed with suspicion, not just because NAT is inherently dubious, but also because of the complex dependencies of the various bits of configuration that are required to make it work.  But no doubt it can be useful as an interim technique for some users or applications and maybe a more polished form of the underlying technique can be added to the zones networking tool set eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2011/03/22/using-nat-with-zones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strange little NFS problem</title>
		<link>http://www.cademuir.eu/blog/2010/09/22/strange-little-nfs-problem/</link>
		<comments>http://www.cademuir.eu/blog/2010/09/22/strange-little-nfs-problem/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 22:08:29 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[Solaris]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[rpcbind]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=250</guid>
		<description><![CDATA[I came across a strange little networking problem earlier today. The client in question had needed to be rebooted earlier in the day. The server had had no changes made to it. The problem only started occurring after the reboot of the client. We had an NFS directory on the server that the client&#8217;s subnet [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a strange little networking problem earlier today.</p>
<p>The client in question had needed to be rebooted earlier in the day. The server had had no changes made to it. The problem only started occurring after the reboot of the client.</p>
<p>We had an NFS directory on the server that the client&#8217;s subnet had access to. However when we tried to mount the directory (via the automounter) it failed with a permission denied error. I should point out at this stage that the client is multihomed, that it it has several network interfaces onto different subnets and only one of these was allowed to access the share.</p>
<p>A little snooping showed that while the requests were mostly going out from the correct interface, some packets were coming out on an interface for another subnet. This shouldn&#8217;t occur since there is only one route packets can take out and its through the default router on the main interfaces subnet. It turns out however that we have 3 default routers on this machine &#8211; all active. This is likley a remnant of how the machine was installed, we copy in a defaultrouter file with multiple entries and since hosts usually only have one interface the rest get ignored. In the case of this system though the interface had been manually added over time and the routes were not activated, until the reboot then they all became active.</p>
<p>This meant that the system had 3 interfaces to contact the server on, but that the server would only authorise one of these interfaces. Since the interfaces had routes to the server the portmapper (rpcbind) was happily mapping ports on interfaces that we&#8217;d rather it didn&#8217;t.</p>
<p>Delete the routes, and delete the defaultrouter entries, restart rpcbind, and all works again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2010/09/22/strange-little-nfs-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote X displays</title>
		<link>http://www.cademuir.eu/blog/2010/06/18/remote-x-displays/</link>
		<comments>http://www.cademuir.eu/blog/2010/06/18/remote-x-displays/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 10:16:17 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[Solaris]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[X]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=217</guid>
		<description><![CDATA[Another &#8216;damn! I keep forgetting how to do that!&#8217; post&#8230; When you want to display something from one unix box to another there are two ways of doing it. 1. Use ssh. You need to use &#8216;ssh -X&#8217; specifically which will allow X11 forwarding. ssh takes care of setting the DISPLAY variable for you. You [...]]]></description>
			<content:encoded><![CDATA[<p>Another &#8216;damn! I keep forgetting how to do that!&#8217; post&#8230;</p>
<p>When you want to display something from one unix box to another there are two ways of doing it.<br />
1. Use ssh. You need to use &#8216;ssh -X&#8217; specifically which will allow X11 forwarding. ssh takes care of setting the DISPLAY variable for you. You also need to ensure that the server is configured for X forwarding:</p>
<pre class="brush: php; title: ; notranslate"># X11 tunneling options
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes</pre>
<p>This just works if you are a regular user, but if you need to display something as another user then you run into problems. For example you may need to run a gui installer that can only run as root.<br />
So heres how to get it to work as root.<br />
Firstly, as your normal user get your DISPLAY variable and the corresponding xauth entry. This can be a little tricky</p>
<pre class="brush: php; title: ; notranslate">$ echo $DISPLAY
localhost:10.0</pre>
<p>Now search the xauth list for the corresponding entry. If you got localhost above, then search for the actual hostname. On some systems &#8216;xauth list $DISPLAY&#8217; may work fine, others you&#8217;ll need to search:</p>
<pre class="brush: php; title: ; notranslate">$ xauth list|grep :10|grep server
server/unix:10  MIT-MAGIC-COOKIE-1  99410f7406b0f93e6117ae55a72a7eca</pre>
<p>Next become the root user, or whatever user you need to be.<br />
Set the display variable and add the xauth entry:</p>
<pre class="brush: php; title: ; notranslate"># DISPLAY=localhost:10
# export DISPLAY
# xauth add server/unix:10  MIT-MAGIC-COOKIE-1  99410f7406b0f93e6117ae55a72a7eca</pre>
<p>You should now be able to fire up an xterm on the system as the new user and it will appear on your desktop.</p>
<p>2. Use xhosts. This is the more traditional way, but does have a gotcha for newer versions of solaris, which are more secure than previously.<br />
On your desktop do:</p>
<pre class="brush: php; title: ; notranslate">$ xhost +
access control disabled, clients can connect from any host
$ echo $DISPLAY
:0.0
</pre>
<p>Now log onto the remote system and set the display variable and try an xterm. It will probably fail:</p>
<pre class="brush: php; title: ; notranslate">$ DISPLAY=desktop:0.0
$ export DISPLAY
$ xterm
xterm Xt error: Can't open display: desktop:0.0
$ </pre>
<p>Whats happening here is that although you have allowed the xserver access control to accept connections from any host, the X server itself isnt actually listening for connections. To change that you need to do the following on your desktop:</p>
<pre class="brush: php; title: ; notranslate"> svccfg -s svc:/application/x11/x11-server setprop options/tcp_listen = true </pre>
<p>Then restart the Xserver.<br />
This method will work for all users, so you can log in, become root, then just set your display.</p>
<p>3 ok there are alternative methods if you are really stuck. For example start up a VNC session on the server and view it on your desktop. Though thats only worth doing if you need someone else to be able to view what you are doing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2010/06/18/remote-x-displays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EFI and SUN Disk Labels</title>
		<link>http://www.cademuir.eu/blog/2010/06/18/efi-and-sun-disk-labels/</link>
		<comments>http://www.cademuir.eu/blog/2010/06/18/efi-and-sun-disk-labels/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 09:21:56 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[Solaris]]></category>
		<category><![CDATA[disks]]></category>
		<category><![CDATA[jumpstart]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=213</guid>
		<description><![CDATA[Every now and again an install on a new machine fails for me and I have to google to remember how to change the label. So this time I&#8217;m writing it down! Docs.sun.com has some information on the differences between the two formats http://docs.sun.com/app/docs/doc/817-5093/disksconcepts-47761?l=en&#38;a=view But suffice to say that you cant install Solaris on an [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and again an install on a new machine fails for me and I have to google to remember how to change the label. So this time I&#8217;m writing it down!</p>
<p>Docs.sun.com has some information on the differences between the two formats http://docs.sun.com/app/docs/doc/817-5093/disksconcepts-47761?l=en&amp;a=view</p>
<p>But suffice to say that you cant install Solaris on an EFI disk, you need to change it to an SMI label. Thats done using &#8216;format -e&#8217;.</p>
<p>Select the label option, and then SMI Label. Once you have done that you can check the partition table as normal and your install can progress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2010/06/18/efi-and-sun-disk-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading Opensoalris Guests and Virtualbox</title>
		<link>http://www.cademuir.eu/blog/2010/02/17/upgrading-opensoalris-guests-and-virtualbox/</link>
		<comments>http://www.cademuir.eu/blog/2010/02/17/upgrading-opensoalris-guests-and-virtualbox/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 13:37:03 +0000</pubDate>
		<dc:creator>albertw</dc:creator>
				<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://www.cademuir.eu/blog/?p=80</guid>
		<description><![CDATA[At Home I run windows 7 on my laptop. And in order to run Opensolaris I use virtualbox. Virtualbox in case you dont know about it basically allows you to run an operating system within your main OS. You can also run windows on an opensolaris machine for example. I had fallen behind a bit [...]]]></description>
			<content:encoded><![CDATA[<p>At Home I run windows 7 on my laptop. And in order to run Opensolaris I use <a href="http://www.virtualbox.org/">virtualbox</a>. Virtualbox in case you dont know about it basically allows you to run an operating system within your main OS. You can also run windows on an opensolaris machine for example.<br />
I had fallen behind a bit with my virtualbox and opensolaris versions so decided to upgrade everything over the past couple of days. First I upgraded virtualbox to 3.1.4 then Opensolaris to build 132. And my graphical login failed to work. Here&#8217;s the error from the X log:</p>
<blockquote><p>(II) LoadModule: &#8220;vboxvideo&#8221;<br />
(II) Loading /usr/X11/lib/modules/drivers/vboxvideo_drv.so<br />
dlopen: ld.so.1: Xorg: fatal: relocation error: file /usr/X11/lib/modules/drivers/vboxvideo_drv.so: symbol resVgaShared: referenced symbol not found<br />
(EE) Failed to load /usr/X11/lib/modules/drivers/vboxvideo_drv.so<br />
(II) UnloadModule: &#8220;vboxvideo&#8221;<br />
(EE) Failed to load module &#8220;vboxvideo&#8221; (loader failed, 7)
</p></blockquote>
<p><a href="http://blogs.sun.com/alanc/">Alan Coopersmith</a> helped me work out what was going wrong here. When you install the guest additions on virtualbox they create an xorg.conf file. The existing conf file I had from build 127 and VB 3.1.1 worked fine, and build 127 with vb 3.1.4 worked fine. But due to changes around Xorg 1.7 things broke when I upgraded opensolaris to build 132 &#8211; even though virtualbox has support for this.</p>
<p>The solution?</p>
<ul>
<li>Remove the guest additions package.</li>
<li>Remove the xorg.conf file</li>
<li>Re-install the guest additions</li>
<li>Reboot</li>
</ul>
<p>All works fine now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cademuir.eu/blog/2010/02/17/upgrading-opensoalris-guests-and-virtualbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

