Wednesday, July 15, 2015

Entropy in Linux CentOS 6.5 / RHEL 6.5 @ Virtualization TYPE1 and TYPE2 (Performance considerations)

In computing, entropy is the randomness collected by an operating system or application for use in cryptography or other uses that require random data. This randomness is often collected from hardware sources, either pre-existing ones such as mouse movements or specially provided randomness generators. (source wikipedia)

Current Available Entropy in Linux Kernel
# cat /proc/sys/kernel/random/entropy_avail
58

Having a very low entropy generally affects cryptography operations (SSL, HTTPS etc).

Generally entropy is linked to device errors from the hardware. In perfectly virtualized setup (like xen, KVM, virtual box) error stream from hardware is masked by the hypervisor layer. It is recommended to generate entropy by utility programs.

# yum install rng-tools.x86_64

[root@perf04 init.d]# cat /etc/sysconfig/rngd
# Add extra options here
EXTRAOPTIONS="-r /dev/urandom -o /dev/random -t 5"
[root@perf04 init.d]# /etc/init.d/rngd status
rngd is stopped
[root@perf04 init.d]# /etc/init.d/rngd stop
Stopping rngd:                                             [FAILED]
[root@perf04 init.d]# /etc/init.d/rngd start
Starting rngd:                                             [  OK  ]

# cat /proc/sys/kernel/random/entropy_avail
2780

Friday, July 10, 2015

NFS Setup and Performance Tunning on RHEL 6.5 / CentOS 6.5

Install nfs in Server and Client

# yum install nfs-utils nfs-utils-lib nfs-common
# yum install portmap

At Server(192.168.1.1)

Edit /etc/exports file for which directory to export
# cat /etc/exports
/nfsfs 192.168.1.2(rw,sync,no_root_squash)

# chkconfig nfs on
# service rpcbind stop
# service nfs stop

# chkconfig nfs on
# service rpcbind start
# service nfs start

# exportfs -a


At Client(192.168.1.2)

# chkconfig nfs on
# service rpcbind stop
# service nfs stop

# chkconfig nfs on
# service rpcbind start
# service nfs start

# mkdir -p /nfsfs

# cat /etc/fstab
192.168.1.1:/nfsfs  /nfsfs   nfs      auto,soft,noatime,nolock,bg,intr,tcp,actimeo=1800 0 0
# mount -a

# df -kh
192.168.1.1:/nfsfs   44G  5.7G   36G  14% /nfsfs

VIM Editor Tips and Tricks (Linux and UNIX)

To replace ctrl M charter from a file.

:%s/^M//g

To make the above ^M to appear inside VIM command press ctrl +v then ctrl + m.

To Make the file format to UNIX.

When you open the file VIM reports file format as — DOS or Unix:

To modify the file format to UNIX use the below commands inside VIM

:set filetype=unix

:set fileformat=unix

The file will be written back without carriage return (CR, ^M) characters.

Remember to save.

:wq

In case you have to overwrite by force

:wq!

X11 GUI via SSH in CentOS 6 / RHEL 6

Enable X11 forward in Putty in local machine.


Install Cygwin in local machine and Open Xlaunch. use the following settings. Click all Next and close.



Launch the Putty session and connect to remote linux machine.

[root@test ~]# echo $DISPLAY
localhost:10.0
[root@test ~]#  xclock

Now gui Open a XWindow in your local machine.






CPU Clock Speed Monitoring in Linux

Shell command to Monitor CPU Clock speed in Linux

bash#  watch grep \"cpu MHz\" /proc/cpuinfo

Every 2.0s: grep "cpu MHz" /proc/cpuinfo                                                                                          
cpu MHz         : 2792.990
cpu MHz         : 2792.990