Tuesday, 16 February 2016

DNS Server Configuration named in RHEL

Pr-requisition install named

Very simple method just two steps to setup dns server for private LAN network.

Step-1:

File :   /etc/named.config

/
// named.conf for caching-nameserver
//

options {
        directory "/var/named";
        listen-on-v6 { any; };

        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        query-source address * port 53;
};


include "/etc/rndc.key";

zone "abc.com" {
        type master;
        notify no;
        file "acb.com.zone";
};




Step-2


vi /var/named/abc.com.zone

$TTL    86400
@               IN SOA  centos6.abc.com. root.abc.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           centos6
centos6         IN AAAA 2001:1::100
centos6         IN A    192.168.1.100


Keep Add your  IPv4 - A Record &  IPV6 AAAA record in the zone file.

Start named daemon

/etc/init.d/named start
root@localhost network-scripts]# /etc/init.d/named status
version: 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.6
CPUs found: 1
worker threads: 1
number of zones: 17
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
named-sdb (pid  5911) is running...


DNS Client : Host
---------------

Configure nameserver to resolve dns request .

/etc/resolve.conf

nameserver 192.168.1.100

ping centos6.abc.com




Sunday, 17 January 2016

Mount ISO and Install FTP Client & Server

If ftp server not running in your Linux Box.

If you have ISO image. mount to local machine.


[root@localhost ~]# mount -o loop /home/ssankar/rhel-server-6.0-i386-dvd.iso /mnt/
[root@localhost ~]# cd /mnt/
[root@localhost mnt]#
[root@localhost Packages]# pwd
/mnt/Packages

Install FTP Client
----------------


[root@localhost Packages]# rpm -ivh ftp-0.17-51.1.el6.i686.rpm
warning: ftp-0.17-51.1.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:ftp                    ########################################### [100%]
[root@localhost Packages]# ftp
ftp> quit
[root@localhost Packages]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 2.2.2)

Install FTP  Server
----------------

[root@localhost Packages]# rpm -ivh vsftpd-2.2.2-6.el6.i686.rpm
warning: vsftpd-2.2.2-6.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]
[root@localhost Packages]#
[root@localhost Packages]# service vsftpd status
vsftpd is stopped
[root@localhost Packages]# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]


AWK Script Basic

[ssankar@localhost AWK]$ cat empdata.txt
1|100|sankar|dell|chennai
2|101|rahul|tcs|chennai
3|102|pal|cts|bangalore
4|103|kali|cts|bangalore
5|104|john|cts|bangalore
6|105|pal2|cts|bangalore
[ssankar@localhost AWK]$ cat sum.awk
BEGIN{
        FS="|"
        SNO=1 ;
        EMPID=2 ;
        NAME=3 ;
        COMPANY=4 ;
        LOCATION=5 ;
}
{
        list[$4] += 1;
        sum += $1 ;
}
END{
        printf ("%d\n", sum) ;

        for (comp in list)
        {
                printf("%s %d \n", comp, list[comp]);
        }
}
[ssankar@localhost AWK]$ awk -f sum.awk empdata.txt
21
tcs 1
dell 1
cts 4
[ssankar@localhost AWK]$