viernes, 18 de septiembre de 2009

Coleccion de procedimientos dentro del grupo Solaris-ES

http://groups.google.es/group/solaris-es/files?hl=es


Mariano

Tomar un Backup Online de un File System utilizando fssnap o UFSdump

1. Creamos el Snapshoot del FS (Verificar si hay espacio suficiente para la imagen)
        # fssnap -F ufs -o bs=/soft/root.snap /

2. Creamos el punto de montaje del snap
        # mkdir /soft/rootfs

3. Montamos el snapshoot
        # mount -F ufs -o ro /dev/fssnap/0 /soft/rootfs

4. Tomar el backup
        # cd /soft/rootfs/
        # tar cvf /dev/rmt/0 .

5. Desmontar el FS y borrar el snapshoot
        # umount /soft/rootfs/
        # rm /soft/root.snap
        # fssnap -d /



Para realizar este backup con UFSdump podemos realizar:

1. Creamos el Snapshoot del FS (Verificar si hay espacio suficiente para la imagen)
        # fssnap -F ufs -o bs=/soft/root.snap /

2. Tomamos el backup con UFSDUMP
        # ufsdump 0cuf /dev/rmt/0 /dev/rfssnap/0
        Nota: rfssnap -> RAW Device
              fssnap  -> Block Device

3. Borrar el snapshoot
        # rm /soft/root.snap
        # fssnap -d /

Mariano,

Agregar SWAP en solaris / Adding a Swap File on Solaris

Si se tiene solaris y es necesario agregar SWAP al equipo y no hay mas espacio disponible en el sistema, este es un procedimiento rapido sumar swap al sistema.

1. Usar el mkfile para crear un archivo del tamaño del swap que queremos incorporar y asi poder añadirlo al sistema. Por ejemplo vamos a crear un archivo de 1GB para incrementar el swap:

          # /usr/sbin/mkfile 1024m /swap

Donde /swap es el nombre del archivo que se utilizara en el espacio de swap. Las unidades posibles para utilizar son kilobytes (k), bloques (b), o megabytes (m).

2. Vamos a decirle al sistema que comience a utilizar el archivo de swap que creamos:

          # /usr/sbin/swap -a /swap

Para verificar que se añadio correctamente el SWAP en el equipo lo verificamos con el comando swap -l.

IMPORTANTE:  Esta operatoria es momentanea y manual, despues de un reboot el equipo inicia de manera normal, con lo cual tendriamos que pensar en dos cosas, planificar el agregar mas swap incorporando otro disco o dejar permanentemente en el /etc/vfstab la incorporacion del archivo /swap.

SalU2,

Mariano.

Análisis de la memoria libre utilizando el SAR y el VMSTAT

VMSTAT (memory  Report on usage of virtual and real memory.)
    swap    amount of swap space currently available (Kbytes)
    free    size of the free list (Kbytes)

Esto quiere decir que el 'free0 es la cantidad de memoria RAM libre en kilobytes.

Ej.:

root@consola # vmstat 2 2
 procs     memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr dd f0 s0 --   in   sy   cs us sy id
 0 0 0 416184 72464  58 262 108 2  2  0  0 14  0  0  0  272  351  248 10  6 84
 0 0 0 361808 59088  45 237  0  0  0  0  0  0  0  0  0  313 4843  284 26  5 69

SAR

$ man sar
     -r Report unused memory pages and disk blocks:
          freemem     average pages available to user processes.
          freeswap     disk blocks available for page swapping.

La cantidad de memoria RAM libre en paginas es informada por el SAR -r, el tamanio de pagina utilizada se puede ver ejecutando el comando 'pagesize' generalmente es de 8k.

Ej.:

root@consola # sar -r 2 2

SunOS consola 5.8 Generic_117350-18 sun4u    06/28/06

10:22:21 freemem freeswap
10:22:23    7060   716848
10:22:25    7094   720432

Average     7077   718635

root@consola # pagesize
8192

root@consola # echo "7094 * 8" | bc
56752   <-- Memoria ram libre en K

y este valor es muy similar al reportado por el VMSTAT

root@consola # vmstat 2 2
 procs     memory            page            disk          faults     cpu
 r b w   swap  free  re  mf pi po fr de sr dd f0 s0 --   in   sy   cs us sy id
 0 0 0 416184 72464  58 262 108 2  2  0  0 14  0  0  0  272  351  248 10  6 84
 0 0 0 361808 59088  45 237  0  0  0  0  0  0  0  0  0  313 4843  284 26  5 69

Mariano Obarrio

Expandir un File Systems utilizando SVM y growfs

1. Realizar un backup de los datos

2. Verificar el tamaño del File System
                # df -k /filesystem

3. Verificar el tamaño del metadevice
                # metastat -s [diskgroup] d611 |grep Size

4. Expandir el metadevice.
                # metattach -s [diskgroup] d611 20g

5. Hacer crecer el file system.
                # growfs -M /filesystem /dev/md/[diskgroup]/rdsk/d611

6. Verificar el tamaño del File System
                # df -k /filesystem

7. Verificar el tamaño del metadevice
                # metastat -s [diskgroup] d611 |grep Size

Nota 1: Si el file system no esta montado, la opción -M no es requerida.

Nota 2: Si el comando growfs es abortado, para recuperar cualquier espacio perdido se tendrá que desmontar el FS y ejecutar un fsck o volver a ejecutar el comando growfs.

SalU2,

Mariano Obarrio

Como realizar una copia de discos via "dd"

Ejemplo del procedimiento

         # touch /reconfigure
         # init 0
         ok boot
         # dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t2d0s2 bs=128k
         # fsck /dev/rdsk/c0t2d0s2
         # mount /dev/dsk/c0t2d0s2 /mnt
         # cd /mnt/etc
         # vi vfstab
         (Modificar las entradas para el nuevo disco)
         # cd /
         # umount /mnt
         # init 0
         # boot disk2 -s
         # sys-unconfig
         # boot disk2

Salu2,

Mariano

Realizar un Ugrade via LiveUpgrade

Información complementaria
--------------------------
s10u1:          Solaris 10 1/06
s10u2:          Solaris 10 6/06
kilo:           192.168.1.2
infierno:       192.168.1.8

Slice                   Tag             Version
------------------------------------------
c0t0d0s0        root    Solaris 10u1 (Original)
c0t0d0s1        swap    Solaris 10u1 (Original)
c0t1d0s0        root    Solaris 10u2 (Actualizado)
c0t1d0s1        swap    Solaris 10u2 (Actualizado)

DETALLE DEL PROCEDIMIENTO
-------------------------

01.- Mi server es una Netra T1 sin CDROM por esto comparto el DVD de instalacion de otra maquina.

        root@infierno # share -o ro,anon=0 /cdrom/sol_10_606_sparc

02. Verificar desde el server que esta correctamente compartido

        root@kilo # dfshares 192.168.1.8
                RESOURCE                                  SERVER ACCESS    TRANSPORT
                192.168.1.8:/cdrom/sol_10_606_sparc   192.168.1.8  -         -

03. Clonar la tabla de particiones del disco a actualizar.

        root@kilo # prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

04. Eliminarl los paquetes de LiveUpgrade viejos

        root@kilo # pkginfo |grep -i "Live Upgrade"
        application SUNWlur                          Live Upgrade (root)
        application SUNWlur.2                        Live Upgrade 2.0 08/01 (root)
        application SUNWluu                          Live Upgrade (usr)
        application SUNWluzone                       Live Upgrade (zones support)

        root@kilo # pkgrm SUNWluu SUNWlur SUNWlur.2 SUNWluzone

05. Instalar los paquetes de Live Upgrade del DVD de Solaris 10
        (/cdrom/sol_10_606_sparc/Solaris_10/Product)
        (/cdrom/sol_10_106_sparc/Solaris_10/Tools/Installers/liveupgrade20)

        root@kilo # pkgadd SUNWluu SUNWlur SUNWluzone

06. Eliminar cualquier lista previa de Boot Enviroments

        root@kilo # mv /etc/lutab /etc/lutab.original

07. Crear una copia del actual BE (Boot Environment)

        root@kilo # lucreate -c s10u1 -m /:/dev/dsk/c0t1d0s0:ufs -m -:/dev/dsk/c0t1d0s1:swap -n s10u2

08. Verificar el estado de los BE (s10u1 y s10u2)

        root@kilo # lustatus
        Boot Environment           Is       Active Active    Can    Copy
        Name                       Complete Now    On Reboot Delete Status
        -------------------------- -------- ------ --------- ------ ----------
        s10u1                      yes      yes    yes       no     -
        s10u2                      yes      no     no        no     -

09. Comenzar el Upgade al nuevo OS

        root@kilo # luupgrade -u -n s10u2 -s /net/192.168.1.8/cdrom/sol_10_606_sparc

        Validating the contents of the media </net/192.168.1.8/cdrom/sol_10_606_sparc>.
        The media is a standard Solaris media.
        The media contains an operating system upgrade image.
        The media contains <Solaris> version <10>.
        Constructing upgrade profile to use.
        Locating the operating system upgrade program.
        Checking for existence of previously scheduled Live Upgrade requests.
        Creating upgrade profile for BE <s10u2>.
        Determining packages to install or upgrade for BE <s10u2>.
        Performing the operating system upgrade of the BE <s10u2>.
        CAUTION: Interrupting this process may leave the boot environment unstable         or unbootable.
        Upgrading Solaris: 7% completed

        ...MIENTRAS TANTO EN OTRA SESION PODEMOS VERIFICAR LA ACTUALIZACION...

        root@kilo # lustatus
        Boot Environment           Is       Active Active    Can    Copy
        Name                       Complete Now    On Reboot Delete Status
        -------------------------- -------- ------ --------- ------ ----------
        s10u1                      yes      yes    yes       no     -
        s10u2                      yes      no     no        no     UPDATING

        ...UN POCO MAS TARDE...

        root@kilo # luupgrade -u -n s10u2 -s /net/192.168.1.8/cdrom/sol_10_606_sparc

        Validating the contents of the media </net/192.168.1.8/cdrom/sol_10_606_sparc>.
        The media is a standard Solaris media.
        The media contains an operating system upgrade image.
        The media contains <Solaris> version <10>.
        Constructing upgrade profile to use.
        Locating the operating system upgrade program.
        Checking for existence of previously scheduled Live Upgrade requests.
        Creating upgrade profile for BE <s10u2>.
        Determining packages to install or upgrade for BE <s10u2>.
        Performing the operating system upgrade of the BE <s10u2>.
        CAUTION: Interrupting this process may leave the boot environment unstable         or unbootable.
        Upgrading Solaris: 100% completed
        Installation of the packages from this media is complete.
        Updating package information on boot environment <s10u2>.
        Package information successfully updated on boot environment <s10u2>.
        Adding operating system patches to the BE <s10u2>.
        The operating system patch installation is complete.
        INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot
        environment <s10u2> contains a log of the upgrade operation.
        INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot
        environment <s10u2> contains a log of cleanup operations required.
        INFORMATION: Review the files listed above. Remember that all of the files
        are located on boot environment <s10u2>. Before you activate boot
        environment <s10u2>, determine if any additional system maintenance is

        required or if additional media of the software distribution must be installed.
        The Solaris upgrade of the boot environment <s10u2> is complete.

        root@kilo # lustatus
        Boot Environment           Is       Active Active    Can    Copy
        Name                       Complete Now    On Reboot Delete Status
        -------------------------- -------- ------ --------- ------ ----------
        s10u1                      yes      yes    yes       no     -
        s10u2                      yes      no     no        yes    -

10. Instalar los parches recomendados de solaris 10

        root@kilo # unzip 10_Recommended.zip
        root@kilo # cd /var/tmp/10_Recommended
        root@kilo # luupgrade -n s10u2 -t -s . `cat patch_order`

        Validating the contents of the media <.>.
        The media contains 44 software patches that can be added.
        Mounting the BE <s10u2>.
        Adding patches to the BE <s10u2>.
        Validating patches...

        Loading patches installed on the system...

        Done!

        Loading patches requested to install.

        ......

        Unmounting the BE <s10u2>.
        The patch add to the BE <s10u2> completed.

11. Actival el nuevo Boot Environment

        root@kilo # luactivate s10u2

        **********************************************************************

        The target boot environment has been activated. It will be used when you
        reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
        MUST USE either the init or the shutdown command when you reboot. If you
        do not use either init or shutdown, the system will not boot using the target BE.

        **********************************************************************

        In case of a failure while booting to the target BE, the following process
        needs to be followed to fallback to the currently working boot environment:

        1. Enter the PROM monitor (ok prompt).

        2. Change the boot device back to the original boot environment by typing:

             setenv boot-device /pci@1f,0/pci@1,1/scsi@2/disk@0,0:a

        3. Boot to the original boot environment by typing:

             boot

        **********************************************************************

        Activation of boot environment <s10u2> successful.

12. Verificar el BE

        root@kilo # lustatus
        Boot Environment           Is       Active Active    Can    Copy
        Name                       Complete Now    On Reboot Delete Status
        -------------------------- -------- ------ --------- ------ ----------
        s10u1                      yes      no     no        yes    -
        s10u2                      yes      yes    yes       no     -

13. Reiniciar el equipo en Single-User para que se reconfigure

        root@kilo # shutdown -g0 -y

        Nota: No utilizar los comandos reboot, halt, init 0 para el reboot

14. Verificar que BE estamos utilizando

        root@kilo # cat /etc/release
                     Solaris 10 6/06 s10s_u2wos_09a SPARC
         Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
                      Use is subject to license terms.
                           Assembled 09 June 2006

15. Si todo funciona correctamente, eliminar el antiguo BE (s10u1)

        root@kilo # lustatus
        Boot Environment           Is       Active Active    Can    Copy
        Name                       Complete Now    On Reboot Delete Status
        -------------------------- -------- ------ --------- ------ ----------
        s10u1                      yes      no     no        yes    -
        s10u2                      yes      yes    yes       no     -

        root@kilo # ludelete s10u1
        WARNING: Boot environment <s10u1> has one or more slices mounted at </>.
        Determining the devices to be marked free.
        WARNING: The root slice </dev/md/dsk/d0> for BE <s10u1> is already mounted to </>.
        WARNING: Unable to determine the devices to be freed for BE <s10u1>.
        Updating boot environment configuration database.
        Updating boot environment description database on all BEs.
        Updating all boot environment configuration databases.
        Boot environment <s10u1> deleted.

        root@kilo # rm /etc/lutab

        root@kilo # lustatus
        ERROR: No boot environments are configured on this system
        ERROR: cannot determine list of all boot environment names

Anexo - Para volver al BE antiguo ejecutar lo siguiente

        root@kilo # luactivate s10u1
        root@kilo # shutdown -g0 -y -i0

        ok > boot [old BE] -s[x]

SalU2,

Mariano

Como montar una imagen ISO en Solaris

Para montar la imagen:
# lofiadm -a /var/adm/sun/pkg/sun_mc-3_6_1-ga.iso /dev/lofi/1
# mount -F hsfs -o ro /dev/lofi/1 /var/tmp/sunmc361

Para desmontar la imagen:
# umount /var/tmp/sunmc361
# lofiadm -d /dev/lofi/1

Nota: lofi = loopback file driver

Mariano

SMF troubleshooting Solaris 10

- Verificar el estado del servicio
        # svcs -a |egrep "maintenance"
                maintenance    10:04:33 svc:/application/font/fc-cache:default

        # svcs -l svc:/application/font/fc-cache:default
                fmri         svc:/application/font/fc-cache:default
                name         FontConfig Cache Builder
                enabled      true
                state        maintenance
                next_state   none
                state_time   Wed Aug 16 10:04:33 2006
                logfile      /var/svc/log/application-font-fc-cache:default.log
                restarter    svc:/system/svc/restarter:default
                dependency   require_all/none svc:/system/filesystem/local (online)
                dependency   require_all/refresh file://localhost/etc/fonts/fonts.conf (online)
                dependency   require_all/none file://localhost/usr/bin/fc-cache (online)

        # cat /var/svc/log/application-font-fc-cache:default.log
                [ May 27 02:12:25 Leaving maintenance because disable requested. ]
                [ May 27 02:12:26 Disabled. ]
                [ May 27 03:21:55 Executing start method ("/usr/bin/fc-cache") ]
                [ May 27 03:21:56 Method "start" failed due to signal ILL ]
                [ May 27 03:21:56 Executing start method ("/usr/bin/fc-cache") ]
                [ May 27 03:21:57 Method "start" failed due to signal ILL ]
                [ May 27 03:21:57 Executing start method ("/usr/bin/fc-cache") ]
                [ May 27 03:21:57 Method "start" failed due to signal ILL ]
                [ Aug 16 12:04:24 Leaving maintenance because disable requested. ]
                [ Aug 16 12:04:24 Disabled. ]
                [ Aug 16 12:04:32 Enabled. ]
                [ Aug 16 12:04:33 Executing start method ("/usr/bin/fc-cache") ]
                [ Aug 16 12:04:33 Method "start" failed due to signal ILL ]

- Verificar el XML de arranue para el servicio fc-cache
        # svccfg export fc-cache
                <?xml version='1.0'?>
                <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
                <service_bundle type='manifest' name='export'>
                  <service name='application/font/fc-cache' type='service' version='0'>
                    <create_default_instance enabled='true'/>
                    <single_instance/>
                    <dependency name='usr' grouping='require_all' restart_on='none' type='service'>
                      <service_fmri value='svc:/system/filesystem/local'/>
                    </dependency>
                    <dependency name='config-file' grouping='require_all' restart_on='refresh' type='path'>
                      <service_fmri value='file://localhost/etc/fonts/fonts.conf'/>
                    </dependency>
                    <dependency name='fc-cache' grouping='require_all' restart_on='none' type='path'>
                      <service_fmri value='file://localhost/usr/bin/fc-cache'/>
                    </dependency>
                    <exec_method name='start' type='method' exec='/usr/bin/fc-cache' timeout_seconds='3600'>
                      <method_context>
                        <method_credential user='root' group='root'/>
                      </method_context>
                    </exec_method>
                    <property_group name='general' type='framework'>
                      <propval name='action_authorization' type='astring' value='solaris.smf.manage.font'/>
                    </property_group>
                    <property_group name='startd' type='framework'>
                      <propval name='duration' type='astring' value='transient'/>
                    </property_group>
                    <stability value='Evolving'/>
                    <template>
                      <common_name>
                        <loctext xml:lang='C'>FontConfig Cache Builder</loctext>
                      </common_name>
                      <documentation>
                        <manpage title='fc-cache' section='1M' manpath='/usr/share/man'/>
                      </documentation>
                    </template>
                  </service>
                </service_bundle>

NOTA: Del metodo START rescatamos la manera de arrancar el servicio "/usr/bin/fc-cache" man fc-cache para ver que hacen las opciones (f, v)

- Intentar iniciar el servicio manualmente
        # truss -f fc-cache -f -v
                16071:  execve("/usr/bin/fc-cache", 0xFFBFFBF4, 0xFFBFFC04)  argc = 3
                16071:  resolvepath("/usr/lib/ld.so.1", "/lib/ld.so.1", 1023) = 12
                16071:  resolvepath("/usr/bin/fc-cache", "/usr/bin/fc-cache", 1023) = 17
                16071:  stat("/usr/bin/fc-cache", 0xFFBFF9D0)           = 0
                16071:  open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libfontconfig.so.1", 0xFFBFF4F0) Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libfontconfig.so.1", 0xFFBFF4F0) Err#2 ENOENT
                16071:  stat("/lib/libfontconfig.so.1", 0xFFBFF4F0)     Err#2 ENOENT
                16071:  stat("/usr/lib/libfontconfig.so.1", 0xFFBFF4F0) = 0
                16071:  resolvepath("/usr/lib/libfontconfig.so.1", "/usr/lib/libfontconfig.so.1", 1023) = 27
                16071:  open("/usr/lib/libfontconfig.so.1", O_RDONLY)   = 3
                16071:  mmap(0x00010000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 0xFF3A0000
                16071:  mmap(0x00010000, 294912, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF350000
                16071:  mmap(0xFF350000, 208114, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF350000
                16071:  mmap(0xFF392000, 20152, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 204800) = 0xFF392000
                16071:  munmap(0xFF384000, 57344)                       = 0
                16071:  memcntl(0xFF350000, 40048, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
                16071:  close(3)                                        = 0
                16071:  stat("/usr/openwin/lib/libfreetype.so.6", 0xFFBFF4F0) Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libfreetype.so.6", 0xFFBFF4F0) = 0
                16071:  resolvepath("/usr/sfw/lib/libfreetype.so.6", "/usr/sfw/lib/libfreetype.so.6", 1023) = 29
                16071:  open("/usr/sfw/lib/libfreetype.so.6", O_RDONLY) = 3
                16071:  mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000
                16071:  mmap(0x00010000, 720896, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF280000
                16071:  mmap(0xFF280000, 619289, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF280000
                16071:  mmap(0xFF326000, 36599, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 614400) = 0xFF326000
                16071:  munmap(0xFF318000, 57344)                       = 0
                16071:  memcntl(0xFF280000, 80724, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
                16071:  close(3)                                        = 0
                16071:  stat("/usr/openwin/lib/libz.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libz.so.1", 0xFFBFF4F0)      Err#2 ENOENT
                16071:  stat("/lib/libz.so.1", 0xFFBFF4F0)              Err#2 ENOENT
                16071:  stat("/usr/lib/libz.so.1", 0xFFBFF4F0)          = 0
                16071:  resolvepath("/usr/lib/libz.so.1", "/usr/lib/libz.so.1", 1023) = 18
                16071:  open("/usr/lib/libz.so.1", O_RDONLY)            = 3
                16071:  mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000
                16071:  mmap(0x00010000, 122880, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF250000
                16071:  mmap(0xFF250000, 46234, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF250000
                16071:  mmap(0xFF26A000, 11460, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 40960) = 0xFF26A000
                16071:  munmap(0xFF25C000, 57344)                       = 0
                16071:  memcntl(0xFF250000, 4164, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
                16071:  close(3)                                        = 0
                16071:  stat("/usr/openwin/lib/libexpat.so.0", 0xFFBFF4F0) Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libexpat.so.0", 0xFFBFF4F0)  = 0
                16071:  resolvepath("/usr/sfw/lib/libexpat.so.0", "/usr/sfw/lib/libexpat.so.0.5.0", 1023) = 30
                16071:  mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFF340000
                16071:  open("/usr/sfw/lib/libexpat.so.0", O_RDONLY)    = 3
                16071:  mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000
                16071:  mmap(0x00010000, 344064, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF1F0000
                16071:  mmap(0xFF1F0000, 265082, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF1F0000
                16071:  mmap(0xFF240000, 9380, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 262144) = 0xFF240000
                16071:  munmap(0xFF232000, 57344)                       = 0
                16071:  memcntl(0xFF1F0000, 36064, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
                16071:  close(3)                                        = 0
                16071:  stat("/usr/openwin/lib/libc.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libc.so.1", 0xFFBFF4F0)      Err#2 ENOENT
                16071:  stat("/lib/libc.so.1", 0xFFBFF4F0)              = 0
                16071:  resolvepath("/lib/libc.so.1", "/lib/libc.so.1", 1023) = 14
                16071:  open("/lib/libc.so.1", O_RDONLY)                = 3
                16071:  mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000
                16071:  mmap(0x00010000, 991232, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF080000
                16071:  mmap(0xFF080000, 881573, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF080000
                16071:  mmap(0xFF168000, 29469, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 884736) = 0xFF168000
                16071:  mmap(0xFF170000, 2592, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0xFF170000
                16071:  munmap(0xFF158000, 65536)                       = 0
                16071:  memcntl(0xFF080000, 139692, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
                16071:  close(3)                                        = 0
                16071:  stat("/usr/openwin/lib/libfreetype.so.6", 0xFFBFF4F0) Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libz.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libz.so.1", 0xFFBFF4F0)      Err#2 ENOENT
                16071:  stat("/lib/libz.so.1", 0xFFBFF4F0)              Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libexpat.so.0", 0xFFBFF4F0) Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libc.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/usr/sfw/lib/libc.so.1", 0xFFBFF4F0)      Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libz.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/lib/libz.so.1", 0xFFBFF4F0)              Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libc.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libc.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  stat("/usr/openwin/lib/libc.so.1", 0xFFBFF4F0)  Err#2 ENOENT
                16071:  munmap(0xFF3A0000, 8192)                        = 0
                16071:  mmap(0x00010000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF1E0000
                16071:  getcontext(0xFFBFF6C8)
                16071:  getrlimit(RLIMIT_STACK, 0xFFBFF6A8)             = 0
                16071:  getpid()                                        = 16071 [16059]
                16071:  setustack(0xFF1E2088)
                16071:  brk(0x00030150)                                 = 0
                16071:  brk(0x00032150)                                 = 0
                16071:  time()                                          = 1155724269
                16071:  stat("/platform/SUNW,Sun-Fire-15000/lib/libc_psr.so.1", 0xFFBFF250) = 0
                16071: resolvepath("/platform/SUNW,Sun-Fire-15000/lib/libc_psr.so.1", "/platform/sun4u-us3/lib/libc_psr.so.1", 1023) = 37
                16071:  open("/platform/SUNW,Sun-Fire-15000/lib/libc_psr.so.1", O_RDONLY) = 3
                16071:  mmap(0x00010000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 0xFF3A0000
                16071:  close(3)                                        = 0
                16071:  access("/etc/fonts/fonts.conf", R_OK)           = 0
                16071:  open("/etc/fonts/fonts.conf", O_RDONLY)         = 3
                16071:  brk(0x00032150)                                 = 0
                16071:  brk(0x00034150)                                 = 0
                16071:  fstat64(3, 0xFFBFF748)                          = 0
                16071:  brk(0x00034150)                                 = 0
                16071:  brk(0x00036150)                                 = 0
                16071:  fstat64(3, 0xFFBFF5F0)                          = 0
                16071:  ioctl(3, TCGETA, 0xFFBFF6D4)                    Err#25 ENOTTY
                16071:  read(3, " < ? x m l   v e r s i o".., 8192)     = 8192
                16071:  brk(0x00036150)                                 = 0
                16071:  brk(0x00038150)                                 = 0
                16071:  brk(0x00038150)                                 = 0
                16071:  brk(0x0003A150)                                 = 0
                16071:      Incurred fault #1, FLTILL  %pc = 0xFF378070
                16071:        siginfo: SIGILL ILL_ILLOPC addr=0xFF378070
                16071:      Received signal #4, SIGILL [default]
                16071:        siginfo: SIGILL ILL_ILLOPC addr=0xFF378070

- Verificar en que paquetes de instalacion esta el binario
        # grep fc-cache /var/sadm/install/contents
                /usr/bin/fc-cache f none 0755 root bin 22848 33575 1106442938 SUNWfontconfig
                /usr/share/man/man1/fc-cache.1 f none 0444 root bin 2818 38724 1103170401 SUNWfontconfig-docs
                /var/svc/manifest/application/font/fc-cache.xml f manifest 0444 root sys 1914 27439 1112898868 SUNWfontconfig-root

- Verificar el / los paquetes de instalacion
        # pkgchk SUNWfontconfig
                ERROR: /usr/lib/libfontconfig.so.1
                  file cksum <23257> expected <22647> actual

- Verificar si existe corrupcion en el binario mediante MD5

        - Ejemplo con corrupcion de binario:

        # digest -a md5 /usr/lib/libfontconfig.so.1
                8b48394ea6b905892d611c80421b0c74

                Results of Last Search

                8b48394ea6b905892d611c80421b0c74 - - 0 match(es)
                    Not found in this database.

        - Ejemplo sin corrupcion de binario:

        # digest -a md5 /usr/lib/libfontconfig.so.1
        0bbdd5e502292616707ccea25ff4e2b8

                # Comprobar el resultado en
http://sunsolve.sun.com/pub-cgi/fileFingerprints.pl
                        Results of Last Search

                        0bbdd5e502292616707ccea25ff4e2b8 - - 1 match(es)

                                * canonical-path: /usr/lib/libfontconfig.so.1
                                * package: SUNWfontconfig
                                * version: 6.6.2.7400,REV=0.2004.12.15
                                * architecture: sparc
                                * source: Solaris 10/SPARC

- Verificar el nivel de parcheo para el paquete en cuestion
        # showrev -p|grep SUNWfontconfig
        Patch: 119065-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWfontconfig-root

- Detener el servicio
        # svcadm disable svc:/application/font/fc-cache:default

- Remplazo del binario corrupto por el de otro equipo con las mismas caracteristicas y nivel de parcheo
        # scp root@HOSTOK:/usr/lib/libfontconfig.so.1 root@HOSTBAD:/usr/lib/libfontconfig.so.1

- Verificar el checksum
        # digest -a md5 /usr/lib/libfontconfig.so.1
        0bbdd5e502292616707ccea25ff4e2b8

- Arrancar el servicio y verificar su funcionamiento
        # svcadm enable svc:/application/font/fc-cache:default
        # svcs -a |egrep "fc-cache"
        online         13:18:24 svc:/application/font/fc-cache:default

Mariano Obarrio

Instalar y configurar MYSQL en Solaris 10

Initialize Database (mysql_install_db)
        # /usr/sfw/bin/mysql_install_db
                Preparing db table
                Preparing host table
                Preparing user table
                Preparing func table
                Preparing tables_priv table
                Preparing columns_priv table
                Installing all prepared tables
                060826 18:11:34 /usr/sfw/sbin/mysqld: Shutdown Complete

Creating mysql User and Group, and Changing Data Directory Group
        # groupadd mysql
        # /usr/sbin/useradd -s /bin/false -g mysql -d /var/mysql -c "MySQL User" mysql
        # chgrp -R mysql /var/mysql
        # chmod -R 770 /var/mysql
        # installf SUNWmysqlr /var/mysql d 770 root mysql
        # cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf

Starting and Testing the Database

        Setting root Password
        # /usr/sfw/bin/mysqladmin -u root password 'mysql_root_password'
        # /usr/sfw/bin/mysqladmin -u root -h HOSTNAME password 'mysql_root_password'

        Start the MySQL daemon
        # /usr/sfw/sbin/mysqld_safe &
        or
        # /usr/sfw/sbin/mysqld_safe --user=mysql &

        Test the MySQL daemon with the tests in the 'mysql-test' directory
        cd /usr/sfw/mysql/mysql-test; ./mysql-test-run

        Note: Please report any problems with the /usr/sfw/bin/mysqlbug script!

Configuring MySQL to Use With Service Management Facility (SMF)

        # vi /var/svc/manifest/network/mysql.xml
                <?xml version='1.0'?>
                 <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
                <!--

                        William Pool (Puddle) 02/05
                        Service manifest for MySQL
                        E-mail: pud...@flipmotion.com
                 -->
                 <service_bundle type='manifest' name='mysql:mysql'>
                 <service
                         name='network/mysql'
                         type='service'
                         version='1'>
                         <create_default_instance enabled='false' />
                         <single_instance />
                         <dependency name='fs'
                                 grouping='require_all'
                                 restart_on='none'
                                 type='service'>
                                 <service_fmri value='svc:/system/filesystem/local' />
                         </dependency>
                         <dependency name='net'
                                 grouping='require_all'
                                 restart_on='none'
                                 type='service'>
                                 <service_fmri value='svc:/network/loopback' />
                         </dependency>
                         <exec_method
                                 type='method'
                                 name='start'
                                 exec='/lib/svc/method/svc-mysql start'
                                 timeout_seconds='-1'>
                                <method_context>
                                         <method_credential user='mysql' group='mysql' />
                                 </method_context>
                         </exec_method>
                         <exec_method
                                 type='method'
                                 name='stop'
                                 exec=':kill'
                                 timeout_seconds='-1'>
                         </exec_method>
                  <exec_method
                                 type='method'
                                 name='restart'
                                 exec='/lib/svc/method/svc-mysql restart'
                                 timeout_seconds='-1'>
                         </exec_method>
                 </service>
                 </service_bundle>

Create your "Service Method File" in /lib/svc/method called svc-mysql

        # vi /lib/svc/method/svc-mysql
                #!/usr/bin/sh
                #
                #        William Pool (Puddle) 01/05
                #        SMF Method file for MySQL
                #        E-mail: pud...@flipmotion.com
                #
                # This uses Sun's default MySQL packages
                # SUNWmysqlu SUNWmysqlr
                # Modify accordingly!
                #
                # NOTE: Make sure DB_DIR is owned BY the mysql
                # user and group and chmod 700.
                #
                . /lib/svc/share/smf_include.sh
                DB_DIR=/var/mysql
                PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid

                case "$1" in
                 start)
                  /usr/sfw/sbin/mysqld_safe --user=mysql --datadir=${DB_DIR} --pid-file=${PIDFILE} > /dev/null &
                 ;;
                 stop)
                  if [ -f ${PIDFILE} ]; then
                   /usr/bin/pkill mysqld_safe >/dev/null 2>&1
                   /usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ' mysqld'
                   fi
                 ;;
                 'restart')
                  stop
                  while pgrep mysqld > /dev/null
                  do
                   sleep 1
                  done
                  start
                 ;;
                 *)
                  echo ""
                  echo "Usage: `basename $0` \
                    { start | stop | restart }"
                  echo ""
                  exit 64
                 ;;
                esac

Fix the permissions for the two files created

        # chown root:bin /lib/svc/method/svc-mysql
        # chmod 555 /lib/svc/method/svc-mysql
        # chown root:sys /var/svc/manifest/network/mysql.xml
        # chmod 444 /var/svc/manifest/network/mysql.xml

Import the service into the service repository:
        # svccfg import /var/svc/manifest/network/mysql.xml

Enable the service:
        # svcadm -v enable mysql

Esta documentacion es un resumen de las siguientes fuentes:
        /etc/sfw/mysql/README.solaris.mysql
        http://www.sun.com/bigadmin/content/submitted/mysql_smf_tip.html
        http://developers.sun.com/solaris/articles/solaris_as_sip/solaris_as_...
        http://www.hccfl.edu/pollock/AUnix1/MySQLInstallSolaris.htm

SalU2

Mariano

Rutas estaticas en Solaris 10

Solaris automaticamente al tener mas de 2 IF de red levanta los demonios de ruteo (in.rdisc, in.routed), con esto no se tendrian que especificar rutas manualmente, pero de ser necesarias, recomendaria estas 2 opciones:


/etc/init.d/rutas
    /usr/sbin/route add host 192.18.128.177 50.0.0.97
    /usr/sbin/route add host 192.168.156.109 192.168.152.109
    /usr/sbin/route add host 195.76.0.239 50.0.0.97 1
    /usr/sbin/route add default 50.0.0.42
    /usr/sbin/route add 192.168.151.21 192.168.152.20

Link:   /etc/rc2.d/S69rutas -> /etc/init.d/rutas


/etc/init.d/staticroutes
    #!/sbin/sh
    # /etc/rc2.d/S70staticroutes /etc/init.d/staticroutes
    # Edit the following IPMP test  TARGETS to suit your needs.
    # To install:
    # 1) cp S70staticroutes to /etc/rc2.d
    # 2) perform edits on the sript as required
    # 3) chmod 744 /etc/rc2.d/S70staticroutes
    # 4) chown root:sys /etc/rc2.d/S70staticroutes
    # 5) ln /etc/rc2.d/S70staticroutes /etc/init.d/staticroutes

    case "$1" in
        'start')
                 /usr/bin/echo "Adding static routes..."
                # RED 192.168.1.XXX
                /usr/sbin/route add host 192.168.1.203 192.168.1.203
                /usr/sbin/route add host 192.168.1.205 192.168.1.205
                /usr/sbin/route add host 192.168.1.15  192.168.1.15
                /usr/sbin/route add host 192.168.1.34  192.168.1.34
                /usr/sbin/route add host 192.168.1.36  192.168.1.36

                # RED 192.168.5.XXX
                /usr/sbin/route add host 192.168.5.248 192.168.5.248
                /usr/sbin/route add host 192.168.5.249 192.168.5.249
                /usr/sbin/route add host 192.168.5.48  192.168.5.48
                /usr/sbin/route add host 192.168.5.250 192.168.5.250
                /usr/sbin/route add host 192.168.5.11  192.168.5.250
            ;;
        'stop')
                /usr/bin/echo "Deleting static routes..."
                # RED 192.168.1.XXX
                /usr/sbin/route delete host 192.168.1.203 192.168.1.203
                /usr/sbin/route delete host 192.168.1.205 192.168.1.205
                /usr/sbin/route delete host 192.168.1.15  192.168.1.15
                /usr/sbin/route delete host 192.168.1.34  192.168.1.34
                /usr/sbin/route delete host 192.168.1.36  192.168.1.36

                # RED 192.168.5.XXX
                /usr/sbin/route delete host 192.168.5.248 192.168.5.248
                /usr/sbin/route delete host 192.168.5.249 192.168.5.249
                /usr/sbin/route delete host 192.168.5.48  192.168.5.48
                /usr/sbin/route delete host 192.168.5.250 192.168.5.250
                /usr/sbin/route delete host 192.168.5.11  192.168.5.250
                ;;
    esac

Link:   /etc/rc2.d/S70staticroutes -> /etc/init.d/staticroutes

Mariano

Reconfiguración de dispositivos (por si la controladora cambia de numero después de un reboot -r)

1º Desmontar los discos utilizados por esa controladora
        # umount /soft01
        # umount /soft02

2º Acceder al FS donde estan definidas las controladoras
        # cd /dev/cfg/
        # ls -lat
        total 34
        drwxr-xr-x   2 root     root         512 Oct 27 21:18 .
        drwxr-xr-x  17 root     sys         8704 Oct 28 14:46 ..
        lrwxrwxrwx   1 root     other         38 Oct 27 21:18 c7 ->  ../../devices/pci@6,2000/SUNW,ifp@1:fc
        lrwxrwxrwx   1 root     root          37 Apr 28  2004 c0 -> ../../devices/pci@1f,4000/scsi@3:scsi
        lrwxrwxrwx   1 root     root          37 Apr 28  2004 c1 -> ../../devices/pci@1f,4000/scsi@2:scsi
        lrwxrwxrwx   1 root     root          36 Apr 28  2004 c2 -> ../../devices/pci@6,4000/scsi@2:scsi
        lrwxrwxrwx   1 root     root          38 Apr 28  2004 c3 -> ../../devices/pci@6,4000/scsi@2,1:scsi
        lrwxrwxrwx   1 root     root          36 Apr 28  2004 c4 -> ../../devices/pci@6,4000/scsi@4:scsi
        lrwxrwxrwx   1 root     root          38 Apr 28  2004 c5 -> ../../devices/pci@6,4000/scsi@4,1:scsi

3º Renombrar la controladora por la nueva
        # mv c7 c6
        # ls -lat
        total 34
        drwxr-xr-x   2 root     root         512 Oct 30 09:32 .
        drwxr-xr-x  17 root     sys         8704 Oct 28 14:46 ..
        lrwxrwxrwx   1 root     other         38 Oct 27 21:18 c6 -> ../../devices/pci@6,2000/SUNW,ifp@1:fc
        lrwxrwxrwx   1 root     root          37 Apr 28  2004 c0 -> ../../devices/pci@1f,4000/scsi@3:scsi
        lrwxrwxrwx   1 root     root          37 Apr 28  2004 c1 -> ../../devices/pci@1f,4000/scsi@2:scsi
        lrwxrwxrwx   1 root     root          36 Apr 28  2004 c2 -> ../../devices/pci@6,4000/scsi@2:scsi
        lrwxrwxrwx   1 root     root          38 Apr 28  2004 c3 -> ../../devices/pci@6,4000/scsi@2,1:scsi
        lrwxrwxrwx   1 root     root          36 Apr 28  2004 c4 -> ../../devices/pci@6,4000/scsi@4:scsi
        lrwxrwxrwx   1 root     root          38 Apr 28  2004 c5 -> ../../devices/pci@6,4000/scsi@4,1:scsi

4º Borrar los links a la controladora antigua
        # cd /dev/rdsk/
        # rm -r c7*
        # cd /dev/dsk/
        # rm -r c7*

5º Limpiar y reconfigurar los dispositivos
        # devfsadm -Cv

6º Montar los FileSystems
        # mount /soft01
        # mount /soft02
        # df -k

Modificar la distribución del teclado (Keyboard Layout)

# more /usr/lib/set_keyboard_layout
# eeprom kbd-type="Spanish" o eeprom Keyboard-Type="Spanish"
# init 6

- Lista de teclados disponibles (/usr/lib/set_keyboard_layout)

NOTA: La nueva variable de NVRAM 'keyboard-layout' es introducida tanto en sparc como en x86. Las antiguas eeprom la llaman 'kbd-type' pero esta sera reemplazada por 'keyboard-layout'

Salu2,

Mariano

Connection refused al conectarnos a la consola de una V20z/40z desde la SSP

Al ejecutar el comando "platform console" desde la SSP genera el siguiente error:

localhost $ platform console
console: connect(): 59372@console: Connection refused
localhost $

Esto se soluciona ejecutando ->
localhost $ platform set console -s sp -S 9600 -e

Ejemplo:

localhost $ platform console
[Enter `^Ec?' for help]
[no, ad...@localhost.localdomain is attached]

done.


Salu2,

Mariano

Micro-HowTo de instalación por red via imagen flash

1º Incorporar la IP y el nombre del host a instalar en el /etc/hosts
192.168.152.52  iguazu-adm

2º Incorporar la MAC y el nombre del host a instalar en /etc/ethers
0:3:ba:cb:1a:d1 iguazu-adm

3º Introducir el CD de Software 1/2

4º Agregar las imagenes de boot y comparte el CDRom para la instalación
# cd /cdrom/sol_9_904_sparc/s0/Solaris_9/Tools
# ./add_install_client iguazu-adm sun4u
Adding "share -F nfs -o ro,anon=0 /cdrom/sol_9_904_sparc/s0" to /etc/dfs/dfstab
Adding "share -F nfs -o ro,anon=0 /cdrom/sol_9_904_sparc/s1" to /etc/dfs/dfstab
updating /etc/bootparams

5º Lanzar un SNOOP para ver que el proceso de instalación se inicia.
# snoop rarp
Using device /dev/eri (promiscuous mode)
OLD-BROADCAST -> (broadcast)  RARP C Who is 0:3:ba:cb:1a:d1 ?
sf15k-consola -> iguazu-adm   RARP R 0:3:ba:cb:1a:d1 is
192.168.152.52, iguazu-adm

6º Desde el cliente lanzamos la instalación
CONSOLA
{1} ok devalias
{2} ok boot net1 - install
Boot device: /pci@1f,700000/network@1  File and args: - install
/pci@1f,700000/network@1: 1000 Mbps full duplex link up

7º Seleccionamos Flash Install y le damos la ruta donde esta la imagen flash. 


El resto es una instalación normal.

Salu2,

Mariano

Acceso a FS de carpetas compartidas en Windows desde un Solaris via SAMBA

Esto nos permite acceder a carpetas compartidas en windows desde cualquier Solaris. El comando smbclient funciona de manera similar al comando FTP.

Windows IP:     192.168.1.10
Solaris IP:     192.168.1.2
WinUser:        Administrador
Password:       12345
Domain:         MIDOMAIN
Comando:        /usr/sfw/bin/smbclient

# Estructura del comando a ejecutar
# smbclient //192.168.1.10/Shared 12345 [-I destinationIP] [-U username]

# Si SMB no esta configurado en el sistema ejecutamos por primera y unica vez.
# touch /etc/sfw/smb.conf

Ej. 1
        ## Ejemplo introduciendo la contraseña por teclado
        #
        # /usr/sfw/bin/smbclient //192.168.1.10/Shared -U Administrador
        Password: [12345]

        Domain=[MIDOMAIN] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
        smb: \> quit

Ej. 2
        ## Ejemplo pasando el usuario y la contraseña
        #
        # smbclient //192.168.1.10/Shared 12345 -U Administrador
        Domain=[MIDOMAIN] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
        smb: \> ls
        .                                   D       0  Mon Feb 26 12:12:02 2007
        ..                                  D       0  Mon Feb 26 12:12:02 2007
        10_x86_Recommended.zip              A 179358812  Thu Feb 22 18:58:13 2007
        124919-02.zip                       A  103094  Thu Feb 22 16:50:50 2007
        agdbn303.zip                        A 2597070  Mon Feb 26 12:08:20 2007

                38162 blocks of size 1048576. 4105 blocks available
        smb: \> quit

Errores comunes:

Si se ejecuta el comando sin tener configurado SAMBA se puede generar el error:
params.c:OpenConfFile() - Unable to open configuration file "/etc/sfw/smb.conf":
        No such file or directory
/usr/sfw/bin/smbclient: Can't load /etc/sfw/smb.conf - run testparm to debug it

Para evitar esto simplemente se crea el archivo "smb.conf" vacio.

Salu2,

Mariano

Solaris Storage Tips and Tricks

- Verificar que software para la administración de los discos se esta utilizando
# modinfo |egrep -i "SunFC|mpxio|scsi_vhci|qlc"

- Determinar que tipo de HBA se estan utilizando
# luxadm qlgc

- Listar los WWN de los dispositivos en el host
# luxadm -e port

- Determinar el Host Port WWN de la controladora en el host
# luxadm -e dump_map [Salida del luxadm -e port | /dev/cfg/c#] (donde es la controladora)

- Verificar el estado de los arrays
# cfgadm -al

- Determinar la relación entre las controladoras y el host
# luxadm probe
# luxadm probe -p (también muestra el path físico)

- Determinar los path físicos de las controladoras en el host
# luxadm display [Disco]

- Mostrar las LUNs de un Host en Solaris
# cfgadm -al -o show_FCP_dev <controller_id> (Solaris 8 and S10)
# cfgadm -al -o show_SCSI_LUN <controller_id> (Solaris 10)

- Muestra el path de los dispositivos en formato non-STMS a STMS si el STMS esta habilitado (Multipath MPxIO).
# stmsboot -L 



Salu2,

Mariano

jueves, 17 de septiembre de 2009

Script para relacionar Segmentos de Shared Memory con DBs de Oracle

Este script es útil para determinar que segmentos de memoria utiliza
cada DB, dado que si tenemos varias DB es complicado determinar que
segmento pertenece a cada una.

Salida:
El comando muestra la misma salida del "ipcs -m" pero añade al final
de cada segmento de memoria la DB correspondiente y completa con "*"
cuando el segmento no esta referenciado con ninguna DB, lo cual nos
facilita un segmento candidato a ser eliminado con el comando "ipcrm -
m [ID]".

Nota:
Es importante solo tener en cuenta los segmentos de los usuarios de
las DB (Ej. Oracle)

Ejemplo:

root@tango01 # showipcs
IPC status from as of Tue May 15 14:23:20 MEST 2007

T ID KEY MODE OWNER GROUP
Shared Memory:
m 84 0x6c91c3e0 --rw-r----- oracle dba
[ ****************** ]
m 74 0x83a50bf0 --rw-r----- oracle dba [ DNWTPRO ]
m 44 0xcea2dc58 --rw-r----- oracle dba [ DNEWTOUR ]
m 30 0xb60abb4c --rw-r----- oracle dba [ DPRTLEMP ]
m 7 0x438d0000 --rw-r----- oracle dba [ DVGNT ]
m 1 0xfa9d2b30 --rw-r----- oracle dba [ DGFORCE ]

En esta salida de ejemplo el segmento 84 presuntamente esta asignado
pero no pertenece a ninguna DB activa, con lo cual tendría que ser
eliminado con el comando "ipcrm -m 84"

SCRIPT:

#!/usr/bin/perl

sub ipc2db{
$p_ipc = shift;
@PMONPID=`ps -ef|grep pmon|grep -v grep|awk '{print \$2}'`;
foreach $pid (@PMONPID) {
$db="";
$ipc="";
chomp($pid);
$db=`ps -ef -o "comm,pid" |grep -i " $pid"|grep -v
grep|awk '{print \$1}'|cut -d"_" -f3`;
chomp($db);
$ipc=`pmap $pid |egrep shmid|cut -d "=" -f2|awk
'{print \$1"=d"}'`;
chomp($ipc);
$ipc=hex($ipc);
return($db) if("$p_ipc" == "$ipc");

}

}

@IPCS_M=`/usr/bin/ipcs -m`;
foreach $line (@IPCS_M){
$DB="";
chomp($line);
if($line =~ m/^m/){
($T,$ID,$KEY,$MODE,$OWNER,$GROUP) = split(/\ +/,$line,
6);
$DB = ipc2db("$ID");
$DB=($DB?$DB:"******************");
print $line." [ $DB ]\n";
}else{
print $line."\n";
}
}

##END

Gracias a MarcosG

Salu2,

Mariano

Resumen de Comandos IP Filter

IPFILTER en Solaris

Índice:

01 - Activar Solaris IP Filter

02 - Activar nuevas reglas de filtrado

03 - Desactivar el Filtrado de paquetes desde el Kernel

04 - Desactivar el NAT

05 - Deshabilitar el filtrado de paquetes

06 - Desactivar Solaris IP Filter en una interfaz de red

07 - Remover un pool de direcciones

08 - Listar los Pools de direcciones activos

09 - Listar las estadísticas de los pools

10 - Listar el LOG de IP Filter

11 - Listar las reglas de NAT activas

12 - Listar las estadísticas del NAT

13 - Listar las estadísticas del PFIL

14 - Listar las reglas de Filtrado

15 - Listar las estadísticas de estado

16 - Listar la tabla de estados de IP Filter

17 - Hacer un FLUSH del buffer del log

18 - Guardar en disco los paquetes logueados

19 - Agregar reglas de NAT desde línea de comandos

20 - Agregar reglas de NAT desde un archivo

21 - Agregar reglas de filtrado desde línea de comandos

22 - Agregar reglas de filtrado desde un archivo

23 - Agregar reglas a un pool de direcciones desde línea de comandos

24 - Agregar reglas a un pool de direcciones desde un archivo

25 - Agregar reglas de filtrado inactivas

26 - Switch entre reglas activas e inactivas

27 – Ejemplos

Ejemplo 1: Los paquetes entrantes y salientes de TCP/UDP para los puertos 161 (SNMP) y 1161 (Agente de SUNMC) y el protocolo ICMP. Luego bloquear el resto del trafico entre 2 equipos.

Ejemplo 2: Habilitar todo el trafico entrante y saliente, también habilitar el log para la NIC de loopback. Aceptar paquetes entrantes del puerto 22 TCP (ssh), 80 TCP/UDP (http), 53 TCP/UDP (DNS) y 3128 TCP/UDP (SQUID) por las NICs hme0 y hme1. Bloquear el resto de paquetes entrantes. Permitir la salida de todo tipo de paquetes y mantener el estado de la conexión.

Ejemplo 3: Habilitamos las reglas de NAT para la redirección del trafico entrante por la IF hme1 de cualquier IP al port 80 redireccionandolo a la ip 10.6.75.10 port 3128, lo mismo para el puerto 443 y para el resto del trafico.

Ejemplo 4: Configuración completa de IPFilter sobre solaris 10

Ejemplo 5: Comandos que nos pueden ser útiles de IPFilter sobre solaris 10

Ejemplo 6: Configuración de IPFilter para redirección de puertos. El objetivo es redirigir el puerto 22 de pool01 a pool02

28 – Documentación



01 - Activar Solaris IP Filter

- Activar Solaris IP Filter en una interfaz de red

# vi /etc/ipf/pfil.ap

# IP Filter pfil autopush setup

#

# See autopush(1M) manpage for more information.

#

# Format of the entries in this file is:

#

#major minor lastminor modules

#le -1 0 pfil

#qe -1 0 pfil

hme -1 0 pfil <-- Activa IP Filter en HME

#qfe -1 0 pfil

#eri -1 0 pfil

- Activar los cambios realizados reiniciando el servicio network/pfil.

# svcadm restart network/pfil

o

# svcadm enable network/pfil # Si no esta activado! (verificar con "svcs")

- Activar el IP Filter

# svcadm enable network/ipfilter

- Reiniciar la maquina o realizar un unplumb/plumb

# init 6


02 - Activar nuevas reglas de filtrado

- Cargar un nuevo grupo de reglas

# ipf -Fa -f /etc/ipf/ipf.conf

- Cargar reglas de NAT

# ipnat -CF -f /etc/ipf/ipnat.conf

- Cargar un pool

# ippool -F -f /etc/ipf/ippool.conf


03 - Desactivar el Filtrado de paquetes desde el Kernel

- Remover las reglas de filtrado activas en el kernel .

# ipf -Fa

- Remover las reglas de filtrado para paquetes entrante.

# ipf -Fi

- Remover las reglas de filtrado para paquetes salientes.

# ipf -Fo


04 - Desactivar el NAT

- Remover el NAT del kernel.

# ipnat -FC


05 - Deshabilitar el filtrado de paquetes

- Desabilitar el filtrado de paquetes y permitir que todos pasen.

# ipf –D



06 - Desactivar Solaris IP Filter en una interfaz de red

- Editar el archivo pfil.ap y comentar el dispositivo para el cual queremos desactivar el filtrado.

# vi /etc/ipf/pfil.ap

#major minor lastminor modules

#le -1 0 pfil

#qe -1 0 pfil

#hme -1 0 pfil

#qfe -1 0 pfil

- Activar los cambios realizados.

# scvadm restart network/pfil

- Reiniciar la maquina o realizar un unplumb/plumb

# init 6

Nota: El reinicio es necesario si no se puede realizar un "ifconfig unplumb" y "ifconfig plumb" sobre la interfaz.


07 - Remover un pool de direcciones

# ippool -F


08 - Listar los Pools de direcciones activos

# ippool -l


09 - Listar las estadisticas de los pools

# ippool -s


10 - Listar el LOG de IP Filter

Opciones para ver los LOGs

* S: Muestra el estado del archivo de log

* N: Muestra el archivo de log para el NAT

* I: Muestra el archivo de log comun para la IP

# ipmon -o [S|N|I] [archivo]

Ver todos los archivos de log.

# ipmon -a [archivo]


11 - Listar las reglas de NAT activas

# ipnat -l


12 - Listar las estadisticas del NAT

# ipnat -s


13 - Listar las estadisticas del PFIL

# ndd -get /dev/pfil qif_status


14 - Listar las reglas de Filtrado

- Listar las reglas de filtrado activas en el kernel

# ipfstat -io

- Listar las reglas de filtrado inactivas

# ipfstat -I -io


15 - Listar las estadisticas de estado

# ipfstat -s


16 - Listar la tabla de estados de IP Filter

# ipfstat

Nota: Con la opcion -t la salida se muestra similar al formato del comando TOP.


17 - Hacer un FLUSH del buffer del log

# ipmon -F



18 - Guardar en disco los paquetes logueados

# cat /dev/ipl > /tmp/logfile

19 - Agregar reglas de NAT desde linea de comandos

# echo "map hme0 192.168.1.0/24 -> 50.0.20.1/32" | ipnat -f -


20 - Agregar reglas de NAT desde un archivo

# ipnat -f archivo


21 - Agregar reglas de filtrado desde linea de comandos

# echo "block in on hme0 proto tcp from 10.1.1.1/32 to any" | ipf -f -


22 - Agregar reglas de filtrado desde un archivo

# ipf -f /etc/ipf/ipf.conf


23 - Agregar reglas a un pool de direcciones desde linea de comandos

# echo "table role = ipf type = tree number = 100

{10.0.0.0/32, 172.16.1.2/32, 192.168.1.0/24};" | ippool -f -


24 - Agregar reglas a un pool de direcciones desde un archivo

# ippool -f filename


25 - Agregar reglas de filtrado inactivas

# ipf -I -f /etc/ipf/ipf.conf


26 - Switch entre reglas activas e inactivas

# ipf -s


27 – Ejemplos


Ejemplo 1: Habilitar los paquetes entrantes y salientes de TCP/UDP para los puertos 161 (SNMP) y 1161 (Agente de SUNMC) y el protocolo ICMP. Luego bloquear el resto del trafico entre 2 equipos.

# cat /etc/ipf/ipf.conf

pass in quick proto tcp/udp from any to any port = 161 keep state

pass out quick proto tcp/udp from any to any port = 161 keep state

pass in quick proto tcp/udp from any to any port = 1161 keep state

pass out quick proto tcp/udp from any to any port = 1161 keep state

pass in quick proto icmp from any to any keep state

pass out quick proto icmp from any to any keep state

#

# Bloquear el resto de trafico entre newmike y new_backup

#

block in quick from 192.168.152.82/32 to any

block out quick from any to 192.168.152.82/32



Ejemplo 2: Habilitar todo el trafico entrante y saliente, también habilitar el log para la NIC de loopback.

Aceptar paquetes entrantes del puerto 22 TCP (ssh), 80 TCP/UDP (http), 53 TCP/UDP (DNS) y 3128 TCP/UDP (SQUID) por las NICs hme0 y hme1.

Bloquear el resto de paquetes entrantes.

Permitir la salida de todo tipo de paquetes y mantener el estado de la conexión.

# vi /etc/ipf/ipf.conf

pass in all

pass out all

pass in log quick on lo0 all

pass out log quick on lo0 all

pass in quick on hme0 proto tcp from any to any port = 22 keep state

pass in quick on hme0 proto tcp/udp from any to any port = 53 keep state

pass in quick on hme0 proto tcp/udp from any to any port = 80 keep state

pass in quick on hme0 proto tcp/udp from any to any port = 3128 keep state

pass in quick on hme1 proto tcp from any to any port = 22 keep state

pass in quick on hme1 proto tcp/udp from any to any port = 53 keep state

pass in quick on hme1 proto tcp/udp from any to any port = 80 keep state

pass in quick on hme1 proto tcp/udp from any to any port = 3128 keep state

block return-rst in log on hme0 proto tcp from any to any

block return-rst in log on hme1 proto tcp from any to any

pass out on hme0 proto tcp from any to any keep state

pass out on hme1 proto tcp from any to any keep state



Ejemplo 3: Habilitamos las reglas de NAT para la redirección del trafico entrante por la IF hme1 de cualquier IP al port 80 redireccionandolo a la ip 10.6.75.10 port 3128, lo mismo para el puerto 443 y para el resto del trafico.

# vi /etc/ipf/ipnat.conf

rdr hme1 0/0 port 80 -> 10.6.75.10 port 3128

rdr hme1 0/0 port 443 -> 10.6.75.10 port 3128

rdr hme1 0/0 -> 10.6.75.10


Ejemplo 4: Configuración completa de IPFilter sobre solaris 10

- Habilitar el IPFILTER

# vi /etc/ipf/pfil.ap

# IP Filter pfil autopush setup

#

# See autopush(1M) manpage for more information.

#

# Format of the entries in this file is:

#

#major minor lastminor modules

#le -1 0 pfil

#qe -1 0 pfil

hme -1 0 pfil (Device has been uncommented for filtering)

#qfe -1 0 pfil

#eri -1 0 pfil

#ce -1 0 pfil

#bge -1 0 pfil

- Activamos los cambios realizados reiniciando el servicio network/pfil.

# svcadm restart network/pfil

o

# svcadm enable network/pfil # Si no está activado! (verificar con "svcs")

- Activamos el IPFILTER

# svcadm enable network/ipfilter

# reboot



Nota: Es importante reiniciar el equipo, las operaciones de unplumb y plumb sobre la IF no son seguras.

Si se desactiva temporalmente el IPFILTER se puede reactivar utilizando el comando:

# ipf -E # Activa el IPFILTER

# ipf -f # Activa el filtrado de paquetes

# ipnat -f # Activa el NAT

Nota: Para un detalle mayor sobre IPFILTER ver estas URLs:

http://docs.sun.com/app/docs/doc/816-4554/6maoq023u?a=view

http://docs.sun.com/app/docs/doc/816-4554/6maoq024c?a=view

- Habilitamos el IP Forwarding en Solaris para IPV4

# routeadm -u -e ipv4-forwarding

- Preparamos las reglas del FIREWALL (IPFILTER)

# vi /etc/ipf/ipf.conf

#

# ipf.conf

#

# IP Filter rules to be loaded during startup

#

# See ipf(4) manpage for more information on

# IP Filter rules syntax.

#

# This is a simple ruleset that blocks all inbound TCP traffic

# except for SSH, and allows all outbound traffic,

#

# And of course, make sure the loopback allows packets to traverse

# it.

pass in all

pass out all

pass in log quick on lo0 all

pass out log quick on lo0 all

pass in quick on hme0 proto tcp from any to any port = 22 keep state

pass in quick on hme0 proto tcp/udp from any to any port = 53 keep state

pass in quick on hme0 proto tcp/udp from any to any port = 80 keep state

pass in quick on hme0 proto tcp/udp from any to any port = 3128 keep state

pass in quick on hme1 proto tcp from any to any port = 22 keep state

pass in quick on hme1 proto tcp/udp from any to any port = 53 keep state

pass in quick on hme1 proto tcp/udp from any to any port = 80 keep state

pass in quick on hme1 proto tcp/udp from any to any port = 3128 keep state

block return-rst in log on hme0 proto tcp from any to any

block return-rst in log on hme1 proto tcp from any to any

pass out on hme0 proto tcp from any to any keep state

pass out on hme1 proto tcp from any to any keep state

- Preparamos las reglas del NAT (IPFILTER)

# vi /etc/ipf/ipnat.conf

rdr hme1 0/0 port 80 -> 10.6.75.10 port 3128

rdr hme1 0/0 port 443 -> 10.6.75.10 port 3128

rdr hme1 0/0 -> 10.6.75.10



Ejemplo 5: Comandos que nos pueden ser útiles de IPFilter sobre solaris 10

# ipf -E # Enable ipfilter when running for the first time.

# ipf -f /etc/ipf/ipf.conf # Load rules in /etc/ipf/ipf.conf file into the active firewall.

# ipf -Fi # Flush all input rules.

# ipf -I -f /etc/ipf/ipf.conf # Load rules in /etc/ipf/ipf.conf file into inactive firewall.

# ipf -V # Show version info and active list.

# ipf -s # Swap active and inactive firewalls.

# ipf -Fa # Solo para pruebas, flush de todas las reglas.

# ipf -Fa -f /etc/ipf/ipf.conf # Flush de las reglas y carga las nuevas

# ipfstat -ion # Lista las reglas que activas.

# ipfstat # Show summary

# ipfstat -i # Show input list

# ipfstat -o # Show output list

# ipfstat -hio # Show hits against all rules

# ipfstat -t -T 5 # Monitor the state table and refresh every 5 seconds.

# ipnat -l # Lista los NAT activos

# ipnat -FC # Realiza un Flush de las

# ipnat -f /etc/ipf/ipnat.conf # Activa las nuevas reglas de NAT

# ipmon -a # Verificamos el comportamiento del NAT

Output is similiar to 'top' monitoring the process table.

# ipmon -s S # Watch state table.

# ipmon -sn # Write logged entries to syslog, and convert back to hostnames and servicenames.

# ipmon -s [file] # Write logged entries to some file.

# ipmon -Ds # Run ipmon as a daemon, and log to default location.

(/var/adm/messages for Solaris)

(/var/log/syslog for Tru64)



Ejemplo 6: Configuración de IPFilter para redirección de puertos. El objetivo es redirigir el puerto 22 de pool01 a pool02

Configuración en POOL01

- Configuración ipfilter

# cat /etc/ipf/ipf.conf

#

# ipf.conf

#

# IP Filter rules to be loaded during startup

#

# See ipf(4) manpage for more information on

# IP Filter rules syntax.

pass in all

pass out all

pass in log quick on lo0 all

pass out log quick on lo0 all

pass in quick on bge0 proto tcp/udp from any to any port = 22 keep state

pass in quick on bge0 proto tcp/udp from any to any port = 53 keep state

pass in quick on bge0 proto tcp/udp from any to any port = 80 keep state

block return-rst in log on bge0 proto tcp from any to any

pass out on bge0 proto tcp from any to any keep state


- Configuración ipnat

# vi /etc/ipf/ipnat.conf

## Este ejemplo funciona con la siguiente configuracion

## en pool01:

## default 10.150.0.1 UG 1 304

## en pool02:

## default 192.168.1.1 UG 1 2 bge0

##

## En pool01

## IPv4 routing enabled enabled

## IPv4 forwarding enabled enabled

##

## En pool02

## IPv4 routing disabled disabled

## IPv4 forwarding disabled disabled

##

#

map bge0 10.150.0.0/16 -> 192.168.1.1/32 portmap tcp/udp auto

map bge0 10.150.0.0/16 -> 192.168.1.1/32

rdr bge0 0/0 port 22 -> 192.168.1.2 port 22 tcp/udp

- Configuración de routeadm en pool01

# routeadm

Configuration Current Current

Option Configuration System State

---------------------------------------------------------------

IPv4 routing enabled enabled

IPv6 routing disabled disabled

IPv4 forwarding enabled enabled

IPv6 forwarding disabled disabled

Routing services "route:default ripng:default"

Routing daemons:

STATE FMRI

disabled svc:/network/routing/legacy-routing:ipv4

disabled svc:/network/routing/legacy-routing:ipv6

disabled svc:/network/routing/ndp:default

disabled svc:/network/routing/rdisc:default

disabled svc:/network/routing/ripng:default

disabled svc:/network/routing/ripng:quagga

online svc:/network/routing/route:default

disabled svc:/network/routing/zebra:quagga

disabled svc:/network/routing/rip:quagga

disabled svc:/network/routing/ospf:quagga

disabled svc:/network/routing/ospf6:quagga

disabled svc:/network/routing/bgp:quagga

Notas: Activar routing y forwarding con la opcion -e, con -d se desactiva.

# routeadm -u -e ipv4-routing

# routeadm -u -e ipv4-forwarding

- Default router

# cat /etc/defaultrouter

192.168.1.1

- Rutas de pool01

# netstat -rn

Routing Table: IPv4

Destination Gateway Flags Ref Use Interface

-------------------- -------------------- ----- ----- ---------- ---------

default 10.150.0.1 UG 1 304

10.0.0.0 10.150.2.58 U 1 11155 bge0

192.168.1.0 192.168.1.1 U 1 12 nge0

224.0.0.0 10.150.2.58 U 1 0 bge0

127.0.0.1 127.0.0.1 UH 1 63 lo0


- Configuración de IPs

# ifconfig -a

lo0: flags=2001000849 mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

bge0: flags=1100843 mtu 1500 index 2

inet 10.150.2.58 netmask ff000000 broadcast 10.255.255.255

ether 0:1e:68:4:a5:d3

nge0: flags=1100843 mtu 1500 index 3

inet 192.168.1.1 netmask ffffff00 broadcast 192.168.1.255

ether 0:1e:68:4:a5:d5

- Activación de la configuración de ipf

# ipf -Fa

# ipf -Fa -f /etc/ipf/ipf.conf

# ipfstat -ion

- Activación de la configuración de ipnat

# ipnat -l

# ipnat -FC

# ipnat -f /etc/ipf/ipnat.conf

- Monitorización del NAT

# ipmon -a


Configuración en POOL02

- Default router

# cat /etc/defaultrouter

192.168.1.1

- Rutas del equipo

default 192.168.1.1 UG 1 2 XXX




28 - Documentación:

http://blogs.sun.com/dp/entry/squid_startup_extreme_makeover_with

http://www.opensolaris.org/os/community/documentation/opensolaris_guide/;jsessionid=E8DC7D74D6FC2EE46D0FCFB6A3678BCD

http://www.sun.com/bigadmin/features/articles/ipfilter.html

http://www.rite-group.com/rich/solaris_nat.html

http://www.securityfocus.com/infocus/1380

http://software.uaemex.mx/Paginas/herramientas/ipf.html

http://www.riddleware.com/solx86/nat-config.html

http://www.riddleware.com/solx86/

2009.09.04 Mariano Obarrio