468x60 Ads

Monday, September 24, 2012

How to traceroute in Solaris 10


traceroute


It will print the route packets take to network host

Usage: traceroute [-adFIlnSvx] [-A address_family] [-c traffic_class]
        [-f first_hop] [-g gateway [-g gateway ...]| -r] [-i iface]
        [-L flow_label] [-m max_hop] [-P pause_sec] [-p port] [-Q max_timeout]
        [-q nqueries] [-s src_addr] [-t tos] [-w wait_time] host [packetlen]
Some output symbol descriptions:
!  the ttl (hop limit) value in the received packet is <= 1.
!H host unreachable.
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 40 byte packets
 1  172.16.0.250 (172.16.0.250)  0.679 ms !H *  0.594 ms !H

!X communication administratively prohibited.
 ICMP (ICMP6) unreachable code N.

!F The associated gateway is broken.
!N network unreachable.
!P protocol unreachable.
!S source route failed. It is likely that the gateway does not support source routing.
!T unreachable for the specified TOS (type-of-service).
!U source host isolated or precedence problem.
!A host unreachable for a reason other than lack of an entry in the routing table.
!B packet too big.
!E destination is not a neighbor.
!R unrecognized next header.

# traceroute  50.200.0.144
traceroute to 50.200.0.144 (50.200.0.144), 30 hops max, 40 byte packets
 1  172.16.0.250 (172.16.0.250)  0.457 ms  0.285 ms  0.320 ms
 2  50.200.0.144 (50.200.0.144)  1.593 ms  1.475 ms  1.549 ms


Tuesday, September 11, 2012

Install Webmin in solaris 10




What is Webmin…?

Webmin is a web-based interface for system administration for Unix, and it will help administrators to handle so many applications that are running on Unix systems and the system (OS) very easily(eg: mysql, logs, DHCP servers, apache server, setup user accounts, DNS, file sharing and many more).

Default webmin is built in to Solaris 10 under /usr/sfw/webmin  directory.
What you want to do is setup webmin and enables webmin service.
Login as root:#su

Enter a port for the web server. 10000 is the default port

# /usr/sfw/lib/webmin/setup.sh

Or

# /usr/sfw/bin/webminsetup

Login name (default root):
root
Web server port (default 10000):
10000

Use SSL?  [y,n,?,q] ?
        To respond in the affirmative, enter y, yes, Y, or YES. To respond in
        the negative, enter n, no, N, or NO.

Use SSL?  [y,n,?,q] y
***********************************************************************
*            Welcome to the Webmin setup script, version 1.170        *
***********************************************************************
Webmin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.

Installing Webmin in /usr/sfw/lib/webmin ...

***********************************************************************
Webmin uses separate directories for configuration files and log files.
Unless you want to run multiple versions of Webmin at the same time
you can just accept the defaults.

Config file directory [/etc/webmin]: Found existing Webmin configuration in /etc/webmin


Creating start and stop scripts..
..done

Updating config files..
..done

Changing ownership and permissions ..
..done

Running postinstall scripts ..
..done

Attempting to start Webmin mini web server..
..done

***********************************************************************
Webmin has been installed and started successfully. Use your web
browser to go to

  https://MEN-TM:10000/

and login with the name and password you entered previously.

Because Webmin uses SSL for encryption only, the certificate
it uses is not signed by one of the recognized CAs such as
Verisign. When you first connect to the Webmin server, your
browser will ask you if you want to accept the certificate
presented, as it does not recognize the CA. Say yes.S

Then enable the webmin service

# svcadm enablewebmin


First download relevant webmin package (webmin-1.590.pkg.gz) from http://www.webmin.com/download.html

If your server having internet access:
#
#wgethttp://prdownloads.sourceforge.net/webadmin/webmin-1.590.pkg.gz

Login as root
#su

Untar the webmin package

gunzip webmin-1.590.pkg.gz
pkgadd -dwebmin-1.590.pkg WSwebmin

go to
 #cd /usr/sfw/lib/webmin


Run the setup script
 #./setup.sh

Enter a port for the web server. 10000 is the default port.

The installation will be made to /opt/webmin , you should now be able to login to Webmin at the
URL http://localhost:10000/With the administration username root  and your current root password.


Sample DHCP server configure in Webmin:





Thursday, September 6, 2012

Continuous ping in solaris 10



usage: ping host [timeout]
usage: ping -s [-l | U] [adLnRrv] [-A addr_family] [-c traffic_class]
        [-g gateway [-g gateway ...]] [-F flow_label] [-I interval]
        [-i interface] [-P tos] [-p port] [-t ttl] host [data_size] [npackets]


 -s  :  Send one  datagram  per  second  and collect statistics.


Put a Continuous ping:

# ping -s 50.17.0.1
PING 50.17.0.1 (50.17.0.1): 56 data bytes
64 bytes from 50.17.0.1: icmp_seq=0. time=1.22 ms
64 bytes from 50.17.0.1: icmp_seq=1. time=26.5 ms
64 bytes from 50.17.0.1: icmp_seq=2. time=8.13 ms
64 bytes from 50.17.0.1: icmp_seq=3. time=64.1 ms
64 bytes from 50.17.0.1: icmp_seq=4. time=30.7 ms
64 bytes from 50.17.0.1: icmp_seq=5. time=33.9 ms
64 bytes from 50.17.0.1: icmp_seq=6. time=1.03 ms
64 bytes from 50.17.0.1: icmp_seq=7. time=1.14 ms
.
.
.
.
.
64 bytes from 50.17.0.1: icmp_seq=26. time=1.27 ms
64 bytes from 50.17.0.1: icmp_seq=27. time=0.994 ms
^C
----50.17.0.1 PING Statistics----
28 packets transmitted, 28 packets received, 0% packet loss
round-trip (ms)  min/avg/max/stddev = 0.989/19.27/64.1/18.9



Put a Continuous ping with specific data size :


# ping  -s 50.17.0.1 200
PING 50.17.0.1: 200 data bytes
208 bytes from 50.17.0.1: icmp_seq=0. time=1.35 ms
208 bytes from 50.17.0.1: icmp_seq=1. time=27.1 ms
208 bytes from 50.17.0.1: icmp_seq=2. time=22.1 ms
^C
----50.17.0.1 PING Statistics----
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max/stddev = 1.35/16.9/27.1/14.


Tuesday, September 4, 2012

Mount unmount portable usb DVD/HDD drive in Solaris 10(Sparc server)


Assuming system disabled the automount option.

How to check auto Mount is disable or not:
Check whether  volfs is running or not..
# svcs -a|grep volfs
disabled       Jun_06   svc:/system/filesystem/volfs:default

if it is disabled, enable it for enable auto-mounting option.
# svcadm enable volfs
If the  usb flash is recognize by the system it will be mount and you  can see the
status with
# rmformat

rmformat:The rmformat utility is used to  format,  label,  partition,and  perform  other  miscellaneous  functions  on removable, rewritable media that include floppy drives, and the  PCMCIA memory  and  ata  cards. 



mount, umount: - mount or unmount file systems and remote resources

eg: mount [-F FSType] [generic_options] [-o specific_options] [-O] special
mount_point

bash-3.2# mount -F hsfs -o ro /dev/dsk/c0t0d0s0 /cdrom/unnamed_cdrom
bash-3.2#umount /dev/dsk/c0t0d0s0

[-F FSType]
Used to specify the FSType on which to operate. The FSType must be specified or
must be determinable from /etc/vfstab, or by consulting /etc/default/fs or
/etc/dfs/fstypes.

ro | rw Specify read-only or read-write. The default is rw.
/dev/dsk/c0t0d0s0  : :mount device
/cdrom/unnamed_cdrom :mount location

To find under what names file systems are mounted:  use the
 bash-3.2#df -k


The df utility displays the amount of disk space occupied by mounted  or  unmounted  file systems, the amount of used and available space, and how much of  the  file  system's  total capacity has been used.



-k
 Prints the allocation in kbytes. The output consists  of one  line of information for each specified file system.This information includes  the  file  system  name,  the total  space allocated in the file system, the amount of space allocated to existing files, the total  amount  of space  available  for  the  creation  of  new  files  by unprivileged  users,  and  the  percentage  of  normally.

Monday, August 27, 2012

VI Editor Quick Reference


















Mostly use commands:Create new file name perlFile.pl or open existing file named perlFile.pl.

#vi perlFile.pl

press letter "i" in the keybord for write to the file
Write what eve you want...

If you want to delete a character under cursor:  move pointer on top to the letter, press <Esc> and press letter "x".
To delete character before cursor: move pointer  before the letter , press <Esc> and   press letter "X".

To delete a line: move the pointer to anywhere in the line , press <Esc> and press the letter "dd".
Delete everything in the file: Press <Ese> ":1,$d" and press <Enter>


Save the file : Press <Ese> "wq!"  and press <Enter>
Quite without saving :Press <Ese> "q!"  and press <Enter>

Sunday, August 12, 2012

How to change IP and HOST-NAME on a Solaris 10


How to change IP and HOST-NAME on a Solaris 10


In Solaris 10, you must edit the /etc/hosts and the  /etc/inet/ipnodes file (a symbolic link to /etc/inet/hosts file) with VI editor to do necessary changers an entry for IP address and/or hostname.
How to show the hostname of your system:

# hostname
NTU-HQ-EMS
#

How to show the IP details of your network interfaces:

# ifconfig -a
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
igb0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 172.16.0.1 netmask ffffff00 broadcast 172.16.0.255
#

You can change Red (IP) and green(Host name) colour one as your require...

# cat etc/hosts
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
172.16.0.1      NTU-HQ-EMS      loghost
#


# cat /etc/inet/ipnodes
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
172.16.0.1      NTU-HQ-EMS      loghost
#

Once done, restart the Network service using following command:

# svcadm restart network/physical
Or reboot the server for the changes to take effect.

Check your physical network is up and running:
# svcs |grep -i physical
online         Feb_08   svc:/network/physical:default
#

Note:
The /etc/inet/ipnodes file stores both IPv4 and IPv6 addresses.
If you need to change addresses, you must add IPv4 addresses to both the hosts and ipnodes files. You add only IPv6 addresses to the ipnodes file.
Also, ensure that the /etc/netmasks file with the network ID and the netmask.

Sunday, August 5, 2012

How to reset root password in Solaris server(SPARC)


Let we think our Solaris server password is lost:
There is only way to access to server again is resetting the password.
For that we have to have physical access to the server. (network access/CD or DVR Rom)
Boot the server with a Solaris CD/DVD or a net boot with a JumpStart server from the OBP OK prompt.
OK boot cdrom -s
or
OK boot net –s

This will boot the server from the DVD or Jumpstart server and launch a single user mode (No Password).
Mount the root file system (eg: /dev/dsk/c0t0d0s0 here) onto /dvd
# mount /dev/dsk/c0t0d0s0 /dvd

/dvd is a temporary mount point that is only available when you boot from DVD or a JumpStart server.
In here root file system is mounted into  /dvd. All you need to do is to edit the shadow file and remove the encrypted password for root.
Now you have to edit shadow file to remove existing root  password (password is in encrypted).
# vi /dvd/etc/shadow

root:v.ncDEpjCColQ:15498::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::
uucp:NP:6445::::::
svctag:*LK*:6445::::::
nobody:*LK*:6445::::::
noaccess:*LK*:6445::::::
nobody4:*LK*:6445::::::
nms:WYRY9Kdk/KJvg:15383::::::
daraka:bweoCRvEGLgcQ:15555::::::

remove everything in between first “:” and second “:” ,save and quit with following command .:wq!
(now it’s looks like:  root::15498::::::)

Now, exit from the mounted file system (/dvd), unmount the root file system and reboot the system.
# cd /
# umount /dvd
# init s
Now we can login to root without password. Change password once you login.
# passwd root
New Password:
Re-enter new Password:
passwd: password successfully changed for root
# reboot
Now you can be able to logon with the new password set for root.