Configuring NIS under Red Hat Linux

The following describes a procedure to set up NIS network name service under Red Hat Linux. This is geared toward a small installation with only one domain. However, it should be fairly evident how to add more NIS domains. The NIS domain name has nothing to do with any DNS naming convention being used.
In these examples, the following conventions are used:
NIS domain: “internal”
Code or configuration file data: colored
Root prompt on NIS master server: master#
Root prompt on NIS client host: client#

Setting up a NIS master server:

Required packages: yp-tools ypbind ypserv portmap
Set up “time” service to run via inetd/xinetd, or configure xntpd, or otherwise make sure the host’s clock is synchronized.
Edit /etc/yp.conf:

domain internal server ip.of.nis.server

Edit /etc/ypserv.conf:

dns: no
files: 30
xfr_check_port: yes
* : * : shadow.byname : port
* : * : passwd.adjunct.byname : port

Edit /etc/sysconfig/network:


Set NIS domain name:

master# domainname internal
master# ypdomainname internal

Create file /var/yp/securenets:


Make sure the “portmap” service is running:

master# service portmap start
master# chkconfig portmap on

Portmap will need a rule in /etc/hosts.allow to allow access from localhost and any hosts that need to access NIS.
Start ypserv service:

master# service ypserv start

Check that it’s listening:

master# rpcinfo -u localhost ypserv

You should see:

program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting

Initialize the NIS maps:

master# /usr/lib/yp/ypinit -m

Specify local hostname, Ctrl-D, y, let finish.
Start up ypbind, yppasswdd, ypxfrd:

master# service ypbind start
master# service yppasswdd start
master# service ypxfrd start

Set YP services to run on boot-up:

master# chkconfig ypserv on
master# chkconfig ypbind on
master# chkconfig yppasswdd on
master# chkconfig ypxfrd on

NIS client host setup

Required packages: yp-tools ypbind portmap
Edit /etc/sysconfig/network:


Edit /etc/yp.conf:

domain internal server ip.of.master.server

Edit /etc/hosts:

ip.of.master.server    hostname.domain hostname

Set NIS domain-name:

client# domainname internal
client# ypdomainname internal

Edit /etc/nsswitch.conf:

passwd:     files nis
shadow:     files nis
group:      files nis

Make sure the portmap service is running:

client# service portmap start
client# chkconfig portmap on

The /etc/hosts.allow file will need rules allowing access from localhost and the NIS master server.
Start ypbind service:

client# service ypbind start
client# chkconfig ypbind on

Test it out:

client# rpcinfo -u localhost ypbind
client# ypcat passwd

Difference between IMAP and POP3

IMAP stands for “Internet Message Access Protocol”. It’s a fancy name for a protocol used by email programs like Outlook, Thunderbird, and others to access your email.
IMAP is an alternative to POP3 (Post Office Protocol 3), works in some fundamentally different ways, and makes a few fundamentally different assumptions.
IMAP and POP are two different protocols. There are many differences between these two. The main difference is that IMAP(Internet Messaged Access Protocol) always syncs with mail server so that any changes you make in your mail client (Microsoft Outlook, Thunderbird) will instantly appear on your webmail inbox.
On the other hand, in POP(Post Office Protocol), your mail client account and mail server are not synced. It means whatever changes you make to your email account in the mail client will not be transferred to the webmail inbox.
In simple terms, if you are using IMAP and mark a mail as read, it gets marked as read in your web based inbox too (because the changes are happening on the server). However, this won’t be the case if you are using POP, because the mails are downloaded to your PC and the changes won’t reflect on the server.

DNS Configuration in Linux

DNS (Domain Naming Service)
DNS is a service which is used to resolve host to IP address and zone records & configuration files.
There are two types of zonerecords
1) Forwad lookup zone
2) Reverse lookup zone
By defaults, computer connects to another computer with the help of IP address
Forward lookup zone
It converts names into IP addresses
Reverse lookup zone
It converts IP addresses to names

#yum install bind-* caching-nameserver*-y
#service named start
#chkconfig named on
#cd /var/named/chroot/etc
#cp named-caching-nameserver named.conf
#vi named.conf
delete ipv6 lines (line nos. 16 &22)
(line no15) Listen on port 53 {;;}
(here is server ip
(line no 21) allow-query (clients range)
(line no 30) match-clients {local host;; } (here is clients ip range & subnet mask)
(line no 31) match-destinations    {localhost;;}


# vi /etc/rfc1912.zones
copy ten lines from 21 to 31 and paste under 31
change as follows
zone "" IN {
type master;
file "redhat.for"
allow-update { none; };
zone "0.168.192.IN-addr-arpa IN {
type master;
file "redhat.rev"
allow-update { none; };

(here is domain name and 0.168.192. is redhat.coms network range redhat.for is forward look up zone & redhat.rev is reverse lookup zone)
save & quit

# chgrp named named.conf
#chgrp named named.rfc1912.zones
#cd /var/named/chroot/var/named
#cp redhat.for
#cp named.local redhat.rev
# vi redhat.for

change as follows

$TTL    86400
@               IN SOA (
42              ; serial (d. adams)
3H              ; refresh
15M             ; retry
1W              ; expiry
1D )            ; minimum
IN NS              IN A             IN CNAME           IN A                IN CNAME          IN A               IN CNAME              IN CNAME              IN CNAME        IN A             IN CNAME        IN A             IN CNAME        IN A             IN CNAME            IN A                  IN CNAME

(zone: zone is a storage database which contains all zone records
forward lookup zone: used for resolving hostname to ipaddress & it maintains host to ip mapping information
reverse lookup zone: used for resolving ip address to hostname & it maintains ip to hostname mapping information
types of records:
SOA : sort of authority the first record in any zone  it indicates who is authority for this domain
NS :nameserver it identifies the dns server for each zone
A record : resolves hostname to ip address
CNAME record : resolves an alias name to a hostname
PTR record : resolves an ipaddress to a hostname
MX record : resolves mail server ip (used by mail server)
TTL :time to live)
save & quit

#vi redhat.rev
(change as follows)
$TTL    86400
@       IN      SOA  (
1997022700 ; Serial
28800      ; Refresh
14400      ; Retry
3600000    ; Expire
86400 )    ; Minimum
IN        NS
254      IN       PTR
1         IN       PTR
2        IN       PTR
3         IN      PTR
4         IN      PTR
5         IN      PTR
6         IN      PTR

save & quit

# chgrp named redhat.for
# chgrp named redhat.rev
# service named restart

to check:

#dig -x
(if answer is 1 server is ready if answer is 0 server has some error)

to check error in configuration file

#named-checkconf /var/named/chroot/etc/named.conf

to check errors in zone record

#named-checkzone /var/named/chroot/var/named/redhat.for
#named-checkzone /var/named/chroot/var/named/redhat.rev

Master DNS Server
It is the Master Copy of all the Zone Information.
It is Read/Write copy.
Slave DNS Server
It is Slave Backup of Master zone. It is Read Only
if any error may occur to your dns server at the time the entir network will stop.sometimes it may cause huge damage.for that one we are createing slave dns for faulttolerance and load balancing.
we need another system which contains server o/s

#yum install bind-* caching-nameserver -y
#service named start
#chkconfig named on
#cd /var/named/chroot/etc/

(change as follows)
copy 10 lines from 21 to 31 paste under 31

zone ""
type slave;
file "redhat.for"
masters {};
zone "0.168.192. IN-ADDR-arpa" IN {
type slave ;
file " redhat.rev"
masters {;};

save& quit

#service named restart

go to client
#i /etc/resolv.conf

nameserver (slave dns ip)

if you have trusted relationship with another company  those comapny users can enter into our network & our company users can enter into their network by using this forwarders
in master dns server

# vi /var/named/chroot/etc/named.conf

add aline

forwarders {};
forward only ;

(here is trusted companies dns)
save & quit

#service named restart