Saturday 25 April 2015

Understanding traceroute working and output


There may be scenarios where one would like to know path that packet is following. We can trace path of packet by traceroute and tracert command.

Traceroute command is used in linux and tracert command is used under windows. These commands come handy when you are troubleshooting network related issues.

------------------------------------------------------------------------------------------------------------
Syntax: 
traceroute <destination url>

------------------------------------------------------------------------------------------------------------
Output:
It will print complete list routers that packet visited to reach destination. In output, it lists out IP of routers.

Sometimes you will see '*' symbol in output of traceroute. '*' field in output depicts that required field is unable to fetch by traceroute. There are different reasons for getting '*' field in output but it will successfully reach to a destination.

If in the last line of output, destination is not visible then you can be sure that system is not able to reach to destination. Check following screenshot of traceroute command.

------------------------------------------------------------------------------------------------------------
How it works:

Traceroute uses TTL(Time to live) field from IP packet. For those who are not aware of TTL field, this field describes lifetime of a packet. Usually value of TTL is set to 32 or 64. Each time a router receives any packet it decreases TTL value by one field. When TTL value becomes 0 then packet gets discarded and corresponding router sends error reply to a destination.

By using above situation, traceroute sends a packet using TTL value 1. Next router receives packet and sends error message to destination by decrementing TTL value to 0. This way traceroute go on by increasing TTL value and list out all the IP addresses between source and destination.

Modifying default options.

We can modify default option in traceroute command like TTL value, queries per hop etc. You can refer following link to modify default options in traceroute.

http://www.thegeekstuff.com/2012/05/traceroute-examples/

------------------------------------------------------------------------------------------------------------
example:  traceroute gmail.com


Wednesday 1 April 2015

Install and Configure Samba server on linux



Samba is an open source software suite that provides file, directory and printer sharing between SMB/CIFS clients. In this tutorial we will explain how to configure SAMBA server.

First we will configure SAMBA server for anonymous file sharing and then we will configure authenticated SAMBA share.

In this tutorial, we will use following two machines.

Server: 192.168.0.154
Operating System: CentOS 6.0



Client: 192.168.0.110
Operatin System: Windows XP

Wednesday 25 March 2015

Script to replace special characters from files or directories recursively.



As a linux administrator, there may be a situation where you may want to replace special characters from a file or directory name.

You can easily rename such file or folder by command "mv <old file name> <new file name>". But what if you want to replace special characters of all files and folders present inside a directory. And also it should replace special characters recursively.

You can use following script to replace special characters. In following script, we have replaced special characters by "_" character.

1) Following script will check for special characters in all files and directories present under /mailstore.

2) If you want to replace special characters from another directory then modify script by providing path name of new directory instead of /mailstore.

Monday 23 March 2015

Mail migration via Imapsync tool



As an administrator in mail service provider company, there may be a situation where you may want to switch from old email provider to new one.

During migration from old to new setup, you may need to migrate emails from old server to new server.
You can migrate emails easily and freely via Imapsync utility.
Below is short description on working and usage of mails migration via Imapsync.


-To migrate mails from one server to another we use imapsync utility. It connects to server and synchronise mails from source to destination using IMAP protocol.

-Imapsync is a command line utility that incrementally and recursively transfers mails from one mailbox to another.

Imapsync command is available to download from epel.repo.

You need to install imapsync from epel repository on linux or you can download Imapsync from following link.

https://fedorahosted.org/released/imapsync/

Install imapsync from epel repo.

For 32 Bit systems

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

For 64 bit Systems
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm