Thursday, February 14, 2008

Asterisk TTS example on 1.4

Following previous posts the following examples can be use to test the usage of TTS from the dialplan in Asterisk.

Example 1:
We set up small script that will be executed from the Asterisk dialplan. This script will take as parameter the text that will be transform to a wav file to later be played.

On extensions.conf configure the following extensions:

exten => 1222,1,Answer()
exten => 1222,n,Set(TEST="Welcome to TTS example")
exten => 1222,n,System(/tmp/test2.sh ${TEST})
exten => 1222,n,Playback(/tmp/test)
exten => 1222,n,Hangup()


On /tmp/test2.sh (add necessary rights to the file) configure the following shell script:

#!/bin/bash
#delete any previous file
/bin/rm -rf /tmp/test.wav

#Convert the text to a wav file
/opt/swift/bin/swift -o /tmp/test.wav -p audio/sampling-rate=8000,audio/channels=1 " $@"

#Don't run sox until swift is done
wait
/usr/bin/sox /tmp/test.wav /tmp/newtest.wav trim 7.5

#copy the old file with the trimmed file
/bin/cp /tmp/newtest.wav /tmp/test.wav


Sox is an application that allows you manipulate/convert audio files from the command line. The page with information about it is http://sox.sourceforge.net/. The installation is quite simple on Debian "apt-get install sox".

The content of the asterisk variable ${TEST} is send as parameters of the shell script. The script uses $1...$n as parameters but you can use $@ to use all the parameters sent. (there must be a better way!! to do this). The following line convert the text into a wav file and save it as /tmp/test.wav.

/opt/swift/bin/swift -o /tmp/test.wav -p audio/sampling-rate=8000,audio/channels=1 " $@"

Once we run it we use sox to trim the first 7.5 seconds of the file that we don't need for this test. This creates a new file named newtest.wav (original no?)

Finally we rename the file to the original name and is later played by asterisk dialplan with the command "exten => 1222,n,Playback(/tmp/test)"

Note this is just a demo/test/proof of concept. For production you should buy some licenses and evaluate the usage of the app_swift from Asterisk to improve this.

Example2:
Using the example below we create a demo "time of the day" service.

The configuration of the extensions.conf file is pretty much the same but we remove the commands to send a text to it.

exten => 1222,1,Answer()
exten => 1222,n,System(/tmp/test2.sh)
exten => 1222,n,Playback(/tmp/test)
exten => 1222,n,Hangup()


The script only has the details to get the different elements of the date from the unix system and concatenate them on a single string to be converted to wav file later by swift. The shell looks like this:

#!/bin/bash
hour=`date +'%l'`
am=`date +'%p'`
minute=`date +'%M'`
day=`date +'%d'`
month=`date +'%B'`
year=`date '+20%y'`

texto="The current time is $hour:$minute $am . Today is the $month-$day-$year "


#delete any previous file
/bin/rm -rf /tmp/test.wav

#Convert the text to a wav file
/opt/swift/bin/swift -o /tmp/test.wav -p audio/sampling-rate=8000,audio/channels=1 " $texto"

#Don't run sox until swift is done
wait
/usr/bin/sox /tmp/test.wav /tmp/newtest.wav trim 7.5

#copy the old file with the trimmed file
/bin/cp /tmp/newtest.wav /tmp/test.wav
#!/bin/bash


The played TTS can be improved to make it more user friendly.

Other date options:
man strftime
%A is replaced by the locale's full weekday name.
%a is replaced by the locale's abbreviated weekday name.
%B is replaced by the locale's full month name.
%b or %h is replaced by the locale's abbreviated month name.
%C is replaced by the century (a year divided by 100 and truncated to an integer) as a decimal number (00-99).
%c is replaced by the locale's appropriate date and time representation.
%D is replaced by the date in the format ``%m/%d/%y''.
%d is replaced by the day of the month as a decimal number (01-31).
%e is replaced by the day of month as a decimal number (1-31); single digits are preceded by a blank.
%H is replaced by the hour (24-hour clock) as a decimal number (00-23).
%I is replaced by the hour (12-hour clock) as a decimal number (01-12).
%j is replaced by the day of the year as a decimal number (001-366).
%k is replaced by the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank.
%l is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank.
%M is replaced by the minute as a decimal number (00-59).
%m is replaced by the month as a decimal number (01-12).
%n is replaced by a newline.
%p is replaced by the locale's equivalent of either ``AM'' or ``PM''.
%R is replaced by the time in the format ``%H:%M''.
%r is replaced by the locale's representation of 12-hour clock time using AM/PM notation.
%T is replaced by the time in the format ``%H:%M:%S''.
%t is replaced by a tab.
%S is replaced by the second as a decimal number (00-60).
%s is replaced by the number of seconds since the Epoch, UCT (seemktime(3)).
%U is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number (00-53).
%u is replaced by the weekday (Monday as the first day of the week) as a decimal number (1-7).
%V is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (01-53). If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is week 53 of the previous year, and the next week is week 1.
%W is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (00-53).
%w is replaced by the weekday (Sunday as the first day of the week) as a decimal number (0-6).
%X is replaced by the locale's appropriate time representation.
%x is replaced by the locale's appropriate date representation.
%Y is replaced by the year with century as a decimal number.
%y is replaced by the year without century as a decimal number (00-99).
%Z is replaced by the time zone name.
%% is replaced by `%'.

Cepstral Allison on Asterisk 1.4 Test

Download the Ceptrals voice of your preference and system. I like Allison particularly better than the UK one.

Do the download on /usr/src.

lmntel01:/usr/src# wget http://downloads.cepstral.com/cepstral/i386-linux/Cepstral_Allison_i386-linux_4.2.1.tar.gz
--22:01:46-- http://downloads.cepstral.com/cepstral/i386-linux/Cepstral_Allison_i386-linux_4.2.1.tar.gz
=> `Cepstral_Allison_i386-linux_4.2.1.tar.gz'
Resolving downloads.cepstral.com... 216.92.127.89
Connecting to downloads.cepstral.com|216.92.127.89|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 107,474,833 (102M) [application/x-tar]

100%[========================================>] 107,474,833 1.15M/s ETA 00:00

22:03:26 (1.03 MB/s) - `Cepstral_Allison_i386-linux_4.2.1.tar.gz' saved [107474833/107474833]

lmntel01:/usr/src#


Untar the file and enter the directory:

lmntel01:/usr/src#tar -xzvf Cepstral_Allison_i386-linux_4.2.1.tar.gz
lmntel01:/usr/src#cd Cepstral_Allison_i386-linux_4.2.1

Execute the installation script:

lmntel01:/usr/src/Cepstral_Allison_i386-linux_4.2.1/#./install.sh


The installation process goes like this:

Do you agree to these terms? Enter -yes- to continue: yes

Install into what directory? [/opt/swift]

Swift will be installed in the following directories:

Voices in /opt/swift/voices
Shared libraries in /opt/swift/lib
Binaries in /opt/swift/bin
Configuration file in /opt/swift/etc
Header files in /opt/swift/include
Examples in /opt/swift/examples
Sound effects filters in /opt/swift/sfx
Documentation in /opt/swift/doc

Is this acceptable? Enter 'yes' to continue: yes


Installing libraries...

***************************************************************************
If you are installing Swift system-wide, you may need to add the following
line to /etc/ld.so.conf and run ldconfig as root:

/opt/swift/lib

(Otherwise, you will need to add it to the LD_LIBRARY_PATH environment
variable in order to run programs linked against the Swift libraries.)
***************************************************************************

Installing voice Allison...

Creating configuration...

Installing binaries...
Installing symbolic link to swift...
Installing man page...

Setting permissions...

Testing the installed swift binary...
/opt/swift/bin/swift -o /dev/null 'hello world'

***************************************************************************
****************** Installation Completed Successfully! *******************
***************************************************************************

lmntel01:/usr/src/Cepstral_Allison_i386-linux_4.2.1/#


After this you must restart Asterisk and after the reboot to confirm the installation run the command below and check the outpu.

lmntel01:/usr/src/Cepstral_Allison_i386-linux_4.2.1/#asterisk -rx "core show application swift"

-= Info about application 'Swift' =-

[Synopsis]
Speak text through Swift text-to-speech engine.

[Description]
Swift(text) Speaks the given text through the Swift TTS engine.
Returns -1 on hangup or 0 otherwise. User can exit by pressing any key.

-- Remote UNIX connection
rbast:~/Cepstral_Allison_i386-linux_4.2.1#


Also you can generate a TTS wav file on the command line by running:

To test the installation you can:
/opt/swift/bin/swift -o /tmp/test.wav -p audio/sampling-rate=8000,audio/channels=1 "This is a test."

And finally just create an extension on the context of your choice to play it:

exten => 1234,1,Answer()
exten => 1234,2,Playback(/tmp/test)
exten => 1234,3,Hangup()

You will notice that as there is not a license for this package you will hear an introduction message asking you to buy a license on Cepstral web site.



Saturday, February 09, 2008

Asterisk Voicemail - Quick Exim4 notes

After installing asterisk I set up the voicemail configuration. First un apt-get install exim4 and then run pkg-reconfigure exim4-config and follow the instructions.

After the configuration exim4 should restart itself but if not use /etc/init.d/exim4 restart.

Configure the voicemail.conf file as follows:

[general]
format=wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
pbxskip=yes
fromstring=Voicemail
emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}. The message is attached. Thanks!\n\n\t\t\t\t\n
emaildateformat=%A, %B %d, %Y at %r
sendvoicemail=no
delete=yes

[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM

[default]
89300 => 89300,User1,user1@mailserver.com



Now on Sip.con add the mailbox line (mailbox account and context of voicemail.conf)

[89300]
type=friend
regexten=89300
context=default
mailbox=89300@default
secret=89300
username=89300
callerid="User1" <89300>
host=dynamic
nat=yes
canreinvite=no
disallow=all
allow=alaw
allow=ulaw
dtmfmode=inband



Finally on extensions.conf set each SIP extensions (will use macros later) to wait for 20 seconds and go to Voicemails as follows:

[default]
exten => 89300,1,Dial(SIP/89300,20)
exten => 89300,2,VoiceMail(89300@default)
exten => 89300,3,PlayBack(vm-goodbye)
exten => 89300,4,HangUp()

Friday, February 08, 2008

Set H323 trunk between Asterisk and Avaya

Once asterisk and H323 is installed (previous post) follow the below configuration files to have the ip trunk up and running do the following configuration:

Setup h323.conf, sip.conf and extensions.conf as the examples below:

The h323.conf just defines the link between the Avaya and the Asterisk server.

/etc/asterisk/h323.conf
; The NuFone Network's ;
Open H.323 driver configuration
;
[general]

port = 1720

bindaddr = 192.168.58.227
disallow=all

allow=alaw

dtmfmode=inband
gatekeeper = DISABLE
context=default

progress_setup = 8
progress_alert = 8

h245tunneling=yes


[Avaya]

type=friend
context=default
host=192.168.58.216
port=1720

disallow=all
allow=alaw,g729,gsm,slinear


On sip.conf I set two demo extensions 89301 and 89300. This are numbers similar to my Avaya extension range and they also match a DDI range.


/etc/asterisk/sip.conf
[general]
context=default
allowoverlap=no

bindport=5060

bindaddr=0.0.0.0

srvlookup=yes


[89300]

type=friend
regexten=89300

context=default
secret=89300
username=89300

callerid="User1" <89300>
host=dynamic

nat=yes
canreinvite=no
disallow=all

allow=alaw

allow=ulaw
dtmfmode=inband


[
89301]
type=friend

regexten=89301

context=default
secret=89301
username=89301

callerid="User2" <89301>

host=dynamic

nat=yes
canreinvite=no

disallow=all

allow=alaw

allow=ulaw

dtmfmode=inband



On extensions.con I set up a basic dial plan to send sip calls to each sip phone and calls from the sip phones to the Avaya system.


/etc/asterisk/extensions.conf

; extensions.conf - the Asterisk dial plan
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no

[globals]
TRUNKMSD=1

[default]
;Simple direct to sip extensions
exten => 89300,1,Dial(SIP/89300)
exten => 89301,1,Dial(SIP/89301)

;Simple rule to divert all calls from Sip extensions to Avaya extensions and External numbers on PSTN.

exten => _8XXXX,1,Dial(H323/${EXTEN}@Avaya); Avaya Extension
exten => _90ZXXXXXXXXX,1,Dial(H323/${EXTEN}@Avaya); External National UK Number


Configure the Avaya side:

The first thing to check is to see if you have the following:
a. On system-parameters customer-options in the second page you must have enough Maximum Administered H.323 Trunks to use.
b. A CLAN to use.
b. A MEDPRO to use.

Note that my Avaya PBX is a CM version 3.1.2, there might be other requirements that I might be missing.

1) Set up the names of the Avaya CLAN and the Asterisk server on node-names ip
(in the image below lmntel01 would be my Asterisk ip address and 192.168.58.216 my clan address)



2) Below are the details of my CLAN, note the network region defined. In this case 6.



3) The configuration of the CLAN is shown below:



4) The network region 6 has the following configuration:









c) The network region 6 has defined ip-codec 6 taht has the following codecs (NOTE: the use of this codecs is due system configuration/hardware limitiations. You should try to use something else than G729)




d) Now you have to define the IP Trunk and IP Signaling group. You have to create both on sync, below just the final output.






Note that the Supplementary Service Protocol needs to be set to "a" to allow the passing of call info (extension number, name, etc) from and to the two systems. This will be shown at the end of this post in an Avaya to Asterisk extension call.









e) At this stage you should have the H323 IP trunk up and running between the two systems. You might require a busyout of signalig group/trunk to bring it up.






f) The next step is to define the routing off calls from the Avaya to the Asterisk box using the new trunk created.

First I set up on the uniform-dial-plan that all my extensions begining wiht 893xx and 5 digits should use the ARS table. My Avaya dial plan is of 5 digits, and I do an inc-call-handling-trmt to change external DDI to an internal extension. For example 02070189301 is set to the internal number 89301, note that 89301 is NOT an extension that is defined on the Avaya system.



Then on the ARS analysis table I defined that the 893xx range should use the route pattern 66. (not sure which call type I have to use, on my test the last one was natl therefore it was left like that).



Finally the route-pattern 66 is defined using the trunk 66 previously created and that would be all the configuration needed.



One final step that I had to do was to complete my public-unknown-numbering table. I found on the test that while the extension name was sent to the asterisk server the extension name was not. External calls to the DDI worked fine and the caller number was passed but when calling from an internal extension there was a problem.

After googling and checking this I found that by setting the first digits of my Avaya extensions and the trunk all the Avaya extensions sent the number to the Asterisk server and were display on the IPSoftphone being used for testing.



An example of a call using X-Lite sofphone is below. From extension 84562 on my Avaya PBX I placed a call to extension 89300 on the Asterisk server. The configuration of 84562 is below:



You can see on the result that the name and the extension number is sent to Asterisk. This is due using Supplementary Service Protocol a on the second page of the trunk 66 definition as mentioned before.

Installing Asterisk Again with H323 support

I never put live my old installation, then a few weeks later I lost the machine where it was and then I just simple forget. Now after playing a little here are the details for the installation (again).

(this was compiled from a few sites and my notes)

I located all my files on /usr/src

asterisk-1.4.12.1.tar.gz
asterisk-addons-1.4.3.tar.gz
libpri-1.4.1.tar.gz
zaptel-1.4.5.1.tar.gz
openh323-v1_18_0-src-tar.gz
pwlib-v1_10_3-src-tar.gz

(you will need to untar the files -- tar -xzvf -- )

cd /usr/src

Install Zaptel
cd zaptel-1.4.5.1
./configure
make menuselect
make
make install ---> as root
make config ---> as root
cd ..

make config Note:
If you have any zaptel hardware it is now recommended to edit /etc/default/zaptel or /etc/sysconfig/zaptel and set there an optimal value for the variable MODULES .

Install Libpri
cd libpri-1.4.1
make
make install ---> as root
cd ..


Install pwlib
cd pwlib_v1_10_3
./configure --prefix=/usr
make opt
make install

export PWLIBDIR=/usr/src/pwlib_v1_10_3
cp $PWLIBDIR/lib/libpt_linux_x86_r.so.1.10.3 /usr/lib
cd ..

We copy the shared library manually into the system folder.

It is very important that you set the PWLIBDIR to your path, othewise OpenH323 will not find it.

Install openh323
cd openh323_v1_18_0
./configure --prefix=/usr./configure --prefix=/usr
make opt
make install
export OPENH323DIR=/usr/src/openh323_v1_18_0
cp $OPENH323DIR/lib/libh323_linux_x86_r.so.1.18.0 /usr/lib
cd ..

Install Asterisk
cd asterisk-1.4.12.1
./configure --prefix=/usr
make menuselect

At this point use the menuselect utility to select which Zaptel hardware - if any - you have on board. Please remeber that if you want to exit keeping the changes you made, you must press x, while q will quit without saving and the left arrow will get you back to the previous menu. Even if you do not have Zaptel hardware, you should compile the ztdummy driver.

On the channels menu you will be able to see the chan_h323 availabble for installation.



make

When you compile with make you will get the error shown on the image below therefore you will have to run the make command again:



make

make install
make samples
cd ..


This should be it. I checked that my /etc/zaptel.conf was missing. Not sure if this is because I didn't have any hardware installed. Just in case I copied
cp /home/ricardo/asterisk_intall/zaptel-1.4.5.1/zaptel.conf.sample /etc/zaptel.conf

Run the moprobe on zapte/ztdummy

modprobe zaptel
lsmod
modprobe ztdummy
lsmod

Change the default zone on zaptel.conf to UK

vi /etc/zaptel.conf

loadzone=uk

After starting Asterisk and logging into the console type the command show channeltypes to check that H323 has been install and is running.




Then you have to follow the next post with the details of the Avaya-Asterisk H323 ip trunk.

Please check this website for more details on the h323 installation:
http://astrecipes.net/index.php?q=astrecipes/compiling+asterisk+1.4+with+tdm400+and+h323

Solaris tips (for the CMS)

I had to use the following tips time to time so I am posting them here to save me the time to look for them again (and avoid the possibility of the original sites going off-line).


1. Set up your /etc/hosts file.

It should look something like this:

127.0.0.1       localhost
192.168.0.150 solaris-box-1 solaris-box-1.yourdomain.com loghost

Make sure the second line has the correct IP address, hostname, and FQDN. The first line is the loopback entry. Along with #5, Solaris will know its name and IP address.

2. Create or edit /etc/nodename

Contains the hostname of the computer (same as hostname.hme0).

# cat nodename
solaris-box-1


3. Create or edit /etc/defaultrouter

Surprisingly enough, this file contains the IP address of your default router (or gateway). When you reboot and the network initialization scripts run, it will add a default route to the IP address in this file.

# cat defaultrouter
192.168.0.1


Now it knows about it's own network parameters and it's time to get it to use DNS. The next steps will tell it to use other nameservers. If you want to set up a nameserver on the local machine, see the man page for named.


4. Edit /etc/nsswitch.conf

If you haven't edited this file before, it should look suspiciously like like this:

passwd:     files
group: files
hosts: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
# At present there isn't a 'files' backend for netgroup; the system will
# figure it out pretty quickly, and won't use netgroups at all.
netgroup: files
automount: files
aliases: files
services: files
sendmailvars: files

Add the word 'dns' after 'files' on the 'hosts' line:

passwd:     files
group: files
hosts: files dns
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
# At present there isn't a 'files' backend for netgroup; the system will
# figure it out pretty quickly, and won't use netgroups at all.
netgroup: files
automount: files
aliases: files
services: files
sendmailvars: files

Now it knows to query a nameserver when looking up a name. Next we have to tell it what nameservers to use:


5. Create or edit /etc/resolv.conf

Here you tell it three things:

  1. What domain we're in
  2. Specify any additional search domains
  3. What the nameservers are (it will use them in the order you put them in the file)

When you're done it should look something like this:

# cat resolv.conf
domain yourdomain.com
search yourdomain.com
search client1.com
nameserver 192.168.0.9
nameserver 192.168.0.11

For more information, see the man page for resolv.conf.


6. Edit /etc/hostname.hme0

This file should contain the hostname of your machine, without the domain name. So, if the FQDN (Fully Qualified Domain Name = hostname + domain name) is solaris-box-1.yourdomain.com, the file should look like this:

# cat hostname.hme0
solaris-box-1

This assumes that your Ethernet adatper is hme0, the default device name for the first Ethernet adapter.



7. Reboot
# sync;sync;sync
# reboot


8. Change IPs


UNIX Shell: All Primary shells (sh,ksh,csh)
Function: Use ifconfig to change your IP address immediately. Edit your /etc/hosts file to change it permanently.
Syntax: Immediate change: ifconfig interface new IPaddress subnet mask

Permanent change: vi /etc/hosts
interface Specifies the network interface, e.g. hme0 for 100 Mbps or le0 for 10 Mbps.
new IPaddress Specifies the new IP address that you want to assign the computer.
subnet mask Specifies the subnet mask for your local network.

File Name: hosts Directory: /etc Type: External
ifconfig hme0 192.168.1.250 255.255.255.0 Sets the IP address to 192.168.1.250 on interface hme0.
ifconfig le0 192.168.1.250 255.255.255.0 Sets the IP address to 192.168.1.250 on interface le0

9. Recover ROOT password

You need to have physical access to the machine's console.

Note the root partition;

Solaris uses

* /dev/dsk/c0t0d0s0 on the Ultra5/10 and Blade 100
* /dev/dsk/c0t1d0s0 for Blade 1000.

Press the STOP and A keys simultaneously, or, on an ASCII terminal or emulator, send a ) to halt the operating system, if it's running.

Boot single-user from CD-ROM (boot cdrom -s) or network install/jumpstart server (boot net -s). For CD media use the CD-ROM labeled "Installation". I prom pssword is set you need to know it

Mount the root partition on "/a". "/a" is an empty mount point that exists at this stage of the installation procedure. For example:

#mount /dev/dsk/c0t0d0s0 /a

If the mount command fails and since "/a" always exists, then you either typed in the wrong device, OR the system is seeing the root partition as something else.

Do a "ls /tmp/dev/dsk" and see what is there. "c0t6" things are the CD-ROM, what is left is what one needs to try. On a Blade 1000/2000, choose /dev/dsk/c1t1d0s0, and execute: #mount /dev/dsk/c1t1d0s0 /a

Set your terminal type so you can use a full-screen editor, such as vi. You can skip this step if you know how to use "ex" or "vi" from open mode.

* If you're on a sun console, type "TERM=sun; export TERM";
* If you are using an ascii terminal or terminal emulator on a PC for your console, set TERM to the terminal type for example: TERM=vt100; export TERM.

Edit the passwd file, /a/etc/shadow (or perhaps in older versions, /etc/passwd) and remove the encrypted password entry for root.

Type: "cd /; then "umount /a"

Reboot as normal in single-user mode ("boot -s"). The root account will not have a password. Give it a new one using the passwd command. PROM passwords: Naturally, you may not want anyone with physical access to the machine to be able to do the above to erase the root password. Suns have a security password mechanism in the PROM which can be set (this is turned off by default). The man page for the eeprom command describes this feature.

If security-mode is set to "command", the machine only be booted without the prom password from the default device (i.e. booting from CD-ROM or install server will require the prom password). Changing the root password in this case requires moving the default device (e.g. the boot disk) to a different SCSI target (or equivalent), and replacing it with a similarly bootable device for which the root password is known. If security-mode is set to full, the machine cannot be booted without the prom password, even from the default device; defeating this requires replacing the NVRAM on the motherboard. "Full" security has its drawbacks -- if, during normal operations, the machine is power-cycled (e.g. by a power outage) or halted (e.g. by STOP-A), it cannot reboot without the intervention of someone who knows the prom password.

10. Others (and repeated)

"I've almost just reinstalled Solaris to get the network settings fixed!" Ya, sometimes you can get alittle confused and irritated. Whether it's a new Linux distro, or diffrent UNIX OS, everyone puts their network configuration in diffrent places and learning each systems setup can be a pita. So, what if you don't even wanna bother learning all the network configuration stuff and what files does what... what if you could just re-run the networking configuration and have it all sorted out? You can! Solaris has a nifty command that can reset the base networking and configuration to a clean system: "sys-unconfig". If you buy a pre-installed system from Sun or a VAR, what they will generally do is install Solaris, customize the install as needbe and then run "sys-unconfig" before putting the system in the box and shipping it out. The command will scratch the networking configuration (most of it anyway), the root password, time zone, etc. Once sys-unconfig finished cleaning out the files it will immediately halt the system (shut it down). Next time you boot the system it will prompt you for all the networking information, time zone, locale and a new root password. This is the "quick-no-hassle" reconfiguration method. Generally we do not recommend this as ideal, but it will do the trick. If you plan on selling a pre-installed system or you are moving your system to a new network where all the info is changing, this is the command to use. Just use it carefully.

"I know root shouldn't login remotely, but I really want too!" Logging into a system via telnet, ftp, or ssh is just bad... very bad. However, some times people think they need to do this or they simply don't care about security. If you really wanna drop your pants like this, edit: /etc/default/login. In this file, you'll see a line for CONSOLE. To allow root to log in via telnet or ftp just comment out this line and your done. To allow root login via SSH you need to edit a diffrent file: /etc/ssh/sshd_config. Change the value of PermitRootLogin from "no" to "yes" and restart SSH via "svcadm restart ssh". The SSH configuration file is just the same as Linux since Solaris uses OpenSSH. Please note, that allowing root to log in remotely is a massive security risk and needlessly stupid, don't do this unless you absolutely must.

"How do I set and make the default gateway persistant across reboots?" The default gateway is easy to configure, just put the IP address of the default gateway in /etc/defaultrouter. If this file doesn't exist just create it and add the IP. The IP address of the gateway should be the ONLY thing in this file, nothing else. Typically you should just use echo, like this: "echo 10.0.0.255 > /etc/defaultrouter". Once you've changed the file you can restart the physical network interfaces to make the changes effective without a reboot ("svcadm restart physical").

How do I set or change my IP address? Setting and changing IP addresses on Solaris is a snap. Just add the IP and hostname that you wish to use to /etc/hosts. Then put the hostname (by itself) in teh /etc/hostname.(interface) file. Then just restart the physical networking via SMF ("svcadm restart phsyical") and your done! Example: "echo '10.0.0.25 solarisrox' >> /etc/hosts; echo 'solarisrox' > /etc/hostname.hme0" assuming that hme0 was the interface you wanted to use. Don't worry about this changing the hostname for the whole workstation, the hostname for the system is kept in /etc/nodename. You can add the default gateway as we discussed just above. If you need to specify a non-standard subnet netmask you can add it to /etc/netmasks. You can have as many subnet masks in the /etc/netmasks file as you like, one per line, just follow the instructions at the top of the file.

How do I configure DHCP? DHCP is pretty easy to configure, just create 2 empty files: /etc/hostname.(interface) and /etc/dhcp.(interface). If you are using HME0 you could do this: "echo "" > /etc/hostname.hme0 > /etc/dhcp.hme0". You might want to wipe out information that might conflict like the /etc/defaultrouter file if you created one. Once you've got these two empty files ready just restart the physical network to make the changes effective without a reboot ("svcadm restart physical"). If you want to customize the properties of the DHCP agent you can check out the " System Administration Guide: IP Services" manual. Remember that DHCP settings take acouple seconds to be retrieved from the server so if you reset the physical interfaces as mentioned above and you notice that nothing happened, just wait a couple seconds (30 secs is the default timeout).

I can't figure out what the network interface is called! Linux sort of makes network interface naming easy because typically interfaces are named "eth0", "eth1", so on and so forth. In Solaris, however, the name of the interface is decided by the interface driver. For instance, the onboard ethernet of a Sun Ultra workstation uses the HME (Happy Meal Ethernet, also more boringly called Hundred Meg Ethernet) driver and so the first instance is "hme0". You can look at the device mappings to driver names using "prtconf -D". In general, Solaris will find your network device and try to configure it so generally just checking "ifconfig -a" is enough to find it.

My l337 workstations network device isn't frickin' support!?! Sadly there are lots of networking devices that aren't officially supported (right now anyway, OpenSolaris hopes to change this). Thankfully there are tons of really kool Solaris developers that have been creating open source drivers! Check out these free NIC drivers by Masayuki Murayama! Grok google for drivers, you just might find your l337 gear really does have drivers avalible, they just aren't in Solaris right now.

There ya go.. some quick Solaris networking tips. As always, check out docs.sun.com's Solaris10 manuals for help and details.