Thursday, January 26, 2012

How to Unfreeze Unix terminal?

I ran into this problem several times but never thought that it can be a key combination which is freezing my terminal :)

Finally, I figured out what is going on:

CTRL + s : Causes terminal freeze (scroll lock ON)
CTRL + q : Cases unfreeze terminal (equivalent to scroll lock OFF)

Thursday, January 12, 2012

How to find a PIDs using a port?

Simple solution: Use lsof :)

The following solution works perfectly on a Linux system. In case of Solaris, lsof has to be installed first because it is not a part of default OS.


[root@linux01 ~]# lsof -w -n -i tcp:22
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 2410 root 3u IPv4 6134 TCP *:ssh (LISTEN)
sshd 1639 root 3u IPv4 1637600475 TCP 10.20.30.99:ssh->10.20.50.231:35263 (ESTABLISHED)
sshd 9592 root 3u IPv4 3266851044 TCP 10.20.30.99:ssh->10.20.50.231:44621 (ESTABLISHED)
sshd 10119 root 3u IPv4 3006017510 TCP 10.20.30.99:ssh->10.20.50.231:62445 (ESTABLISHED)
sshd 13909 root 3u IPv4 739010581 TCP 10.20.30.99:ssh->10.20.40.88:35215 (ESTABLISHED)
sshd 24696 root 3u IPv4 273846126 TCP 10.20.30.99:ssh->10.20.40.89:39529 (ESTABLISHED)
sshd 24900 root 3u IPv4 352035868 TCP 10.20.30.99:ssh->10.20.40.88:59163 (ESTABLISHED)
sshd 25662 root 3u IPv4 982162556 TCP 10.20.30.99:ssh->10.20.40.89:65096 (ESTABLISHED)
sshd 27358 root 3u IPv4 982169152 TCP 10.20.30.99:ssh->10.20.40.89:65097 (ESTABLISHED)



Monday, November 28, 2011

How to configure TFTP server in Redhat Linux?

This would need a separate package/RPM and then following two steps:


# rpm -qa | grep -i tftp
tftp-server-0.49-2
tftp-0.49-2

Remember, the version of TFTP dont really matter so dont focus on version as long as it is coming from same RHEL media which was used to install OS. :)

Once RPM is installed, then make sure the /etc/xinetd.d/tftp file reads as below (special foucs on "disable=no")


# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}


By default, TFTP server provides files from /tftpboot directory unless it is changed in /etc/xinetd.d/tftp configuration file.

Once above is all set, then restart xinetd service and it should be all set!


# chkconfig --list | grep -i tftp
tftp: on

# service xinetd status
xinetd (pid 2374) is running...


As long as above is working + FIREWALL is open, then TFTP server should work fine.

On another note, if needed, open port 69 in firewall which is a TFTP server port.

Special note: In case of RHEL 6.0, it was not working for me but when I upgraded OS to RHEL 6U1, it again started working for me. So, I believe that RHEL 6U0's TFTP RPM has some bug. If you come across any workaround, please do let me know as well. :)

Enjoy! :)

How to configure TFTP server in Solaris 10?

It is extremely easy to setup on Solaris 10 machines. Total two steps process.

By default, /tftpboot is the location of tftp though it can be changed in /etc/inetd.conf file.

STEP 1) Uncomment tftp line in /etc/inetd.conf file.
STEP 2) Use inetconv command to install tftp SMF and bring it online.


# cat /etc/inetd.conf | grep -i tftp
tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot

# inetconv -i /etc/inetd.conf
inetconv: Notice: Service manifest for 100235/1 already generated as /var/svc/manifest/network/rpc/100235_1-rpc_ticotsord.xml, skipped
tftp -> /var/svc/manifest/network/tftp-udp6.xml
Importing tftp-udp6.xml ...Done

# svcs -a | grep -i tftp
online 8:20:39 svc:/network/tftp/udp6:default

Friday, November 4, 2011

Netapp Snapmirror & periodic updates setup

Setting up snapmirror between two Netapp devices is very easy and straightforward process as long as one has Snapmirror license. :) This is a 5 step process outlines below:

1) Make sure snapmirror license is installed on both source and destination filers.
2) Setup snapmirror options to allow both source/destination to do snapmirrors
3) Setup snapmirror and if needed, periodic updates/ data refresh
4) At the time of cut-over, do the final update - quiesce - break
5) Remove the extra snapshots created during this process.

In following example, trying to do snapmirror from filer01:/vol/vol01 to filer02:/vol/vol02.


# rsh filer02 options snapmirror
snapmirror.access host=*
snapmirror.checkip.enable off
snapmirror.delayed_acks.enable on
snapmirror.enable on
snapmirror.log.enable on
snapmirror.vbn_log_enable off (value might be overwritten in takeover)
#
#
# rsh filer02 snapmirror initialize -S filer01:vol01 filer02:vol02
Transfer started.
Monitor progress with 'snapmirror status' or the snapmirror log.
#
#
# rsh filer02 snapmirror status
Snapmirror is on.
Source Destination State Lag Status
filer01:vol01 filer02:vol02 Uninitialized - Transferring (180 MB done)
#
#
# rsh filer02 snapmirror status
Snapmirror is on.
Source Destination State Lag Status
filer01:vol01 filer02:vol02 Source - Idle
#
#
NOTE: At this stage, the snapmirror refresh can be setup using /etc/snapmirror.conf file. The file looks like below. In this example, data is getting refreshed every 0th minute of every hour:
#
#
# rsh filer02 rdfile /etc/snapmirror.conf
filer01:vol01 filer02:vol02 - 0 * * *
#
#

When cutover is needed, do the following:
1) Disable entries from /etc/snapmirror.conf
#
#
# rsh filer02 snapmirror quiesce filer02:vol02
#
#
# rsh filer02 snapmirror break filer02:vol02
#
#
At this stage, delete any extra snapshots which might not be needed anymore.
#
#