About Me

My photo
Hi Friends, I am Sandeep CC and some people know me as System Administrator. I have started my professional career from 2008. I have been working as System Administrator on Linux Server and Windows Client. I am here to share my Knowledge in which I have experienced and which I have come across till now, It could be help to you people. In case anything wrong or any improvements in my post steps, Please comment to the post, Feel free to contact me by posting comments on this blog. Thanks and Regards, Sandeep CC

Tuesday, August 14, 2012

Configuration Mail Server On REDHAT LINUX-5

MAIL SERVER WITH REDHAT LINUX AND WINDOWS CLIENTS:




Server Setup:


Server: freedom-web.sandeepc.com
Domain Name: sandeepc.com
Server IP: 192.168.1.1
Client: Linux and Windows XP/2003

Requirement PACKAGE AND SERVICES:

1. PACKAGE:

DOVECOT (For Incoming Mail)
Sendmail (For Outgoing Mail)

2. SERVICES:

DNS (named) service (Click here to check Installation steps of DNS SERVER)
APACHE (httpd) service (This is optional service)(Click here to check Installation steps of APACHE/WEBSERVER)


INSTALL DOVECOT RPM FOR INCOMING MAILS

[root@freedom-web Server]# rpm -i dovecot-1.0-1.2.rc15.el5.i386.rpm
warning: dovecot-1.0-1.2.rc15.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@freedom-web Server]#

[root@freedom-web Server]# cd /etc/
[root@freedom-web etc]# ls -ltr |grep dov
-rw-r--r-- 1 root root 39849 Dec 22 2006 dovecot.conf
[root@freedom-web etc]# cp dovecot.conf dovecot.conf.org
[root@freedom-web etc]# vi dovecot.conf

(Line No 17 Remove "#")
protocols = imap imaps pop3 pop3s

INSTALL SENDMAIL & SENDMAIL.CF FOR OUTGOING MAILS

[root@freedom-web etc]# rpm -qa |grep sendmail
sendmail-8.13.8-2.el5
[root@freedom-web etc]#

[root@freedom-web Server]# rpm -i sendmail-cf-8.13.8-2.el5.i386.rpm
warning: sendmail-cf-8.13.8-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@freedom-web Server]#

[root@freedom-web mail]# cd /etc/mail
[root@freedom-web mail]# vi sendmail.mc

(#####Line no 116 look like this#####)
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

(#####Line no 155 look like this#####)

dnl LOCAL_DOMAIN(`localhost.localdomain')dnl
#dnl LOCAL_DOMAIN(`sandeepc.com')dnl

[root@freedom-web mail]# m4 sendmail.mc > sendmail.cf
[root@freedom-web mail]#

[root@freedom-web mail]# vi access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
#sandeepc.com RELAY
connect station: sandeepc.com ----> add this line
connect: sandeepc.com -----> add this line
connect: 192.168.1.1 -----> add this line

:wq save and exit

[root@freedom-web mail]# make
make: Nothing to be done for `all'.
[root@freedom-web mail]#

DNS CONFIGURATION FOR FQDN

[root@freedom-web mail]# cd /var/named/chroot/var/named/
[root@freedom-web named]#

[root@freedom-web named]# vi sandeepc.com.zone
$TTL 86400
@ SOA sandeepc.com. root(
42 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

sandeepc.com MX 10 mail ;primary mail exchanger -----> add this line
@ NS freedom-web.sandeepc.com.
@ NS client1.client.com.
freedom-web A 192.168.1.1
mail A 192.168.1.1 ----------> add this line


:wq & Save Exit

Note: Finally Restart dovecot & sendmail service (After modifying anything in config file restart the both service once)

Client Setup With Windows:


I have tried mail server with windows client,Configured client in XP & Win-2k3 with outlook express...
STEP-1


STEP-2


STEP-3


STEP-4


STEP-5

Now User have added to Outlook Express, now try to synchronize, if get any problem with synchronize, check with user and pass, check with firewall in server and client too, if iptables is on then enable port no 53 for tcp & utp. then again try to synchronize...


Thanks and Regards,
Sandeep CC

Friday, August 10, 2012

Configure DNS Server Redhat Linux - 5

CONFIGURE DNS (DOMAIN NAMING SERVER) ON REDHAT LINUX - 5

Setup:
Server : RHEL-5
Localhost Name: freedom-web
Domain Name: sandeepc.com
Server IP: 192.168.4.1

Client: Windows-2003, XP & Linux

Requirment: This bind & caching-nameserver packages available on RHEL-5 DVD only...

Installation of Packages:

THESE PACKAGES INSTALLED DEFAULT
[root@FREEDOM-WEB Server]# rpm -qa |grep bind
bind-libs-9.3.3-7.el5
bind-utils-9.3.3-7.el5
ypbind-1.19-7.el5
[root@FREEDOM-WEB Server]#

NEED TO INSTALL THESE PACKAGES
[root@FREEDOM-WEB Server]# rpm -i bind-9.3.3-7.el5.i386.rpm
warning: bind-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -i bind-devel-9.3.3-7.el5.i386.rpm
warning: bind-devel-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -i bind-libbind-devel-9.3.3-7.el5.i386.rpm
warning: bind-libbind-devel-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -i bind-sdb-9.3.3-7.el5.i386.rpm
warning: bind-sdb-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -i caching-nameserver-9.3.3-7.el5.i386.rpm
warning: caching-nameserver-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -i cachefilesd-0.7-6.el5.i386.rpm
warning: cachefilesd-0.7-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -i bind-chroot-9.3.3-7.el5.i386.rpm
warning: bind-chroot-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
[root@FREEDOM-WEB Server]#

CHECK BELOW PACKAGES INSTALLED PROPERLY
[root@FREEDOM-WEB Server]# rpm -qa |grep bind
bind-libs-9.3.3-7.el5
bind-9.3.3-7.el5
bind-chroot-9.3.3-7.el5
bind-utils-9.3.3-7.el5
bind-devel-9.3.3-7.el5
bind-sdb-9.3.3-7.el5
ypbind-1.19-7.el5
bind-libbind-devel-9.3.3-7.el5
[root@FREEDOM-WEB Server]#

[root@FREEDOM-WEB Server]# rpm -qa |grep caching
caching-nameserver-9.3.3-7.el5
[root@FREEDOM-WEB Server]# rpm -qa |grep cachefilesd
cachefilesd-0.7-6.el5
[root@FREEDOM-WEB Server]#



Set hostname to freedom-web.sandeepc.com and ip address to 192.168.1.1

[root@FREEDOM-WEB ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=freedom-web.sandeepc.com
[root@FREEDOM-WEB ~]#

[root@FREEDOM-WEB ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:C1:C7:31
inet addr:192.168.1.1 Bcast:192.168.1.1 Mask:255.255.255.255
inet6 addr: fe80::20c:29ff:fec1:c731/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:117021 errors:0 dropped:0 overruns:0 frame:0
TX packets:28367 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:49770336 (47.4 MiB) TX bytes:4354972 (4.1 MiB)
Interrupt:67 Base address:0x2024
[root@FREEDOM-WEB ~]#

Add DNS IP in resolv.conf file (server IP)
[root@FREEDOM-WEB ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search com
nameserver 192.168.4.1
[root@FREEDOM-WEB~]#

Modify with hosts file (do not remove localhost line, add server ip and name) (This is main for mail server)
[root@educloudsvr ~]# cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost.localdomain   localhost4      localhost4.localdomain4 localhost
::1     localhost.localdomain   localhost.localdomain   localhost6      localhost6.localdomain6 localhost
192.168.4.1     freedom-web.sandeepc.com        mail
[root@educloudsvr ~]#

By Default should create below files, if not created then create manualy named.conf file and enter as it is how given below things:

[root@FREEDOM-WEB etc]# cd /var/named/chroot/etc
[root@FREEDOM-WEB etc]# ls -ltr
total 40
-rw-r----- 1 root named 955 Jan 16 2007 named.rfc1912.zones
-rw-r----- 1 root named 1100 Jan 16 2007 named.caching-nameserver.conf
-rw-r--r-- 1 root root 1017 Jul 17 09:52 localtime
-rw-r--r-- 1 root named 113 Aug 9 02:40 rndc.key
-rw-r--r-- 1 root named 225 Aug 9 03:05 named.conf
[root@FREEDOM-WEB etc]#
===========================================================================================================
NOTE:::If not created named.conf file then only need to follow this step
[root@FREEDOM-WEB etc]# vi named.conf
options{
directory "/var/named/";
};

zone "sandeepc.com" {
type master;
file "sandeepc.com.zone";
allow-transfer {192.168.1.254;};
};
zone "1.168.192.in-addr.arpa" {
type master;
file "1.168.192.in-addr.arpa.zone";
};
[root@FREEDOM-WEB etc]#
========================================================================================================================================

CONFIGURE ZONE FILE

Here shown two zone files FORWARD & REVERSE ZONE FILES sandeepc.com.zone for forward zone and 1.168.192.in-addr.arpa for reverse zone. These files will be store be default in /var/named/chroot/var/named/ location. We will use two sample files for creating these files.

Change directory to /var/named/chroot/var/named and copy the sample files to name which we have set in named.conf

[root@FREEDOM-WEB etc]# cd /var/named/chroot/var/named/
[root@FREEDOM-WEB named]#

FORWARD ZONE CREATION
[root@FREEDOM-WEB named]# cp localhost.zone sandeepc.com.zone
[root@FREEDOM-WEB named]#

REVERSE ZONE CREATION
[root@FREEDOM-WEB named]# cp named.local 1.168.192.in-addr.arpa.zone
[root@FREEDOM-WEB named]#

Now open forward zone file sandeepc.com.zone
####By default this file will look like this###
[root@FREEDOM-WEB named]# vi sandeepc.com.zone

$TTL 86400
@ IN SOA @ root(
42 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS @
IN A 127.0.0.1
IN AAAA ::1
~
###########################################################################################################

#####Change this file as per requirement as shown in below zone file####

[root@FREEDOM-WEB named]# vi sandeepc.com.zone
$TTL 86400
@ SOA sandeepc.com. root(
42 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
sandeepc.com MX 10 mail ;primary mail exchanger -----> This is for Mail Server
@ NS freedom-web.sandeepc.com.
@ NS client1.client.com.
freedom-web A 192.168.1.1
client1 A 192.168.1.2
client2 A 192.168.1.3
mail A 192.168.1.1 ----------> This is for Mail Server

:wq save and exit
###########################################################################################################

Now open reverse lookup zone file 1.168.192.in-addr.arpa
[root@FREEDOM-WEB named]# vi 1.168.192.in-addr.arpa.zone

####By default this file will look like this###

$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

###########################################################################################################

#####Change this file as per requirement as shown in below zone file####

[root@FREEDOM-WEB named]# vi 1.168.192.in-addr.arpa.zone
$TTL 86400
@ SOA sandeepc.com root.freedom-web.sandeepc.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS freedom-web.sandeepc.com
1 IN PTR freedom-web.sandeepc.com.
2 IN PTR client1.sandeepc.com.
3 IN PTR client2.

:wq save and exit

###########################################################################################################

####Now need to change the ownership of these zone files to named group####
####Before changing ownership snap####


[root@FREEDOM-WEB named]# ls -ltr
total 104
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
drwxrwx--- 2 named named 4096 Aug 25 2004 data
-rw-r----- 1 root named 427 Jan 16 2007 named.zero
-rw-r----- 1 root named 426 Jan 16 2007 named.local
-rw-r----- 1 root named 424 Jan 16 2007 named.ip6.local
-rw-r----- 1 root named 2518 Jan 16 2007 named.ca
-rw-r----- 1 root named 427 Jan 16 2007 named.broadcast
-rw-r----- 1 root named 198 Jan 16 2007 localdomain.zone
-rw-r----- 1 root named 167 Aug 9 03:26 localhost.zone.rpmorig
-rw-r----- 1 root root 195 Aug 9 04:01 localhost.zone.backup
-rw-r----- 1 root root 167 Aug 9 04:02 localhost.zone
-rw-r----- 1 root root 273 Aug 9 04:11 sandeepc.com.zone -------> its showing root group
-rw-r----- 1 root root 519 Aug 9 04:20 1.168.192.in-addr.arpa.zone ------> its showing root group
[root@FREEDOM-WEB named]#


####After changing ownership snap####

[root@FREEDOM-WEB named]# ls -ltr
total 104
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
drwxrwx--- 2 named named 4096 Aug 25 2004 data
-rw-r----- 1 root named 427 Jan 16 2007 named.zero
-rw-r----- 1 root named 426 Jan 16 2007 named.local
-rw-r----- 1 root named 424 Jan 16 2007 named.ip6.local
-rw-r----- 1 root named 2518 Jan 16 2007 named.ca
-rw-r----- 1 root named 427 Jan 16 2007 named.broadcast
-rw-r----- 1 root named 198 Jan 16 2007 localdomain.zone
-rw-r----- 1 root named 167 Aug 9 03:26 localhost.zone.rpmorig
-rw-r----- 1 root root 195 Aug 9 04:01 localhost.zone.backup
-rw-r----- 1 root root 167 Aug 9 04:02 localhost.zone
-rw-r----- 1 root named 273 Aug 9 04:11 sandeepc.com.zone ---------> changed group with named
-rw-r----- 1 root named 519 Aug 9 04:20 1.168.192.in-addr.arpa.zone --------> changed group with named
[root@FREEDOM-WEB named]#

### Now try to start and restart the service ###

[root@FREEDOM-WEB named]# service named start
Starting named: [ OK ]
[root@FREEDOM-WEB named]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@FREEDOM-WEB named]#


#### If service restart without any error means you have successfully configured DNS server ######

root@freedom-web named]# host 192.168.1.1
1.1.168.192.in-addr.arpa domain name pointer freedom-web.sandeepc.com.
[root@freedom-web named]# host freedom-web.sandeepc.com
freedom-web.sandeepc.com has address 192.168.1.1
[root@freedom-web named]#

#### Now check with windows machine (Within Network Machine) ####
GO TO RUN --> CMD --> nslooup
nslookup
Default Server: freedom-web.sandeepc.com
Address: 192.168.1.1

#### WE CAN CHECK WITH BROWSER ALSO, FOR THIS WE HAVE TO START HTTPD SERVICE####

In Browser (Server It Self)
http://192.168.4.1 (Apache Test Page Should Open)
http://freedom-web.sandeepc.com (Apache Test Page Should Open)

Client Side need to open means, you must need to put DNS as 192.168.1.1 in IP Address (If IP is static), If IP getting from DHCP server then add this DNS IP in DHCP server so it will get automatically...

Thanks and Regards,
Sandeep CC