Acerca de Linux, BSD y notas personales

Archives for March, 2008

Zettabyte File System ZFS

Features:

1. 256 quadrillion zettabytes ( Terabytes, Petabytes, Exabytes, Zettabytes (1024 Exabytes))
2. RAID-0/1 & RAID-Z ( RAID-5 with enhancements ) ( 2 – required virtual devices )
3. Snapshots - read-only copies of file systems or volumes
4. Create volumes
5. Uses storage pools to manage storage – aggregates virtual devices
6. File systems attached to pools grow dinamically as storage is added
7. File systems may span multiple physical disk
8. ZFS is transactional (Similar to databases. Example: Writing 100 mb, but only 80mb is commited in a traditional file system, leaving 20 mb unwriting, and the data is corrupted, and in ZFS all is written or NONE.
9. Pools & file systems are auto-mounted. No need to maintain /etc/vfstab
10. Supports file system hierarchies: /pool1/{home(5GB),var(10GB), etc.}
11. Supports reservation of storage: /pool1(36GB)/{home(10GB),var(36–10GB)}
12. Provides a secure web-based management tool

*********** ZFS – CLI **************
# which zpool
/usr/sbin/zpool

zpool list – list known pools
zpool create pool_name(alphanumeric, _,-,:,.)

Pool Name Constraints
1. mirror
2. raidz

—— Pause: note to vmware —————————————————————-

  Add a second disk to the image in vmware

In order to add second hard disk with Fusion.

  • solaris must be halted.
  • VM must be shut down.
  • Click the + sign, add disk and enter a size.
  • devfsadm  (almost typed reboot — -r but that would be “old think” so that format sees the new device.)

format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <DEFAULT cyl 1302 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,30@10/sd@0,0
       1. c1t1d0 <DEFAULT cyl 2557 alt 2 hd 128 sec 32>
          /pci@0,0/pci1000,30@10/sd@1,0
———————————————————————————————————-

Continue….

zpool create pool_name device_name1, device_name2, device_name3, etc.

bash-3.00# devfsadm
bash-3.00# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 <DEFAULT cyl 1303 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Specify disk (enter its number): ^Z

[1]+  Stopped                 format
bash-3.00# zpool create pool1 c0d1
bash-3.00# echo $?
0

mount
/pool1 on pool1 read/write/setuid/devices/exec/xattr/atime/dev=2d50002 on Tue Mar 18 09:24:51 2008–

bash-3.00# zpool list
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
pool1                  9.94G     88K   9.94G     0%  ONLINE     -

ZFS Pool Statuses
1. ONLINE
2. DEGRADED (part of the mirror is broken or entire disk is fail, but still available)
3. FAULTED
4. OFFLINE
5. UNAVAILABLE

(Pools or datasets)

—————————-
zfs list – returns ZFS dataset info

bash-3.00# zfs list
NAME    USED  AVAIL  REFER  MOUNTPOINT
pool1  85.5K  9.78G    25K  /pool1

zfs mount – returns pools and mount points
bash-3.00# zfs mount
pool1                           /pool1

zpool status – returns virtual devices that constitute pools
bash-3.00#zpool status
  pool: pool1
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        pool1       ONLINE       0     0     0
          c0d1      ONLINE       0     0     0

errors: No known data errors

bash-3.00#zpool status -v pool1

Note: ZFS requieres a minimum of 128MB virtual device to create a pool

(Recommendation render all the disks over zfs minus /  )
var home should be separate disks for performance

——————-DESTROY ————————————————
zpool destroy pool1 – Destroys pool and associated file system

bash-3.00# zpool destroy pool1
bash-3.00# echo $?
0

—————-CREATE File systems within pool1 ———————
zfs create pool1/home - creates file system named ‘home’ in pool1

bash-3.00# zfs create pool1/home
bash-3.00# echo $?
0

bash-3.00# zfs list
NAME         USED  AVAIL  REFER  MOUNTPOINT
pool1        114K  9.78G  25.5K  /pool1
pool1/home  24.5K  9.78G  24.5K  /pool1/home

Note: Default action of  ‘zfs create pool1/home’ assigns all storage available to ‘pool1’, to ‘pool1/home’

##### Set quota on existing file system ######
zfs set quota=5G pool1/home

bash-3.00# zfs set quota=5G pool1/home
bash-3.00# zfs list
NAME         USED  AVAIL  REFER  MOUNTPOINT
pool1        114K  9.78G  25.5K  /pool1
pool1/home  24.5K  5.00G  24.5K  /pool1/home

##### Create user-based file system beneath pool1/home #####

zfs create pool1/home/zivo

bash-3.00# zfs get -r quota pool1
NAME                    PROPERTY  VALUE               SOURCE
pool1                     quota       none                 default
pool1/home             quota       5G                    local
pool1/home/pedrito   quota       none                default
pool1/home/zivo       quota       none                default

zfs get -r compression pool1
NAME                PROPERTY     VALUE               SOURCE
pool1               compression  off                 default
pool1/home          compression  off                 default
pool1/home/pedrito  compression  off                 default
pool1/home/zivo     compression  off                 default

############ Rename file systems ######################

bash-3.00# zfs rename pool1/home/zivo pool1/home/zivob
bash-3.00# echo $?
0

############ Extending dynamically, pool storage ######################
AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 <VMware V-0000000000000000-0001-10.00GB>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
       2. c1d1 <DEFAULT cyl 4093 alt 2 hd 128 sec 32>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0

bash-3.00# zpool add pool1 c1d1
bash-3.00# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
pool1                    210K  17.6G  25.5K  /pool1
pool1/home              76.5K  5.00G  27.5K  /pool1/home
pool1/home/pedrito      24.5K  5.00G  24.5K  /pool1/home/pedrito
pool1/home/zivokickass  24.5K  5.00G  24.5K  /pool1/home/zivokickass

bash-3.00# zpool status
  pool: pool1
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        pool1       ONLINE       0     0     0
          c0d1      ONLINE       0     0     0
          c1d1      ONLINE       0     0     0

errors: No known data errors

 

no hostkeys solaris 10 sshd

cat /var/svc/log/network-ssh\:default.log

Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
cd /etc/sshssh-keygen -d -f ssh_host_dsa_key -N ""ssh-keygen -b 1024 -f ssh_host_rsa_key -t rsa -N ""
 
 
 

Solaris 10 HANDBOOK

Solaris 10

  • admintools is not implemented
  • pkgchk -P instead of grep /var/sadm/install/contents
  • RBAC: Role-Based access control (kind of built in sudo)

Solaris management commands

smc Starts the Solaris management console
smcront Manage cron jobs
smdiskless Manage diskless client support
smexec Manage entries in the exec_attr database
smgroup Manages group entries
smlog Manages and views WBEN log files
smmultiuser Manages bulk operations on multiples accounts
smosservice Add OS services and diskless client support
smprofile Manages profiles in the prof_attr and exec_attr db
smrole Manages roles and users in role accounts
smserialport Manages serial ports
smuser Manages user entries

how to Reboot / Halt / Poweroff

On Solaris using the shutdown command to reboot, halt or power off your server is the best option, because this command will call the rc script.

Reboot

shutdown -i6 -g60 -y

-i : init level
-g : grace time (60 secondes in this case)
-y : Pre-answer yes

Halt

shutdown -i0 -g60 -y

Power Off

shutdown -i5 -g60 -y

How to send a break on Solaris 10 x86

You will have to boot the system with “kadb”.

From the command line

# eeprom boot-file=kadb
# reboot

OR

From the GRUB boot prompt choose edit and edit the second line

root (hd0,0,a)
kernel /platform/i86pc/multiboot kadb
module /platform/i86pc/boot_archive

Drop to kadb, generate a core file

From a directly attached keyboard or serial port connection, type:

 F1-A - press the "F1" and "A" keys, simultaneously.

You can test it to make sure it’s work and then just enter:

:c

to return to the normal mode.

The control-alt-d key sequence also works.

Once at the kadb prompt, type:

$<systemdump

This will generate a core file, which can be retrieved from:

 /var/crash/'uname -n' (or wherever the local system stores core files)

How to determine 32-bit or 64-bit?

How to determine whether a system has 32-bit or 64-bit solaris capablilities enabled

# isainfo -v
32-bit sparc applications

How to display the native instruction sets executable?

Isalist prints the names of the native instruction sets executable on this platform on the standard output

# isalist
sparcv8 sparcv8-fsmuld sparcv7 sparc

How to displays information about processors?

# psrinfo -v
Status of processor 0 as of: 01/24/07 13:03:35
  Processor has been on-line since 01/19/07 14:13:09.
  The sparc processor operates at 60 MHz,
        and has a sparc floating point processor.

How to find out if the the third processors is up?

if [ "`psrinfo -s 3 2> /dev/null`" -eq 1 ]
     then
          echo "processor 3 is up"
     fi

How to display solaris relase information?

# cat /etc/release
                       Solaris 8 10/00 s28s_u2wos_11b SPARC
           Copyright 2000 Sun Microsystems, Inc.  All Rights Reserved.
                            Assembled 31 August 2000

How to display a system’s installed memory?

# ptrconf
System Configuration:  Sun Microsystems  sun4m
Memory size: 128 Megabytes
System Peripherals (Software Nodes):

SUNW,SPARCstation-20
...

Howto show machine and software revision information

# showrev
Hostname: clust01
Hostid: 7235260f
Release: 5.8
Kernel architecture: sun4m
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain:
Kernel version: SunOS 5.8 Generic 108528-03 August 2000

Howto show patched installed list

# showrev -p | more
Patch: 109965-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWpamsc
Patch: 109618-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWeuxwe, SUNWeuezt, SUNWeudlg, SUNWeudda
Patch: 108725-02 Obsoletes: 109579-01 Requires:  Incompatibles:  Packages: SUNWcsu, SUNWcsr, SUNWhea
Patch: 108825-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu
Patch: 108875-07 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu, SUNWcsr, SUNWcsl, SUNWarc, SUNWcstl, SUNWhea
Patch: 108899-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu
Patch: 108982-05 Obsoletes: 109440-01 Requires:  Incompatibles:  Packages: SUNWcsu, SUNWhea
Patch: 108985-02 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu
Patch: 109043-02 Obsoletes:  Requires: 109041-01 Incompatibles:  Packages: SUNWcsu
Patch: 109045-02 Obsoletes:  Requires: 109041-01 Incompatibles:  Packages: SUNWcsu

How to display locales installed on a system (solaris 10)

# localeadm

How to determine if a local is installed on a system (solaris 10)

# localeadm -q

Display host id number

# hostid
723560f

How to display the user ownership of local UFS

# quot -a
/dev/rdsk/c0t1d0s0 (/):
834291  root
312013  bin
  812   uucp
  146   adm
   91   lp
   22   nobody
    4   daemon
    3   listen
/dev/rdsk/c1t1d0s0 (/opt):
538104  root
66742   bin
 2168   #3792
/dev/rdsk/c0t1d0s7 (/export/home):
    9   root

Howto configuring Telnet / FTP to login as root?

Now before getting into the details of how to configure Solaris for root logins, keep in mind that this is VERY BAD security. Make sure that you NEVER configure your production servers for this type of login.

Configure Telnet for root logins

Simply edit the file /etc/default/login and comment out the following line as follows:

# If CONSOLE is set, root can only login on that device.
# Comment this line out to allow remote login by root.
#
# CONSOLE=/dev/console

Configure FTP for root logins

First remove the ‘root’ line from /etc/ftpusers.
Also, don’t forget to edit the file /etc/ftpaccess and comment out the ‘deny-uid’ and ‘deny-gid’ lines. If the file doesn’t exist, there is no need to create it.

NOTE: If you are using Solaris 9 or Solaris 10, the ftp* files are located in /etc/ftpd

How to setup timezone?

/etc/TIMEZONE

Howto setup nis client?

  • set the domain name
domainname nis.domaine.com
  • edit /etc/hosts
#
# Internet host table
#
127.0.0.1       localhost

# NIS
192.168.1.100 nis1.domain.com
192.168.1.101 nis2.domain.com
  • ypinit
ypinit -c

pkgadd common mistake

In this example I’m trying to install the package “SUNWbash” but it could be any package, you may have been through those different cases:

# pkgadd SUNWbash                                        
pkgadd: ERROR: no packages were found in </var/spool/pkg>
 
# pkgadd ./SUNWbash                                        
pkgadd: ERROR: no packages were found in </var/spool/pkg>
 
# pkgadd /mnt/Solaris_10/Product/SUNWbash       
pkgadd: ERROR: no packages were found in </var/spool/pkg>
 
# pkgadd -d ./SUNWbash
pkgadd: ERROR: no packages were found in </mnt/Solaris_10/Product/SUNWbash>

In the three first cases “pkgadd” looks in the default folder “/var/spool/pkg” in order to find packages and install them but none is found. In the fourth case the package himself is defined as a folder containing packages, that’s why it fails.
The right solution is:

# pkgadd -d /mnt/Solaris_10/Product/ SUNWbash
or
# pkgadd -d $PWD SUNWbash

Thus pkgadd will consider “/mnt/Solaris_10/Product/” as default folder and “SUNWbash” as package to install.

Where is the packages folder

/var/sadm/pkg/

Package installed

/var/sadm/install/content

Which package owns an installed file

pkgchk -l -p /usr/bin/ls

If you cannot access your sun box, ssh/ftp/console whatever

Then try and issue a break from the console.

telnet> sent brk
Type  'go' to resume
{0} ok
{0} ok boot -s
Resetting ...

OBP Quick Memo

SEND A BREAK

From a telnet session:

ctrl+]
send brk

From a ssh session:

~break

Quick memo

help (show categories)

help sys (show sys help)

printenv (varible name and status)

setenv (to change)

setenv auto-boot? true

banner (show the mac address)

prob-scsi-all (find all scsi devices, show number off harddrives)

boot -s ( single user mode)
boot cdrom -s (boot single user mode from the cdrom)
boot net (boot network)

boot net:dhcp - install (Boot install using jumpstart with DHCP)

boot net - install (Boot install using jumpstart with Bootp)

boot cdrom - install (Boot install using the cdrom)

devalias (same as /etc/path_to_inst)

devalias toto /sbus/SUNW,fdtwo

show-devs (show all dev)

show-nets (show net interface)

set-default

From the running os:

eeprom

 Unless you’ve changed the system’s configuration, mounting
CD/DVD media is supposed to happen automatically, with the
help of the “vold” daemon.

The CD/DVD will be mounted somewhere in /cdrom/xxxx with a
symbolic link /cdrom/cdrom0 pointing to the root directory of the
media.

If you’ve disabled “vold”, of if you didn’t install it, manual mounting
works like this:

1. iostat -En
This command can be used to print a list of SCSI/ATAPI/USB/
Firewire disk/cdrom/dvdrom devices. Note the disk id in front
of the entry, for example “c1t1d0″:

% iostat -En
c1t1d0           Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: HL-DT-ST Product: DVDRAM GMA-4020B Revision: A105 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 1 Predictive Failure Analysis: 0

2. Manually mount the device, using the device id from the above
iostat command, with slice “s2″ appended (on Solaris x86:
append “p0″).

# mount -F hsfs /dev/dsk/c1t1d0s2 /mnt
——SOLARIS X86–—-mount -F hsfs /dev/dsk/c1t0d0p0 /mnt

Solaris Init RunLevels

init is a legacy unix and linux application generally responsabily of the process running in the system.

 

###Grand Unified Bootloader ####
1. BIOS ( Ensure hardware health) CPU (s), Memory, Hard Disk(s)
2. GRUB (Present menu to user and defaults to a selection within timer)
3. OS Kernel (Solaris / Linux / Windows / etc )
4. Sched – Pid 0
5. INIT
6. SMF
7. Operational Single / Multi-User System

### INIT in detail ####

init is represented in the process table as PID 1

which init
/usr/sbin/init

INIT’s config file is: /etc/inittab

init table ( reads inmediatly the inittab )

Supported Runlevels: 0 – S

0 – shutdown runlevel
1 – Single User Mode – No networking support is provided
2 – multi-user support without nfs
3 – multi-user support with NFS (Default Runleve)
4 – unused
5 – interactive boot
S – Single User Mode – No networking support is provided

###### /etc/inittab ############################################

id:run_state (0–6):how_to_run_process
(boot,bootwait,initdefault,off,once,powerfail,powerwait, sysinit,wait)
:what process to run

ap::sysinit:/sbin/autopush -f /etc/iu.ap
sp::sysinit:/sbin/soconfig -f /etc/sock2path
smf::sysinit:/lib/svc/bin/svc.startd    >/dev/msglog 2<>/dev/msglog </dev/console
p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog

 

 

mysql

Hi All,

This is my first blog and I am going to start off with some content which could potentially help others who had gone through some of the common obstacles and blockers of installing MySQL 5.0 on Solaris 10. What motivates me to write this is that it was difficult for me find a comprehensive and workable “one paged” tutorial of doing this. After spending much time on the internet looking for clues and finally making the MySQL installation a success, I’ve decided to glue and share these pieces of information with others as well.


Assumption

  1. Readers are assumed to have at least some basic Unix/Linux administrative skills.
  2. Readers are assumed to have FRESH running copy of Solaris 10 6/06.
  3. Readers are assumed to have NO previously installed MySQL version in the system.
  4. Readers are assumed to have backed up any critical data before the installation.
  5. The MySQL version used for this tutorial is 5.0.24 Community Edition.
  6. Readers are to take full responsibility of any potential software, data, hardware, financial and life damages prior to following this tutorial.

Downloads

Please obtain a copy of MySQL 5.0 from http://dev.mysql.com/downloads/mysql/5.0.html. For the Solaris 10 MySQL packages, please scroll the page down the section of “Solaris (pkgadd package) downloads”. Choose the appropriate processor architecture of the package (either x86 or SPARC). Download the packages (both Standard and Max) and save them in an appropriate directory. I will use “/usr/files” as the directory where the mysql-xxx.pkg.gz files were placed through out the tutorial (Please take note that the xxx is the version number and is to be replaced by the actual text in the file name).

Preparation

Please perform the following as the root user. We have to make sure that any other previously running copies of MySQL are to be uninstalled from the system.

  1. login as “root
  2. To list all the packages, type: pkginfo | grep mysqlat the shell.
  3. If you see any listed packages, you may remove them by typing “pkgrm <pkg_name>” The names of the packages are list at the second column of after executing pkginfo.
  4. Change the directory to the place where you’ve downloaded the mysql-xxx.pkg.gz files. (e.g. “cd /usr/files”). If the files were compressed by gzip and you can see the .gz extension at the end of the files, you may decompress them by typing “gzip –d mysql-xxx.pkg.gz”. Decompress the downloaded mysql-xxx.pkg.gz files.


Installation

Follow these steps to perform the installation (perform as “root”):

  1. Create the mysql group by typing “groupadd mysql”.
  2. Create the mysql user by typing “useradd -g mysql mysql”.
  3. Change the directory where the MySQL packages were placed. “cd /usr/files”.
  4. First install the “Standard” package by typing: “pkgadd -d mysql-standard-xxx.pkg”. Just accept the default install directory (/opt/mysql) when prompted and go through the installation process.
  5. Next, install the “Max” package by typing: “pkgadd –d mysql-max-xxx.pkg”. Just accept the default directory when prompted and go through the installation process.
  6. The MySQL should have been installed in “/opt/mysql/mysql”.
  7. Change the directory to /etc/init.d and edit the “mysql” file with any text editor. Locate the line which states: “datadir=<something>“. Change the line to “datadir=/opt/mysql/mysql/data“. Save the changes.
  8. After the installation, change the path to “/opt” and type this: “chown -R mysql:mysql mysql”. This is to change the ownership of the whole mysql directory.


Initiallizing the Database

  1. Change the operating user from “root” to “mysql” by tying: “su mysql”.
  2. Change the working directory to “/opt/mysql/mysql/scripts” by typing: “cd /opt/mysql/mysql/scripts”.
  3. Execute the mysql_db_install script by typing: “./mysql_install_db –user=mysql –ldata=/opt/mysql/mysql/data”.
  4. Change the working directory to “/opt/mysql/mysql/bin”.

  5. Start the database by typing: “./mysqld_safe –datadir=/opt/mysql/mysql/data –user=mysql &”.
Connecting to MySQL

Try to connect to the MySQL database by typing “mysql” as the root user. You should be able to see the “mysql>” prompt for the successful connection. The only user which could connect to the database now is the root user and it doesn’t require a password. For more information on user account management, please visit http://dev.mysql.com/doc/refman/5.0/en/user-account-management.html.


I hope this will help those who are trying to install the MySQL 5.0 database on the Solaris 10 OS for the first time. These pieces of software are some of the greatest works which were created by some of the most beautiful minds ever existed. Enjoy…

PHP

This script will configure a web server instance to run PHP scripts.
usage :
     setupPHP -instancename=<instance name> [-sapi=nsapi|fastcgi]
Examples:
     setupPHP -instancename=https-php
     setupPHP -instancename=https-php -sapi=nsapi
bash-3.00# setupPHP -instancename=https-miservidor.com
bash: setupPHP: command not found
bash-3.00# ./setupPHP -instancename=https-miservidor.com

UPDATED: /sun/webserver7/https-miservidor.com/config/magnus.conf
UPDATED: /sun/webserver7/https-miservidor.com/config/solarisapp-obj.conf
UPDATED: /sun/webserver7/https-miservidor.com/config/miservidor.com-obj.conf
UPDATED: /sun/webserver7/https-miservidor.com/config/mime.types
   
Setup was sucessful.
——————–

The following steps are necessary to make the changes to all the nodes.

(1) Start the admin server

    /sun/webserver7/admin-server/bin/startserv

(2) Connect to the admin server using wadm command

    /sun/webserver7/bin/wadm [--user=admin-user] [--password-file=admin-pswd-file] [--host=admin-host] [--port=admin-port]

(3) Pull the modified config from the node to config store
    using the following command in wadm console:

    pull-config –config=miservidor.com nodehost
   
    For Example: If the host name for the node is xyz.com then enter the command like,
   
    pull-config –config=miservidor.com xyz.com

(4) Deploy the new changes to all nodes using
    the following command in wadm console:

    deploy-config miservidor.com

 

 

Directorio de Instalación

 

/sun/webserver7

admin

https://miservidor:8989

Solaris SSHD

svcadm enable ssh

Configuring networking

 

Keith Parkansky
http://www.execpc.com/~keithp

Last revised: May 1, 2002

Networking information in Solaris is stored in text files. Configuration is done by filling in the appriopriate data to these files and invoking specific commands in a terminal window.

  1. Pop up the menu above the “Text Note” icon and click on Text Editor. Use the editor to open the file:
      /boot/solaris/devicedb/master
    

    and use the Find feature (under Edit on the menu bar) to locate the model number of your NIC - example: 3C905 (3Com) or 9432 (SMC). Note that the Find feature is case sensitive in the CDE text editor.

  2. If your NIC is in the HCL it will be in the master file. The line for the SMC 9432 I’m using in my system looks like this:
      pci10b8,a011 pci10b8,a011 net pci spwr.bef
    

    I have the “spwr.bef” bolded because this is the driver name and you’ll need to know the driver name for other files. Remember it.

    I’ll save you some work if you have a 3Com 3C905 NIC. The line will be:

      pci10b7,9200 pci10b7,9200 net pci elxl.bef
    
  3. Use the editor to open the file:
      /etc/driver_aliases
    

    (Opening this file will automatically close the master file.) If your NIC is supported it will be listed here also. The line for my SMC NIC was:

      spwr "pci10b8,a011"
    

    which you can see is the same information found in the master file just rearranged a bit.

  4. If you know what is the actual device driver name for your NIC you can verify if the device was properly detected and the driver loaded by looking in /dev directory and searching for files which names begin with the driver name, eg. /dev/spwr0 or /dev/elxl0 for devices used in our example. The number after the driver name in the file name is the consecutive number of the NIC in your system (numbered 0, 1, 2, etc.) using the same driver.
  5. Use the editor to open the file:
      /etc/hosts
    

    and enter a new line in it with the IP address you want to give the system on your network and its’ hostname. I called my machine “solarisi” so I entered:

      192.168.10.20     solarisi solarisi.bigsunfan.com     loghost
    

    Make sure you press Enter after typing this in to create a new (blank) line beneath it!

    With your changes, the resulting the file should look like this:

      127.0.0.1          localhost
      192.168.10.20      solarisi solarisi.bigsunfan.com     loghost
    

    Note that the bigsunfan.com domain need not to be a registered domain. I simply use it as an example.

    Don’t forget to save the file. Click on File on menu and select Save.

    A note about Sendmail and the hosts file.

    Sendmail is a mail server, or more professionally, a Mail Transport Agent, MTA in short. It is installed by deafult and started automatically when you boot your system. Sendmail is picky when it comes to FQDNs (Full Qualified Domain Names). When you booted your system you may have seen the infamous Sendmail error:

      sendmail[nnn]: My unqualified host name (solarisi) unknown;
      sleeping for retry
    

    If you are not going to run a mail server, simply turn Sendmail off by renaming its startup file:

    mv /etc/rc2.d/S88sendmail /etc/rc2.d/noS88sendmail

    Otherwise, you need to specify FQDN of your host in /etc/hosts file. For more details see Configuring Sendmail tutorial.

  6. Check if the file
      /etc/hostname.driver_nameNIC_number
    

    exists. Use the ACTUAL WORD “hostname” in the name of the file, NOT the hostname you gave your system. The driver_name is the name I said you should remember above, and the NIC_number is the number of the NIC in your system. Since I only have one NIC in my system, my file was named:

      /etc/hostname.spwr0
    

    The file should contain your host name, the same as in /etc/hosts file. If there is no such file, or it contains improper value you need to correct it.

    You could also enter the IP address instead of the host name which is needed if you want to assign multiple IP addresses to a single interface, such as with hosting multiple Web sites on a single server (Apache’s virtual hosting), create multiple files using the above naming convention but append a :1 and :2 etc. to the file name for each additional file. Each file should have a single, different IP address. For example:

    /etc/hostname.spwr0       contains 192.168.10.20
    /etc/hostname.spwr0:1 contains 192.168.10.21
    /etc/hostname.spwr0:2 contains 192.168.10.22
  7. Now you set up an appropriate subnet mask. Open the file
      /etc/netmasks
    

    and the top of the file has comments that explain the contents. You basically just enter your “network number” (NOT your system’s IP address) followed by the subnet mask for your network. Given that the address I gave my system above (192.168.10.20) is a Class C IP address, my netmasks file looked like this:

      192.168.10.0        255.255.255.0
    

    The following table may help you determine what your network number and subnet mask should be based on the first number of your system’s IP address:

    IP Number Class Network Address Range Subnet Mask Private Address Range
    A 1.0.0.0 to 126.0.0.0 255.0.0.0 10.x.x.x
    B 128.0.0.0 to 191.255.0.0 255.255.0.0 172.16.x.x to 172.31.x.x
    C 192.0.0.0 to 223.255.255.0 255.255.255.0 192.168.0.x to 192.168.255.x

    If you’re setting up a small network in your home or office and you’re not sure what IP address to use, use any address given in the “Private Address Range” above for a Class C network. This will allow you to have up to 254 nodes (aka “hosts” in TCP/IP lingo) on your network.

    Once you’ve got the appropriate network and mask addresses entered, save the file.

  8. The /etc/hosts file mentioned above is used to resolve machine names to IP addresses on your local network. If you are connecting your system to a network that is connected to the Internet and you plan to use it to surf the Web, or have another need to resolve Internet domain names, you’ll need to specify your ISP’s DNS servers. This is done using another file called
      /etc/resolv.conf
    

    Note:  When you save the following newly created files the /etc directory should already be selected as the target for the saved file. That’s why no path is specified for file saves. However, verify that //etc/ is in the “path or folder name” field when saving these files.

    Create the new file using the text editor by clicking on File and then on New and enter the following lines:

      domain enter-your-ISP's-domain
      nameserver enter-IP-address-of-primary-DNS-server
      nameserver enter-IP-address-of-secondary-DNS-server
    

    Be sure to hit Enter at the end of the last line and then save the file with the name resolv.conf

    The above file is used if your system is not part of a domain. If it is, ex: you are going to use your system as an Internet server, you have to list your domain name on the domain line and list your ISP’s domain (for DNS) using the search keyword. For example:

      domain your-domain.com
      nameserver 172.31.214.78
      nameserver 10.138.14.2
      search your-ISPs-domain.com
    
  9. If your system is on a network that has a default gateway, you’ll need to create
      /etc/defaultrouter
    

    file for tha. If your system is going to be an Internet server the default gateway is likely the address of the router interface that connects you to your ISP.

    Create a new file using the text editor (click on File and then on New) and simply enter one IP address. This IP address however will be for your default gateway. Be sure to hit Enter at the end of the address and then save the file as /etc/defaultrouter

  10. Unfortunately, simply creating the resolv.conf file earlier doesn’t mean your system will automatically start to use it. Again, this file is only necessary if you will use your system to access the Internet or other large network where DNS servers are used to resolve system names. This includes simply using your system as a workstation to surf the Web. It doesn’t have to be a server.

    Yet another file called nsswitch.conf is used to “tell” your system which name resolution methods to use (host files, DNS, etc) and in which order to use them. Fortunately, the Solaris installation includes several different pre-written versions of the nsswitch file. The default file only uses the host file to resolve machine names.

    In order for your system to use DNS servers, you’ll have to issue the following command at the # prompt in a “This Host” window:

    cp /etc/nsswitch.dns /etc/nsswitch.conf

    Note:  At this stage all files related to network configuration are filled in, but the notworking on your system is not yet working properly. You can either reboot your system by typing in init 6 to make Solaris to reread configuration files and setup networking accordingly, or alternatively perform the following steps.

  11. Plumb the network interface with the following command

    ifconfig spwr0 plumb

  12. Make the interafce up by typing in

    ifconfig spwr0 192.168.10.20 netmask 255.255.255.0 up

    The IP part 192.168.10.20 of the above command is the IP assigned to the interface, in other words the IP of your host, and the netmask part 255.255.255.0 is the netmask specified in /etc/netmasks file.

    You should now be able to communicate with systems on your local network. You can verify this with ping command.

  13. Add the default route to routing table as follows

    route add default 192.168.10.1

    where 192.168.10.1 is the IP of the gateway on your network. This should be the IP specified in /etc/defaultrouter file discussed above.

You should now be able to communicate with all systems on the Internet. Verify this with ping command, or simply fire up a web browser.

Related man pages:

  • hosts,
  • resolv.conf,
  • nsswitch.conf,
  • netmasks,
  • defaultrouter,
  • ifconfig
  • route
  • ping.