How to Install and Configure dnsmasq in Linux

Introduction

Dnsmasq is a lightweight DNS forwarder and resource constrained routers and firewalls. It is widely used for tethering on smartphones and portable hotspots, and to support virtual networking in virtualisation frameworks. Dnsmasq is included in most Linux distributions like FreeBSD, OpenBSD and NetBSD.

Step 1: Install dnsmasq

First install dnsmasq package using yum command.

# yum -y install dnsmasq

Step 2: Configuration

Configure dnsmasq service as per following settings.

# vi /etc/dnsmasq.conf
# line 19: uncomment (never forward plain names)
domain-needed
# line 21: uncomment (never forward addresses in the non-routed address spaces)
bogus-priv
# line 41: uncomment (query with each server strictly in the order in resolv.conf)
strict-order
# line 55: add if you need
# query the specific domain name to the specific DNS server
# the example follows means query [server.education] domain to the [10.0.0.10] server
server=/server.education/10.0.0.10
# line 123: uncomment (add domain name automatically)
expand-hosts
# line 133: add (define domain name)
domain=tecdistro

Step 3: Start Service

Run the DHCP service by using below command and start service.

# systemctl start dnsmasq
# systemctl enable dnsmasq

Step 4: Entry in hosts file

# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# add records
10.0.0.30   dlp.tecdistro dlp 

Restart the dnsmasq service.

# systemctl restart dnsmasq

Step 5: Add service in firewall

# firewall-cmd --add-service=dns --permanent 
success
# firewall-cmd --reload 
success

How to create FTP user and assign quota in Solaris

Introduction

File Transfer Protocol(FTP) is a network protocol used for the transfer of files between a client and server on network.

Step 1: Create User

First create FTP user by using following method.

# useradd test
# passwd test

Step 2: Create FTP user Directory

Make a directory in ftpdata folder

# cd /ftpdata/
# ls -l
# mkdir test
# chown test:staff test

Step 3: How to assign quota for FTP User in Solaris

In order to assign quota to FTP user below is the method.

# zfs create ftpdata/test
# zfs set quota=50M ftpdata/test

Thanks, all done 🙂

How to install snmp in Redhat 7/CentOS 7

Introduction

SNMP stands for Simple Network Management Protocol. It is a protocol used to monitor servers. It is used for collecting information from, and configuring, network devices, such as servers, printers, hubs, switches, and routers on an Internet Protocol (IP) network.\

Step 1: Install SNMP

# yum install -y net-snmp net-snmp-utils
# cd /etc/snmp
# cp -p snmpd.conf snmpd.conf.dist
# echo "rocommunity public">snmpd.conf
# echo "syslocation here" >>snmpd.conf
# echo "syscontact root@localhost" >>snmpd.conf
# systemctl enable snmpd && systemctl start snmpd
# snmpwalk -v 1 -c public -O e 127.0.0.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux rhel7.example.com 3.10.0-54.0.1.el7.x86_64 #1 SMP Tue Nov 26 16:51:22 EST 2013 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
...

How to set session timeout

Step 1: Introduction

The utmpx and wtmpx files are extended database files that have superseded the obsolete utmp and wtmp database files.
The utmpx database contains user access and accounting information for commands such as who(1), write(1), and login(1). The wtmpx database contains the history of user access and accounting information for the utmpx database.

Step 2: Create Backup of wtmpx

In order to create a backup of wtmpx first check the disk space in /tmp and then copy the file in /tmp directory

# /usr/lib/acct/fwtmp < /var/adm/wtmpx > /tmp/wtmpx.orig

Step 3: Empty wtmpx file

To empty wtmpx file us the following command

# cat /dev/null > /var/adm/wtmpx

Step 4: Zip original wtmpx file

Create a zip of original wtmpx file using gzip command

# gzip /tmp/wtmpx.orig

Step 5: Copy original wtmpx

Copy original wtmpx file in /var/adm/ for audit purpose

# cp /tmp/wtmpx.orig.gz /var/adm/

How to Install TOP package in Solaris 10

Step-1: PreRequisites

For installation of top, download the following package.

# wget http://www.sunfreeware.com/sparc/10/top-3.6.1-sol10-sparc-local.gz

Step-2: Extract Zip File

Extract top package using below command.

# gunzip top-3.6.1-sol10-sparc-local.gz

Step-3: Installation

Install and configure top package as given below:

# pkgadd -d top-3.6.1-sol10-sparc-local

The following packages are available:
  1  SMCtop     top
                (sparc) 3.6.1

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 

Processing package instance  from 

top(sparc) 3.6.1
LeFebvre et al

The selected base directory  must exist before
installation is attempted.

Do you want this directory created now [y,n,?,q] y
Using  as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing top as 

## Installing part 1 of 1.
/usr/local/bin/sparcv7/top
/usr/local/bin/sparcv9/top
/usr/local/bin/top
/usr/local/doc/top/Changes
/usr/local/doc/top/FAQ
/usr/local/doc/top/INSTALL
/usr/local/doc/top/LICENSE
/usr/local/doc/top/README
/usr/local/doc/top/Y2K
/usr/local/man/man1/top.1
[ verifying class  ]

Installation of  was successful.

Set Default Path

Set the default path of top command in user’s profile.

#echo $PATH
/usr/sbin:/usr/bin 
#vi ~.profile
PATH=/usr/sbin:/usr/bin:/usr/local/bin

How to Install Raid 1 in Solaris 10

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 
          /pci@1f,0/pci@1/scsi@8/sd@0,0
       1. c1t1d0 
          /pci@1f,0/pci@1/scsi@8/sd@1,0
Specify disk (enter its number): ^Z

# prtvtoc /dev/dsk/c1t0d0s2 > c1t0d0s2.vtoc
# fmthard -s c1t0d0s2.vtoc /dev/rdsk/c1t1d0s2
# df -kh
# metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# umount /export/home
# metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# umount /export/home0
# metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# metainit -f d11 1 1 c1t0d0s0
# metainit -f d12 1 1 c1t1d0s0
# metainit d10 -m d11
# metaroot d10
# metainit -f  d21 1 1 c1t0d0s1
# metainit -f  d22 1 1 c1t1d0s1
# metainit d20 -m d21
# metastat | grep %
# vi /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/md/dsk/d10 /dev/md/rdsk/d10        /       ufs     1       no      -
#/dev/dsk/c1t0d0s7      /dev/rdsk/c1t0d0s7      /export/home    ufs     2       yes     -
#/dev/dsk/c1t1d0s7      /dev/rdsk/c1t1d0s7      /export/home0   ufs     2       yes     -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -

How to Install TightVNC viewer in Linux

Introduction

TightVNC is a cross-platform free and open-source remote desktop software application.

Step 1: xStartup Installation

In order to install TightVNC, first install “X Window System” as prerequisites.

# yum groupinstall "X Window System" "Desktop"
# yum -y install tigervnc-server xorg-x11-fonts-Type1

Step 2: Configuration

Edit the TightVNC configuration file and set the geometry according to your monitor screen.

# vi /etc/sysconfig/vncservers
VNCSERVERS="1:test"
VNCSERVERARGS[1]="-geometry 1280x1024"

Step 3: Create User

Create test user so that user is able to view the GUI accordingly.

# useradd test
# passwd test
# su - test
# vncpasswd

Step 4: Start VNC Server

Start VNC Server, it will open the session against the users so that users are able to view the Graphical User Interface and enjoy.

# /etc/init.d/vncserver start
Shutting down VNC server: [  OK  ]
Starting VNC server: 1:test 
New 'test:1 (test)' desktop is test:1

Starting applications specified in /home/test/.vnc/xstartup
Log file is /home/test/.vnc/test:1.log

[  OK  ]
# chkconfig vncserver on

Prometheus: Solve montoring in the cloud

Hundreds of companies are now using the open-source Prometheus monitoring solution in production, across telecommunications and cloud providers across video streaming and databases.

In the run-up to CloudNativeCon + KubeCon Europe 2017, which takes place in Berlin from March 29 to 30, we spoke with Brian Brazil, the founder of Robust Perception, and one of the core developers of the Prometheus project, who at CloudNativeCon a keynote on Prometheus Will give. Be sure to catch the full Prometheus track at the conference.

With a traditional setup, there was a relatively small number of services, each with their own machine. Monitoring was based on machine metrics like CPU usage and free memory, which are the best way to alert to user problems. In a cloud Native world, where many different services not only divide machines, but the way in which they share them is in constant flux, such an approach is not scalable.

In the same way that the move has been made from the manual management of machines and services to tools such as Chef and now Kubernetes, we must make a similar transition in the surveillance area.

Prometheus client libraries allow you to orchestrate your applications for the metrics and KPIs that are important in your system. For third-party applications like Cassandra, HAProxy, or MySQL, there are a variety of exporters to reveal their useful metrics.

The data collected by Prometheus are enriched by labels. Labels are arbitrary key-value pairs that can be used to distinguish the development cluster from the production environment, or which HTTP endpoints the metric is broken.

The PromQL query language allows for aggregation based on these labels, the calculation of 95th percentile latencies per container, service or data center, prognosis, and any other mathematics that you want to do. What is more: If you are doing it graphically, you can point it out. This gives you the power to have warnings about what is really important to you and your users, and helps eliminate these late night alerts for non-problems.