DNS in Linux for System Administrator

Why is DNS important?

DNS is like a phone book for the Internet. If you know a person’s name but don’t know their telephone number, you can simply look it up in a phone book. DNS provides this same service to the Internet.

When you visit http://facebook.com in a browser, your computer uses DNS to retrieve the website’s IP address of 31.13.69.228. Without DNS, you would only be able to visit our website (or any website) by visiting its IP address directly, such as http://31.13.69.228.

rupin@L687:~$ ping facebook.com
PING facebook.com (31.13.69.228) 56(84) bytes of data.
64 bytes from edge-star-mini-shv-01-iad3.facebook.com (31.13.69.228): icmp_seq=1 ttl=42 time=347 ms

When a linux computer looks for another computer IP it looks for the information in two files : /etc/hosts and /etc/resolv.conf. The order in which the files are consulted is configured on /etc/nsswitch.conf:

$ cat /etc/nsswitch.conf
hosts: files,dns

Search first on files (/etc/hosts) and then on dns (/etc/resolv.conf).

/etc/hosts:
This file is a simple database that relates a numeric IP with a hostname. It can be edited as a normal file with ‘vi’ command in order to add more information.

# cat /etc/hosts
 127.0.0.1 localhost.localdomain localhost
 192.168.1.1 rupin.server.com server

The first line maps the 127.0.0.1 IP to the hostnames localhost, short hostname, and localhost.localdomain, FQHN hostname. The second line maps the 192.168.1.1 IP to server and rupin.server.com hostname.

/etc/resolv.conf:
In order to configure a linux computer as a DNS client the file /etc/resolv.conf must be used.

# cat /etc/resolv.conf 
 search info.net
 nameserver 192.168.1.1 

In this case all DNS queries launched from the computer will be addressed to the nameserver on 192.168.1.1. If a short hostname is provided it will be complemented automatically with ‘info.net’ domain.

Note: By default if a DNS query is done and can be answered from /etc/hosts the nameserver configured on /etc/resolv.conf is not consulted. Only the information obtained from /etc/hosts is taken as valid.

Continue reading “DNS in Linux for System Administrator”

Advertisements

System Administrator | All about Date & Time in linux

Modern operating systems distinguish between the following two types of clocks:
  • real-time clock (RTC), commonly referred to as a hardware clock, (typically an integrated circuit on the system board) that is completely independent of the current state of the operating system and runs even when the computer is shut down.
  • system clock, also known as a software clock, that is maintained by the kernel and its initial value is based on the real-time clock. Once the system is booted and the system clock is initialized, the system clock is completely independent of the real-time clock.
The system time is always kept in Coordinated Universal Time (UTC) and converted in applications to local time as needed. Local time is the actual time in your current time zone, taking into account daylight saving time (DST). The real-time clock can use either UTC or local time. UTC is recommended.
Red Hat Enterprise Linux 7 offers three command line tools that can be used to configure and display information about the system date and time: the timedatectl utility, which is new in Red Hat Enterprise Linux 7 and is part of systemd; the traditional date command; and the hwclock utility for accessing the hardware clock.

Continue reading “System Administrator | All about Date & Time in linux”

Mysql replication setup in linux

MySQL replication is a process that allows you to easily maintain multiple copies of a MySQL data by having them copied automatically from a master to a slave database. Replication enables data from one MySQL database server (the master) to be copied to one or more MySQL database servers (the slaves). Replication is asynchronous by default; slaves do not need to be connected permanently to receive updates from the master. Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a database.MySQL is one of the most popular open source relational database management system (RDBMS). When your traffic grows then you need to increase the instances of your mysql server and have to replicate the data on multiple servers. MYSQL provide 2 ways to replicate data, master – master and master – slave.

Continue reading “Mysql replication setup in linux”

Nmap Basics for system Administrator

The Nmap aka Network Mapper is an open source and a very versatile tool for Linux system/network administrators. Nmap is used for exploring networksperform security scansnetwork audit and finding open ports on remote machine. It scans for Live hosts, Operating systems, packet filters and open ports running on remote hosts.

Understanding Open, Closed and Filtered

Nmap has a variety of scan types, understanding how the default and most common SYN scan works is a good place to start to examine how the scan works and interpreting the results.

The 3 way TCP handshake

First a bit of background, during communication with a TCP service, a single connection is established with the TCP 3 way handshake. This involves a SYN sent to an TCP open port that has a service bound to it, typical examples are HTTP (port 80), SMTP (port 25), POP3 (port 110) or SSH (port 22).

Continue reading “Nmap Basics for system Administrator”

Process Management in Linux | System Administrator

Process management is an integral part of any modern-day operating system (OS). The OS must allocate resources to processes, enable processes to share and exchange information, protect the resources of each process from other processes and enable synchronization among processes. To meet these requirements, the OS must maintain a data structure for each process, which describes the state and resource ownership of that process, and which enables the OS to exert control over each process.

Continue reading “Process Management in Linux | System Administrator”

Linux | Introduction To Memory Management.

Memory Hierarchy:

Memory Hierarchy gives the relationship between the speed, size and cost with respect to the distance from the Processor.

cpu111.png

In the diagram above the peak of the pyramid represents the processor. The Register lies with in the processor itself hence are the closest to the processor and work the fastest. But the number of registers that can be included in a processor is limited, as it would lead to increase in processor size, increase in manufacturing cost etc. Thus the register memory is restricted to minimal.

A level below the register is the L1 cache or the first level cache. In the processors of today, the L1 cache also lies on the processor chip itself, though it might lie outside too.
The cache memory works at a very fast speed but is also extremely expensive as compared to the other memories available. This high cost is one of the major restriction why we can not use lots of cache in a computer even though it is faster.
The general thumb rule is, higher the cache memory faster would be the working of the processor.

Continue reading “Linux | Introduction To Memory Management.”