Posts

How to Create/delete Softlink & Hardlink

A link is nothing more than a way of matching two or more file names to the same set of file data.

How to create softlink

A soft link, or more common, a symlink, is link a shortcut to the targeted file or directory. So when is removed the original target stays present. This is the opposite of a hard link which is a reference to the target and so, if the hard link is removed, so is the target.

# ln -s /directory/ xymon

How to delete the softlink

#unlink xymon

How to create hardlink

Hard links are essentially a file with multiple names. Hard links share the same data blocks on the hard disk (have the same inode), while they continue to behave as independent files. If one of the hard links is deleted, the hard link count decreases by one. When all hard links are deleted, the data ceases to exist.

# ln -i /directory/file hardlink/file

How to delete the hardlink

#rm hardlink/file

How to create DNS server in linux

Introduction

Domain Name System (DNS) is a standard technology for managing public names of Web sites and other Internet domains. The Internet maintains two principal namespaces: the domain name hierarchy and the IP address system. The Domain Name System maintains the domain namespace and provides translation services between these two namespaces. Internet name servers implement the Domain Name System. The top hierarchy of the Domain Name System is served by the root name servers maintained by delegation by the Internet Corporation for Assigned Names and Numbers (ICANN). Below the root, Internet resources are organized into a hierarchy of domains, administered by the respective registrars and domain name holders. A DNS name server is a server that stores the DNS records, such as address (A, AAAA) records, name server (NS) records, and mail exchanger (MX) records for a domain name and responds with answers to queries against its database.

By Default Port # 53
Dns-query

Step 1: Installation

To create a DNS server, firstly we have to install the bind packages:

# yum -y install bind.* bind-utils
Loaded plugins: amazon-id, rhui-lb
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-18.el7_1.1 will be installed
--> Processing Dependency: bind-libs = 32:9.9.4-18.el7_1.1 for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: liblwres.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libisccfg.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libisccc.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libisc.so.95()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libdns.so.100()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libbind9.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
---> Package bind-utils.x86_64 32:9.9.4-18.el7_1.1 will be installed
--> Running transaction check
---> Package bind-libs.x86_64 32:9.9.4-18.el7_1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                       Arch                      Version                                   Repository                                           Size
=============================================================================================================================================================
Installing:
 bind                          x86_64                    32:9.9.4-18.el7_1.1                       rhui-REGION-rhel-server-releases                    1.8 M
 bind-utils                    x86_64                    32:9.9.4-18.el7_1.1                       rhui-REGION-rhel-server-releases                    199 k
Installing for dependencies:
 bind-libs                     x86_64                    32:9.9.4-18.el7_1.1                       rhui-REGION-rhel-server-releases                    1.0 M

Transaction Summary
=============================================================================================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 2.9 M
Installed size: 7.2 M
Downloading packages:
(1/3): bind-9.9.4-18.el7_1.1.x86_64.rpm                                                                                               | 1.8 MB  00:00:00
(2/3): bind-libs-9.9.4-18.el7_1.1.x86_64.rpm                                                                                          | 1.0 MB  00:00:00
(3/3): bind-utils-9.9.4-18.el7_1.1.x86_64.rpm                                                                                         | 199 kB  00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        5.0 MB/s | 2.9 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 32:bind-libs-9.9.4-18.el7_1.1.x86_64                                                                                                      1/3
  Installing : 32:bind-utils-9.9.4-18.el7_1.1.x86_64                                                                                                     2/3
  Installing : 32:bind-9.9.4-18.el7_1.1.x86_64                                                                                                           3/3
  Verifying  : 32:bind-utils-9.9.4-18.el7_1.1.x86_64                                                                                                     1/3
  Verifying  : 32:bind-libs-9.9.4-18.el7_1.1.x86_64                                                                                                      2/3
  Verifying  : 32:bind-9.9.4-18.el7_1.1.x86_64                                                                                                           3/3

Installed:
  bind.x86_64 32:9.9.4-18.el7_1.1                                            bind-utils.x86_64 32:9.9.4-18.el7_1.1

Dependency Installed:
  bind-libs.x86_64 32:9.9.4-18.el7_1.1

Complete!

Step 2: Configuration

Edit the file named.conf and make the changes:

# vi /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.0.100;};
allow-query     { localhost; 192.168.1.0/24; };     
# vi /etc/resolv.conf
server 192.168.0.100

To flush the DNS cache

# rnds flush
# vi /etc/named.rfc1912.zones