I had to modify the newtork configuration of a solaris 10 host. Below, some commands and files I used/needed. This post is mostly a reminder of bulk list of commands

  • Mother of all network related command : ifconfig


  • Display the routing table : netstat -nr


  • Display open sockets, network connexions : lsof -i -n. This command is not inclueded in a standard installation, but can be obtained from solaris freeware.


  • Add/Remove a permanent route : route -p

  • Default route : cat /etc/defaultrouter


  • Name resolution (aka DNS) :
    • Check /etc/resolv.conf for correct dns addresses.

    • Check that file /etc/nsswitch.conf contains a line with hosts: files dns


  • Change an ip address :
    • Check the file /etc/hostname.interface for the hostname

    • Edit /etc/hosts and change the IP address
    • If the IP is subnetted with a weird netmask, add the wanted netmask to /etc/inet/netmasks

    • Restart the network by svcadm restart network/physical

  • Do not restart the network using a network connexion like ssh
  • Always check for the avilaibility of an alternate access to the host such as rsc, ilo or elom before changing network configuration.
    • Do not bite the hand that feeds you.


  • Configure network interfaces : dladm

    • Display interfaces : dladm show-dev

    • Display links : dladm show-links

    • Display aggregations : dladm show-aggreg


  • Firewalling:
    • Status : ipfstatus
    • Display input/output rule set : ipfstatus -i or ipfstatus -o

    • Monitoring firewall in real time : ipmon


  • IP Forwarding configuration : routeadm


  • List/Configure network services based on inet: inetadm


  • Capture and display network traffic : snoop


  • Display/Modify network driver parameters : ndd



I had to migrate a running Solaris Zone (let's call it myZone) from host A to host B. The 2 hosts and the zone didn't have the same patches and packages. Making the zone running on host B was quite painfull. Follows how I did proceed (use it at your own risk).

  • On the source host (host A) :

    1. Copy the zone filesystem (the zone path) to the host B. Copy the file /etc/zones/myZone.xml to the host B's /tmp folder.

  • On the destination host (host B) :

    1. Attach the zone by issuing the command zoneadm attach -F -n /tmp/zoneName.xml 2>&1. This command will return packages and patches not matching the host B. Those lists are preceded by These packages installed on this system were not installed on the source system: for packages and These patches installed on this system were not installed on the source system: for patches.

    2. Add all the patches listed to the file /usr/lib/brand/native/bad_patches. After adding the pataches to the, reissuing the previous command should not complain about the missing pataches.

    3. Edit the file /etc/zones/index and add myZone:configured:zonePath: at the end of the file.

    4. Move the /tmp/zoneName.xml to /etc/zones/myZone.xml.

    5. Attach the zone using zoneadm -z myZone attach -u.

    6. Boot the by zoneadm -z zoneName boot. It should boot. If not, the config (network interface, mount points) should be adopted.

  • Once, the container has been successfully booted, the lines added to the file /usr/lib/brand/native/bad_patches on the host should be removed


  • I had to install DBD::mysql for monitoring mysql replication status using check_replication.pl plugin for nagios.
    Unfortunately, perl package included with solaris 10 is a 32 Bit binary and we're using Mysql 64 bit mysql package on our server. So, the build process was a bit complex. Follows a step by step guide for building DBD::mysql under solaris 10.

  • Download and install 32 Bit Mysql binaries and libs (even if you have 64 bits binaires and libs, 32 bits libs are required).

  • Download and install gcc with its dependencies and its friends (make, ldd) for solaris 10 from sun freeware.

  • Begin the installation of DBD::mysql via perl -MCPAN -e 'reinstall DBD::mysql' . This step will end with the errors.

    •       gcc: unrecognized option `-KPIC'
            cc1: error: invalid option `t'
            cc1: error: invalid option `t'
            make: *** [dbdimp.o] Error 1
            /usr/local/bin/make  -- NOT OK
  • Change the directory to cpan temporary build directory usin the cd command. The build directory can be displayed via echo "o conf" | perl -MCPAN -e shell | grep build_dir

  • Under the build directory, one should see a directory named DBD-mysql-???. This directory contains all the source files for building DBD::mysql

  • Recreate the makefile using the command /usr/bin/perl Makefile.PL --with-mysql=/path/to/mysql32 --mysql_config=/path/to/mysql32/bin/mysql_config. This step should finish without errors. If it ends with errors, recheck if mysql 32 bit, gcc and friends are correctly installed.

  • Edit the file Makefile, replace xarch=sparc by mcpu=v9 and CC=ld by CC=gcc.

  • Start the compliation by make.

    • If it stops with the message
              /bin/sh: cc: not found
              make: *** [dbdimp.o] Error 1

      then edit the file Makefile and replace CC=cc by CC=gcc

  • Restart the compliation by make.

    • If it stops with the message
                gcc: unrecognized option `-KPIC'`

      then edit the file Makefile, and remove -KPIC option on the line starting with CCCDLFLAGS =)

    • If it stops with the message
                gcc: language ildoff not recognized
                gcc: language space not recognized
                gcc: language O3 not recognized

      then edit the file Makefile and remove -xO3, -xspace and -xildoff options on the line starting with OPTIMIZE =.

    • If it stops with the message
                gcc: language arch=v8 not recognized
         

      then edit the file Makefile, and replace xarch=v8 by m32 on the line starting with CCFLAGS =

    • If it stops with the message
                cc1: error: invalid option `t'

      then edit the file Makefile, and remove the option -mt on the line statring with INC =

  • Once the build process is complete, install the built binaries by make install

    After the installation, the nagios' replication check plugin should be usable.


Récemment, j'ai été amené à valider les dépendences des ressources au sein d'un Cluster Sun afin d'en vérifier la cohérence. Lors que je me suis collé, je n'ai pas trouvé d'outil simple permettant de grapher les relations entre chaque ressource. J'ai, donc, décidé mettre au point script shell simple pour générer un graphique permettant de visualiser simplement. Le script génère un fichier compatible graphviz. Une fois le fichier .dot généré, la commande dot -Tpng -o graph.png file.dot permet de créer le graphique au format png.

Un petit graphique valant mieux qu'un long texte, voilà le résultat:

media/entries/2011/GraphiqueDeDependenceDesRessourcesSunCluster/rs-dep.png

source au format dot pour générer le graphique.

script shell permmettant creer le fichier .dot.