Wednesday, September 25, 2013

AMOS - Advanced Managed Object Scripting

AMOS is a customer version of moshell, it can be purchased as an optional feature in OSSRC (available since R5.3)

AMOS is identical to moshell except for the following differences:
1) In AMOS, the user can connect to the node by specifying the MeContext name instead of the IP address. AMOS converts the MeContext to a IP address by looking in the ONRM_CS database of OSSRC.

2) In AMOS, there is a feature called TBAC (Target Based Access Control, available from O13), which can restrict access to certain nodes only, depending on the user's permissions.

3) In AMOS, it is possible to restrict certain types of commands, depending on the user's permissions in TSS database. For instance WRITE and TELNET commands can be blocked for certain users.

4) In AMOS, the commands executed during the session are logged in the OSS SMLog.

5) AMOS is license controlled while moshell does not have any licensing (since it is for Ericsson internal use).

6) In AMOS, the following moshell commands are blocked:
- fset: for performing set operations that are not defined in the node MOM, e.g. write internal Ericsson parameters
- pcr, pdel : for creating/deleting PM scanners. OSSRC only allows PM scanner changes done from the OSS GUI, therefore these commands are blocked in AMOS.

7) The moshell version included in AMOS can sometimes be older than the latest moshell version. To upgrade AMOS to the latest moshell version, it is possible to use the following procedure:
 - fetch the latest moshell installation package from OSS PLM SW delivery gateway (if customer) or from moshell homepage (Ericsson)
 - store the moshell installation package in the OSSRC masterserver under /tmp
 - login as root into the OSSRC masterserver and run the following commands
 > unzip -o moshellxxx.zip
 > bash moshell_install -a

AMOS release info can be found on http://clearcase-oss.lmera.ericsson.se/view/www_ossrc/vobs/ossrc/del-mgt/html/
Click on the "EC list" link for your OSS version then search for ERICuramos .
To know what is your OSS release, shipment, and AMOS version, type "ist_run" at the OSS-RC shell prompt; the header shows the OSS release and shipment. To see the AMOS version, type "3", then "1" at the ist prompt.

Tuesday, September 24, 2013

How to install cygwin and moshell for Windows

When running on Windows, Moshell uses a unix emulator known as Cygwin.
Go directly to step 13 if you have already installed and configured cygwin previously.

1- Go to the website www.cygwin.com

2- Click on "Install Now"

3- Save the 'setup-x86.exe' file, then execute it.

4- Choose "Install from internet", then click Next.

5- Root Directory "C:/cygwin" (It is not recommended to choose a different directory, especially if it contains spaces).
IMPORTANT: "Default Text File Type" should be set to UNIX (NOT DOS !!! otherwise ftp transfers get corrupted). Then click Next.

6- Select Internet Connection: put the proxy settings or select "use IE settings". Then click Next.

7- Choose a Download Site. The site http://sourceware.mirrors.tds.net is recommended.

8- Select Packages: Add the following packages:
- under "Archive", select "zip" and "unzip"
- under "Interpreters", select "perl"
- under net, select "inetutils", "openssh", "openssl"
- under shells, select "rxvt"
- under "Editors" select "vim" (optional)

9- Click Next. Install will start. Wait for installation to complete.

10- Download the file 'http://utran01.au.ao.ericsson.se/moshell/cygwin_install.txt' to C:/Cygwin .

11- Click on Start --> Run. In the "Run" window, type:
c:/cygwin/bin/perl c:/cygwin/cygwin_install.txt , then press "enter" .
This will create the following files:
c:/cygwin/etc/profile,
c:/cygwin/cygwin.bat,
c:/cygwin/home/ezawhte/.bashrc,
c:/cygwin/home/ezawhte/.Xdefaults,
c:/cygwin/home/ezawhte/.inputrc.
If those files already exist, they are automatically moved to the folder c:/cygwin/tmp/installbackup.

12- Open a cygwin terminal window by double-clicking on the cygwin icon in the start menu or on the file c:/cygwin/cygwin.bat.
The window should be black with white text and the prompt should like this: [~]$
If not, then go through all the steps again and make sure you haven't missed out anything.

13- Moshell installation:
- Download the moshellxxx.zip file from Moshell Home to c:/cygwin/home/zawhtet
- Open the cygwin shell and run the following commands:
#unzip -o moshellxxx.zip
#bash moshell_install
The first prompt asks for the type of installation:
0) Full Version
1) Restricted+
2) Restricted
3) Limited
Click here for information about the restricted versions.
When prompted to enter the directory where you want to install moshell, it is recommended to specify your HOME directory ( ~ ).
 If a previous moshell installation already exists, it is recommended to install in the same directory as the old one. This way, all your custom files (jar/xml files, site files, etc.) get copied across to the new revision and the old revision gets moved to a different location so you can still access it if needed. When prompted to enter the java directory, choose /cygdrive/c/Progra~1/javasoft/jre/whichEverVersion/bin/java or /cygdrive/c/WINNT/system32/java

14- Running moshell for the first time:
If you have set the PATH variable correctly in your '~/.bashrc' file, you should be able to run moshell from any directory. E.g:
#moshell   10.231.231.1
If this is the first time moshell is installed on this PC, then it will download a number of jar files from the node.
No progress indicator will be shown so just be patient as it will take a few minutes.
Progress can be seen by doing "ls -l" in the commonjars and jarxml directories.
For more information about user settings etc, check the user guide
For more info about cygwin installation issues,
check http://cygwin.com/faq/faq0.html .

Uninstall instructions for cygwin can be found at http://cygwin.com/faq/faq.setup.html#faq.setup.uninstall-

Solaris 10 - Notes

SunOS Relase 5.10 Version
            Solaris 10 1/06 s10x_u1wos_19a x86
Oracle Solaris 10 9/10 s10x_u9wos_14a x86
Oracle Solaris 10 8/11 s10x_u10wos_17b x86 - Generic_147441-01 64bit
Oracle Solaris 10 1/13 s10x_u11wos_24a x86 - sol-10-u11-ga-x86-dvd.iso / sol-10-u11-companion-ga.iso

Solaris 10     03/05
Solaris 10 update 1     01/06
Solaris 10 update 2     06/06
Solaris 10 update 3     11/06
Solaris 10 update 4     08/07
Solaris 10 update 5     05/08
Solaris 10 update 6     10/08
Solaris 10 update 7     5/09
Solaris 10 update 8     10/09
Solaris 10 update 9     09/10
Solaris 10 update 10     08/11
sol-10-u10-ga2-sparc-dvd.iso
sol-10-u10-ga2-x86-dvd.iso
sol-10-u10-ga2-x86-lsimega-dvd.iso
Solaris 10 update 11     01/13

After the Solaris installation finished you got to modify these things.

1. Login with 'root' user

2.To create group and user account:
#groupadd -g 500 unixmin
#useradd -u 500 -g unixmin -d /export/home/zawhtet -m -s /usr/bin/bash -c "Zaw Htet" zawhtet
#passwd zawhtet

3.Create no login user for Services (Optional)
#groupadd -g 501 squid
#useradd -u 501 -g squid -s /usr/bin/false -c "Squid Admin" squid

4.To change the login name and home directory for - user2 (new) to user1 (old).
#usermod -m -d /export/home/user1 -l user1 user2

For Testing, create user2 first,
#useradd -u 503 -g unixmin -d /export/home/user2 -m -s /usr/bin/bash -c "User 2" user2
Then modify, user2 login name and home directory become user1
#usermod -m -d /export/home/user1 -l user1 user2

Note: Even we modified the user's home directory and login name, User2 name still remains/ also put the account to random group.

#cat /etc/passwd
user1:x:503:500:User 2:/export/home/user1:/usr/bin/bash

5.Deleting User Accounts
#userdel  user1  - to remove the user1 account
#userdel -r user1 - This command also remove the user's Home Directory

6.Deleting Group
#groupdel 
cat /etc/group


7.When we first login to terminal, you will see that you got "/bin/sh"
#echo $SHELL
/bin/sh
#bash 
bash-3.00$

Note: When you edit the file even with root account you will get Read-Only message
If you want to save after you open file with Vi editor use ':wq!'

bash-3.00# whereis bash
bash: /usr/bin/bash /usr/man/man1/bash.1

8.If you want to set root or your user account, permanently login to bash shell
vi  /etc/passwd
root:x:0:0:Super-User:/:/bin/sh
change to
root:x:0:0:Super-User:/:/bin/bash

9. Create '.bash_profile' file under '/' then copy to /root (#cp   .*   /root)
vi .bash_profile
export PATH=$PATH:/usr/sfw/bin/:/opt/sfw/bin/:/opt/sfw/squid/$:/root/moshell:/usr/dt/bin:/opt/CTXSmf/bin:/opt/CTXSmf/sbin:/usr/apache2/bin
export PS1='[\u@\h \W]\$ '
export HISTSIZE=5000
alias ls='ls -l'
alias netstat='netstat -an |grep LISTEN'
alias h='history'
alias lsd='ls -ACF \!* | more'
alias lsl='ls -alh | less'
alias lst='ls -alt \!* | more'
alias plm='ps -elf | more'
alias plg='ps -elf | grep "\!*" | sort -n +3 -4'
alias psm='ps -ef | more'
alias psg='ps -ef | grep "\!*" | sort -n +1 -2'

10.refresh the profile with logout
source ~root/.bash_profile
.  ~root/.bash_profile
#env or  set 
#echo $PATH
/usr/sbin:/usr/bin:/usr/sfw/bin/
#export

11.Make root account to login to his home directory
vi  /etc/passwd
root:x:0:0:Super-User:/:/bin/bash
change to
root:x:0:0:Super-User:/root:/bin/bash

12.Make SSH login permission to root user
vi  /etc/ssh/sshd_config
PermitRootLogin  yes

13.Restart SSH service
#svcadm enable ssh
#svcadm refresh ssh
#svcs -a | grep ssh
#netstat -an | grep LISTEN

14.IPFilter for Solaris Firewall
svcadm enable ipfilter
svcs -a|grep pfil
/usr/share/ipfilter/examples. Just copy one of them over /etc/ipf/ipf.conf

#ipf  -Fa  -f  /etc/ipf/ipf.conf
pass in all
pass out all

routeadm -u -e ipv4-forwarding 

vi  /etc/ipf/ipf.conf

pass in quick on lo0 all
pass out quick on lo0 all
block in log on e1000g0 all
block out log on e1000g0 all
pass out quick on e1000g0 proto tcp/udp from any to any keep state
pass out quick on e1000g0 proto icmp all keep state
pass in quick on e1000g0 proto icmp all keep state
pass in quick proto tcp from any to any port = 22 keep state
pass in quick proto tcp from any to any port = 10000 keep state
pass in quick proto udp from any to any port = 67 keep state

# Allow all traffic on loopback
pass in quick on lo0 all
pass out quick on lo0 all
# Public Network.   Block everything not explicitly allowed.
block in log on e1000g0 all
block out log on e1000g0 all

# Allow all connection out from this computer
pass out quick on e1000g0 proto tcp/udp from any to any keep state

# Allow pings out
pass out quick on e1000g0 proto icmp all keep state

# Allow pings in
pass in quick on e1000g0 proto icmp all keep state

# Allow ssh connection on port 22 to Laptop(192.168.0.1)
pass in quick proto tcp from 192.168.0.1 to 192.168.0.254 port=22 keep state
pass in quick proto tcp from any to any port = 22 keep state
pass in quick proto tcp from any to any port = 10000 keep state

-bash-3.00# cat reloadipf.sh
#!/bin/sh
# Last Modified On: 25-FEB-2006

# Script to reload the IFP
ipf -Fa -f /etc/ipf/ipf.conf
-bash-3.00#

ipf -E  : Enable ipfilter when running for the   first time.(Needed for ipf on Tru64)
 
ipf -f /etc/ipf/ipf.conf  : Load rules in /etc/ipf/ipf.conf file into the active firewall.
 
ipf -Fa -f /etc/ipf/ipf.conf : Flush all rules, then load rules in /etc/ipf/ipf.conf   into active firwall.
 
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.
 
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.   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)

15. Solaris 10 Static IP Configuration
/etc/nodename
/etc/hosts
/etc/inet/hosts
/etc/hostname.e1000g0
/etc/inet/ipnodes
/etc/inet/netmasks
/etc/defaultdomain
/etc/defaultrouter
/etc/resolv.conf
svcadm  restart network/physical

16. Solaris 10 Dynamic IP Configuration, make sure following files are blank
/etc/hostname.e1000g0
/etc/dhcp.e1000g0
/etc/defaultrouter
svcadm  restart network/physical

#/usr/sbin/netservices    limited

17. Check Port Open  status
#netstat -n -f inet 
#netstat –anf  inet -P tcp
#netstat -anf  inet –P udp
#netstat   -nr
lsof  -i   TCP
lsof  -I  TCP  | grep LISTEN


18. Package management
If you want to add more Solaris packages from DVD, after you installed the Solaris
first insert the DVD and mount the DVD by

Remount volume manager
#/etc/init.d/volmgt stop
#/etc/init.d/volmgt start
check
# ls /cdrom/cdrom0
# cd /cdrom/cdrom0/Solaris_10/Product

or mount manually from
#mount -F  hsfs  /dev/dsk/c0t0d0p0   /mnt

19.mount ISO file
#lofiadm -a /tmp/companion-sparc-sol10.iso /dev/lofi/1
#mount -F hsfs -o ro /dev/lofi/1 /mnt

20. CD Burning
#cdrw -l
Looking for CD devices...
    Node            Connected Device            Device type
----------------------+--------------------------------+-----------------
 /dev/rdsk/c2t0d0s2   | MATSHITA DVD-RAM UJ-845S  D200 | CD Reader/Writer
#cdrw -d c2t0d0s2 -i companion-sparc-sol10.iso

21. Package installation
#ls  /mnt/Solaris_10/Product
Solaris Packages start with 'SUNW*'

If you want to add one package
#pkgadd  -d  .  SUNWbash
Normally these packages install to '/usr/sfw'

Or you want to manually download bz2 package from internet and install like this
bunzip2 firefox-24.0.en-US.solaris-10-fcs-i386-pkg.bz2
pkgadd -d firefox-24.0.en-US.solaris-10-fcs-i386-pkg

Decompress tar.gz file
#gunzip   vmware-solaris-tools.tar.gz   |tar    -xv
#tar  xvf   vmware-solaris-tools.tar.gz
#gunzip -c NTXNxge-2.10-solaris10-i386.tar.gz | tar xvf -

If your package is in .bz2 format then first uncompress it using bunzip2 command:
#bunzip2 Packagname.bz2

Install package:
#pkgadd –d Packagname
Note .bz2 extension will automatically removed by first command.
For example if your package name is SFWqt.bz2

#buzip2 SFWqt.bz2
#pkgadd –d SFWqt

Add Packages from DVD to /var/spool/pkg
#Pkgadd    -d    /cdrom/sol_10_910_x86/Solaris_10/Product/     -s /var/spool/pkg/     SUNWgtar
#pkgadd  SUNWgtar
#pkgadd –d     /path/to/cdrom/Product    SUNWjaf     SUNWjato    SUNWjmail
#pkginfo -l | grep wget
#pkginfo -l SUNWwgetu

#gunzip lsof_1106-4.80-sol10-sparc-local.gz
#pkgadd -d lsof_1106-4.80-sol10-sparc-local or *.pkg

If gunzip cannot run add the variable path to
/usr/local/bin
/usr/local/lib
/usr/local/man

For installing all the packages, create an install administration file such as:
 # cat /var/tmp/admin
mail=
conflict=nocheck
setuid=nocheck
action=nocheck
partial=nocheck
instance=overwrite
idepend=nocheck
rdepend=nocheck
space=check
#pkgadd -a /var/tmp/admin -d /cdrom/cdrom/Solaris_Software_Companion/Solaris_i386/

Download zipped ISO from http://www.sun.com/software/solaris/freeware/
# unzip sol-10-u8-companion-ga-iso.zip
# lofiadm -a `pwd`/sol-10-u8-companion-ga.iso
# mount -oro -Fhsfs /dev/lofi/1 /mnt
# /bin/yes | pkgadd -d /mnt/Solaris_Software_Companion/Solaris_sparc/Packages all
# pkgrm SFWvnc
# umount /mnt
# lofiadm -d `pwd`/sol-10-u8-companion-ga.iso
# rm sol-10-u8-companion-ga.iso
# rm sol-10-u8-companion-ga-iso.zip

22.To remove package
#pkgrm 

23.System Info Commands

#cat /etc/release
#showrev
#uname -a
#prtconf  | grep -i memory
#psrinfo
#psrinfo -pv
#isainfo -bv
#isalist
#date '+DateTime: %m.%d.%y @ %H:%M:%S'
date mmddHHMMccyy
date  091810022013  
#ps -ef
#ps -U root
#tty / w
#pgrep sshd  
#pgrep -o sshd
#pgrep -o sshd 
#pkill (PID) or sshd
#pwdx (PID) - Lists the working directories of process
#prstat
#svcs -o FMRI,DESC 

24.KDE Login after intallation from Companion DVD
#/opt/sfw/kde/dtlogin/install-dtlogin

25.To disable the GUI login Solaris
First login with ssh and Kill desktop login
#/usr/dt/bin/dtconfig -kill
#/usr/dt/bin/dtconfig -d
#/usr/dt/bin/dtconfig -e
#/usr/dt/bin/dtconfig -reset
#/usr/dt/bin/dtconfig -inetd

26.Static Routing (-p) option for permanent route
#route -p add -net 192.168.2.0    192.168.1.2   255.255.255.0
                              Network         Gateway
add net 192.168.2.0: gateway 192.168.1.254
add persistent net 192.168.2.0: gateway 192.168.1.254

The above created route would still appear the same in a listing of the
routing table, however, you may notice that there is a secondary line
of output upon creating the route:

add persistent net 192.168.2.0: gateway 192.168.1.254

This simply means that the 'route' command updated config file
/etc/inet/static_routes.  By default, this file will not exist until
a static route is created via 'route -p' or you create it.  Before
getting to contents, the following are the ownership / permissions set
to the file by 'route':

#ls -l /etc/inet/static_routes
-rw-r--r--   1 root     root          45 Oct  6 13:35 /etc/inet/static_routes
And now, the contents, which are effectively the arguments to 'route add':

#cat /etc/inet/static_routes

# File generated by route(1M) - do not edit.
-net 192.168.2.0 192.168.1.2 255.255.255.0

Yes, I know it says do not edit, though in checking out the source of
'route' via opensolaris.org, it doesn't appear that manual editing
is an issue.  Finally, Solaris has a native, standardized means of
configuring persistent static routes.

Additionally, to remove a static route, delete it from
/etc/inet/static_routes and remove via 'route' or simply use the following
'route' command:

#route -p delete -net 192.168.2.0 192.168.1.2 255.255.255.0

27.Bind DNS Server Solaris

#pkginfo -x |grep -i bind
SUNWbind                          BIND DNS Name server and tools
SUNWbindr                         BIND Name server Manifest

#pkgchk -l SUNWbind (Client & Server Utilities)
#pkgchk -l SUNWbindr | grep -i pathname | less

#dig linuxcbt.com ns

#ls -l /usr/sbin/named

#ls -l /usr/sbin/in.named

#ls -ltr /var/named

#vi /etc/named.conf 

options {
        directory "/var/named";
        dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        listen-on port 53 { 127.0.0.1; 192.168.100.103; };
        allow-query { localhost; 192.168.100.0/24; };
        forwarders { 192.168.100.254; 8.8.8.8; };
        recursion yes;
        max-cache-size 100m;
        cleaning-interval 60;
};

zone "." {
        type hint;
        file "named.root";
};

zone "mmx.com" {
        type master;
        file "db.mmx.com";
        allow-update { none; };
};


zone "0.0.127.in-addr.arpa" {
        type master;
        file "db.127.0.0";
};

zone "100.168.192.in-addr.arpa" {
        type master;
        file "db.192.168.100";
        allow-update { none; };
};


@ is a variable which indicates the name of the zone as configured in /etc/named.conf

vi   /var/named/db.127.0.0
$TTL 28800
@ IN SOA  ns1.mmx.com.  zawhtet.mmx.com. (
    2013100301 ; serial number yyyymmdd01
     7200 ; Refresh Interval
    3600 ; Retry Interval
    86400 ; Expiry
    600 )  ; Minimum TTL
   
    NS    ns1.
1  IN    PTR   localhost.mmx.com.


vi   /var/named/db.192.168.100
$TTL 28800
@ IN SOA  ns1.mmx.com.  zawhtet.mmx.com. (
    2013100301 ; serial number yyyymmdd01
     7200 ; Refresh Interval
    3600 ; Retry Interval
    86400 ; Expiry
    600 )  ; Minimum TTL
   
    NS    ns1.
89  IN    PTR   ns1.

vi  /var/named/db.mmx.com
$TTL 28800
@ IN SOA  ns1.mmx.com.  zawhtet.mmx.com. (
    2013100301 ; serial number yyyymmdd01
     7200 ; Refresh Interval
    3600 ; Retry Interval
    86400 ; Expiry
    600 )  ; Minimum TTL
   
    NS    ns1.
    IN  MX  10 ns1.mmx.com.

ns1 IN  A     192.168.100.89
www    CNAME  ns1.mmx.com.

#svcadm enable / restart dns/server
#dig @localhost ns1.mmx.com
#svcs -l dns/server
#dig @localhost ns1.mmx.com
#dig @localhost msn.com
#dig @localhost www.mmx.com
#named-checkconf -z /etc/named.conf
#svcs  -a \*dns\*

Slave DNS Server


Copy following files to slave server:

1. /var/named/db.127.0.0 - Houses reverse, loopback zone info
2. /var/named/named.root - root hints
3. /etc/named.conf


cd /var/named

scp db.127.0.0 db.cache /etc/named.conf 192.168.100.2:/root

On Slave DNS Server

cp /root/db.*  /var/named
cp /root/named.conf /etc

vi /etc/named.conf 

options {
    directory "/var/named";
    allow-query { localhost; 192.168.100.0/24; };
    };


zone "." {
    type hint;
    file "named.root";
};

zone "mmx.com" {
    type slave;
    file "db.mmx.com";
    masters { 192.168.100.89; };
};


zone "0.0.127.in-addr.arpa" {
    type master;
    file "db.127.0.0";
};


zone "1.168.192.in-addr.arpa" {
    type slave;
    file "db.192.168.1";
    masters { 192.168.100.89; };
};

4. After synchronized with Master server

db.mmx.com - will download to /var/named on Slave DNS Server.

28. Install and Configure dhcp server from console

#pkginfo | grep DHCP

If it is not installed then install it from solaris CD
# pkgadd  -d . SUNWdhc*

#which dhcpmgr

no   dhcpmgr in /usr/bin /usr/sbin /usr/sfw/bin /opt/sfw/bin /usr/dt/bin

#/usr/sadm/admin/bin/dhcpmgr & (Everyone can configure DHCP Server from GUI)

#dhtadm

If there's no DHCP manager . let's configure it

#ifconfig -a
#netstat -rn
Then create dhcp database

#dhcpconfig  -D -r SUNWfiles -p /var/dhcp/ -a 192.168.1.4;8.8.8.8 -d mmx.com -l 86400

(Note: 192.168.1.4 - DNS Server / mmx.com = domain / Lease time = 86400)

or

#dhcpconfig  -D -r SUNWfiles -p /var/dhcp/

Created DHCP configuration file.
Created dhcptab.
Added "Locale" macro to dhcptab.
Added server macro to dhcptab - solaris-1.
DHCP server started.

#svcs -a | grep dhcp
online         18:57:30 svc:/network/dhcp-server:default

#dhtadm -P

Now configure network and IP

#dhcpconfig -N 192.168.1.0 -m 255.255.255.240 -t 192.168.1.1
(Note: 192.168.1.1 = Gateway)

#pntadm -P 192.168.1.0

#dhcpconfig --help

#pntadm -r SUNWfiles -p /var/dhcp/ -A 192.168.1.7 192.168.1.0
#pntadm -r SUNWfiles -p /var/dhcp/ -A 192.168.1.8 192.168.1.0
#pntadm -r SUNWfiles -p /var/dhcp/ -A 192.168.1.9 192.168.1.0
#pntadm -r SUNWfiles -p /var/dhcp/ -A 192.168.1.10 192.168.1.0

Or

#pntadm  -A  192.168.1.7 –f  MANUAL -i 01001BFC92BC10 -m  192.168.1.0 -y  192.168.1.0

#pntadm -P 192.168.1.0

#pntadm -L

#dhtadm -P

#svcadm restart dhcp-server

#svcs -a | grep dhcp

find  /usr/ -name in.dhcp

#/usr/lib/inet/in.dhcpd -i e1000g0 -d -v

#pntadm -P 192.168.1.0

If a DHCP server is already configured, you can unconfigure it by using the
dhcpconfig command with the unconfigure flag. For example:

# dhcpconfig -Ux

NETSTAT

netstat -a - return all protocols for all address families (TCP/UDP/Unix)
netstat -an - 'n' disable name resolution
netstat -i - State of Interfaces
netstat -in - show state of interface and disable name resolution
netstat -m - return streams (TCP) statistics
netstat -p - net to media info (MAC /layer-2 info) similar to run 'arp'
netstat -P tcp / udp
netstat -rn - return routing table
netstat -D - Check DHCP configuration
netstat -an -f inet - IPv4 info
netstat -an -f inet6 - IPv6
netstat -an -f unix - Unix domain sockets
netstat -an -f inet -P tcp - IPv4 Active TCP Connection
netstat -an -f inet -P udp - IPv4 Active UDP Connection
netstat -ant  | grep  :22  (Linux box)

Network Configuration

1. On Solaris Machine, login with root user then check the network interface status

#dladm show-dev  - check network interface
#dladm show-link - connected interfaces

#ifconfig -a
#ifconfig e1000g0

#svcs -a | grep physical
#svcs -a | grep loopback

2. if your system don't have hostname yet, you can add by

echo "solaris-1" > /etc/nodename

3. you can add static IP address via

echo "192.168.100.166" > /etc/hostname.e1000g0

echo "172.16.20.20" > /etc/hostname.iprb0

4. Add the domain name 'example.com'
 echo "example.com" > /etc/defaultdomain

5. Add Networks or netmasks
echo "192.168.100.0 255.255.255.0" > /etc/inet/netmasks

6. Add your hostname to hosts file
Hosts - /etc/hosts = /etc/inet/hosts
192.168.100.166  solaris-1.example.com solaris-1

7. Add DNS Server IP address
echo "nameserver 192.168.100.254" > /etc/resolv.conf

8. vi  /etc/defaultrouter
192.168.100.254, 172.16.1.1, 192.168.1.1

Name service config file - /etc/nsswitch.conf

[root@solaris-1 /]# ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1004843 mtu 1500 index 2
        inet 192.168.100.166 netmask ffff0000 broadcast 192.168.255.255
        ether 8:0:27:72:1f:c5

[root@solaris-1 /]# dladm show-link
e1000g0         type: non-vlan  mtu: 1500       device: e1000g0

[root@solaris-1 /]# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full

[root@solaris-1 /]#ifconfig e1000g0 dhcp status

#ps -ef | grep -i agent  

 /sbin/dhcpagent
#echo  "192.168.100.166" > hostname.e1000g0 && echo $?
#echo  "solaris-1" > /etc/nodename

Plumb/enable the iprb0 100Mb/s interface
#ifconfig iprb0 plumb up - enable the interface
#ifconfig iprb0 172.16.20.10 netmask 255.255.255.0 - this will enable Layer-3 IPv4 address
#ifconfig iprb0 unplumb down - disable the interface

1. echo "172.16.20.10" > /etc/hostname.iprb0
2. create entry in /etc/hosts
3. echo "172.16.20.0 255.255.255.0" > /etc/inet/netmasks

#ifconfig iprb0 up && ifconfig iprb0
#ifconfig iprb0 down && ifconfig iprb0

e1000g0 (physical interface) - 192.168.1.50(primary apache website)
                   192.168.1.51(Secondary Apache Website)
                   192.168.1.52 (Use for SSH)

iprb0   
iprb1

ifconfig e1000g0 addif 192.168.1.51 (RFC-1918 - defaults /24)

This will automatically create an 'e1000g0:1' interface

#ifconfig e1000g0:1 up && ifconfig -a

1. vi /etc/hostname.e1000g0:1 - 192.168.1.51
2. vi /etc/hostname.e1000g0:2 - 192.168.1.52
3. vi /etc/hostname.iprb0:1 - 172.16.20.11
4. update /etc/hosts

#ifconfig e1000g0 removeif 192.168.100.232
#ifconfig iprb0 removeif 172.16.20.20

/etc/nsswitch.conf

1. DNS
2. Passwd /etc/passwd,/etc/shadow,/etc/group
3. protocols /etc/inet/protocols
4. ethers or mac-to-IP mappings


Add swap partition on system

swap -l - list available swap devices and / or swap files
/dev/dsk/c0t0d0s1

swap -s - lists swap space including physical memory in 1024byte increments

#mkfile - creates zero-filled swap file
#swap -a - activates the swap file

#mkfile 512m  /media/swap2 - creates swap file
#mkfile 1024m  /media/swap3 - creates swap file
#mkfile 2048m /dev/dsk/c0t2d0s0 - creates swap files

#swap -a /media/swap2 - activates swap file
#swap -a /media/swap3 - activates swap file
#swap -a /dev/dsk/c0t2d0s0 - activates swap file

vi /etc/vfstab
/media/swap2  -  -  swap - no -

swap -d /media/swap2 - removes swap space from kernel - does not remove the file

Check Free Memory

#vmstat 1 2 | tail -1 | awk '{printf "%d%s\n", ($5*4)/1024, "MB" }'

#top -h -d 1

#vmstat 5 10

#mpstat 10 60

#prstat -a -s size

#echo ::memstat | mdb -k

Kernel: memory used for non-pageable kernel allocations

Anon: anonymous memory (process heaps, stack, share memory mappings, etc. etc.)

Exec and libs: memory used for mapped files like executables and libraries

Page cache: amount of unmapped page cache including data stored in /tmp

Free (cachelist): amount of page cache on free list, majority used by file system caches

Free (freelist): amount of memory that is actually really free

#prstat -Z

#kstat zfs::arcstats:size

#kstat -p -c misc -m cpu_stat

#kstat -T d -p :::physmem :::pp_kernel zfs:::size :::pagesfree 1 3