Thursday, December 30, 2010

Why do I receive "unable connect to socket: No route to host (113)"

■ Error : Why do I receive "unable connect to socket: No route to host (113)"
■ OS Environment : Linux[RHEL, Centos]
■ Application: vncviewer 
■ Resolution : 

  •  Please check the firewall in the linux server.  Please allow the ports 5801,5901 and 6001 in the iptables or firewall. 
  • Then restart the firewall and try to connect to the server. 
  • Disable firewall.
  • Make sure proper gateway is setup for all defined routes.



Flow diagram of systemtap debugging scripting tool


■ Requirement : Flow diagram of systemtap debugging scripting tool
■ OS Environment : Linux[RHEL, Centos]
■ Application: systemtap
■ Implementation Steps : 

Systemtap: Scripting tool to debug and monitor the whole system processes or any events.

Installation step : 

yum install kernel-devel
yum install kernel-debuginfo
yum install systemtap















Usage Syntax :

-------------
probe {handler}

Where event is kernel.function, process.statement, timer.ms, begin, end etc

and handler can be filtering/control statement and
helper function : log, printf, pid etc
-------------


Example :

$cat hellworld.stp
probe begin
{
print("This is hello world\n")
exit()
}


Execution of above script :

$ stap hellworld.stp 
This is hello world
$ cat primecheck.stp
function isprime (x) {
if (x < 2) return 0
for (i = 2; i < x; i++) {
if (x % i == 0) return 0
if (i * i > x) break
}
return 1
}

probe begin {
for (i = 0; i < 50; i++)
if (isprime (i)) printf("%d\n", i)
exit()
}


stap-authorize-signing-cert stap-report
$ stap primecheck.stp
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47




Tuesday, December 28, 2010

How to remotely access the linux desktop from any linux or windows machine?

■ Requirement : How to remotely access the linux desktop from any linux or windows machine
■ OS Environment : Linux[RHEL, Centos]
■ Application: vncserver, vncviewer
■ Implementation Steps : 

1. On server-linux(Which will be accessed) : yum install vnc*
2. On client-linux(who will access the remote desktop of the server ) : yum install vncviewer
3. On server, execute following command  :

$vncpasswd

Set password to access over vnc.

4. Edit /etc/sysconfig/vncservers

VNCSERVERS="1:root"

5. Enable at boot level :

$ chkconfig vncserver on

6. Start VNC server :

$ service vncserver start

7. If firewall present, allow port 5901.

9. Edit /root/.vnc/xstartup and comment following lines :

#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc

10. On client :

Execute command : 

$vncviewer

Enter IP of the server and password of the server. Now remote desktop will appear. OR you can access the rdesktop like :

$vncviewer IP_of_SERVER:1

Access from windows client : 
           To access the server from windows machine please install vncviewer on it and execute the binary. Then put IP of the server and password. that's it.



Wednesday, December 22, 2010

How to configure autofs with NFS4?

■ Requirement : install & configure autofs
■ OS Environment : Linux[RHEL, Centos]
■ Application:autofs
■ Implementation Steps : 

1. On NFS client machine do the following :

$ yum install autofs

2. Edit /etc/auto.master & and put like :

/home /etc/auto.home --timeout=60

4. Edit /etc/auto.home and put following :

* -fstype=nfs,rw,nosuid,soft,fsid=0 IPof_nfs_server:/home/&

5. Start autofs :

$/etc/init.d/autofs start

Tuesday, December 21, 2010

How to install and configure NFSv4 server and client on linux mach4ine?

■ Requirement : Install & Configure NFSv4
■ OS Environment : NFS client - RHEL 5, NFS SERVER - RHEL 6
■ Application: nfsv4
■ Assumption : 

  •            Client IP= 10.65.211.15, 
  •            NFS server IP =10.65.211.12, 
  •            FS Share Directory : /var/nfs4testing

■ Implementation Steps : 

How NFS Works :

       NFS consists of at least two main parts: a server and one or more clients. The client remotely accesses the data that is stored on the server machine. In order for this to function properly a few processes have to be configured and running.

The server has to be running the following daemons:

Daemon Description :

      nfsd : The NFS daemon which services requests from the NFS clients.
      mountd  : The NFS mount daemon which carries out the requests that nfsd passes on to it.
      rpcbind :This daemon allows NFS clients to discover which port the NFS server is using.

  The client can also run a daemon, known as nfsiod. The nfsiod daemon services the requests from the NFS server. This is optional, and improves performance, but is not required for normal and correct operation.

A. NFS server configuration for nfs4 :

$ yum install nfs-utils nfs4-acl-tools portmap
$ cat /etc/exports
/var/nfs4testing/ 10.65.211.15(rw,sync,fsid=0) 

$chkconfig nfs on
$ chkconfig portmap on

$ cat /etc/hosts.deny | grep portmap
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
portmap:ALL

$ cat /etc/hosts.allow| grep 10.65.211
portmap:10.65.211.0/24
portmap:10.65.192.0/24

Verify that following daemons are running on server : 

$ rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 896 status
100024 1 tcp 899 status
100011 1 udp 1000 rquotad
100011 2 udp 1000 rquotad
100011 1 tcp 1003 rquotad
100011 2 tcp 1003 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 60156 nlockmgr
100021 3 udp 60156 nlockmgr
100021 4 udp 60156 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 51539 nlockmgr
100021 3 tcp 51539 nlockmgr
100021 4 tcp 51539 nlockmgr
100005 1 udp 603 mountd
100005 1 tcp 606 mountd
100005 2 udp 603 mountd
100005 2 tcp 606 mountd
100005 3 udp 603 mountd
100005 3 tcp 606 mountd

B. NFS client configure for NFSv4 : -

$ yum install nfs-utils
$ mount -t nfs 10.65.211.12:/ /mounted/

Monday, December 20, 2010

Which desktop is used by my linux machine?

■ Requirement : Find which desktop is installed on linux
■ OS Environment : Linux[RHEL, Centos]
■ Implementation Steps : 

          Check the directory : /usr/share/xsessions. It has been defined there. You can also execute the following command to get the result.

$  find /usr/share/xsessions -name "*.desktop" -exec basename "{}" .desktop ";"
gnome