DIG on CentOS 7 (in addition to the nslookup). [TESTED]

Installation process

• To find a package name that provides dig utility:

yum whatprovides *bin/dig*

• To install the package:

yum -y install bind-utils


• To show A entries, the same as “nslookup cisco.com” or “nslookup -type=a cisco.com”

dig @ +noall +answer cisco.com
cisco.com.              4563    IN      A

• To show NS entries, the same as “nslookup -type=ns cisco.com”:

dig @ ns +noall +answer cisco.com
cisco.com.              1068    IN      NS      ns2.cisco.com.
cisco.com.              1068    IN      NS      ns1.cisco.com.
cisco.com.              1068    IN      NS      ns3.cisco.com.

• To show PTR records (+noall +answer are not applicable), the same as “nslookup -type=ptr”:

dig @ -x

Whois on CentOS 7. [TESTED]


[root@hostname ~]# whois
-bash: whois: command not found
[root@hostname ~]#

How to find package name whois/jwhois/whatever:

[root@hostname ~]# yum whatprovides *bin/whois*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.osuosl.org
 * extras: mirrors.usc.edu
 * updates: centos.mirror.lstn.net
base/7/x86_64/filelists_db                               | 5.8 MB     00:01
whois-5.1.1-2.el7.x86_64 : Improved WHOIS client
Repo        : base
Matched from:
Filename    : /usr/bin/whois.md
Filename    : /usr/bin/whois

[root@hostname ~]#

Install it:

yum -y install whois

Cacti 0.8.8c - Initial installation on Linux CentOS 7. [TESTED]

I was needed to setup Cacti system to collect Cisco IP SLA statistics. Here is a little note for myself.

Basic CentOs 7 installation

• Download CentOS-7.0-1406-x86_64-Minimal.iso from http://isoredirect.centos.org/centos/7/isos/x86_64/.
• Upload ISO to ESXi Datastorage
• Create VM, mount ISO then power on VM.
• While CentOS 7 menu is visible press TAB, then add vga=791 at the end of the string to get more higher screen resolution (1024×768):

> vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOSx207x20x86_64 quiet vga=791

• Setup some basic parameters, not that you have to create regular (NOT LVM) /boot partition (/boot filesystem cannot be of type lvmlv).
• Then I’ve found some little problems. Network interface hasn’t been enabled even after network restart. Probably, I didn’t notice a checkbox during the installation. To solve it:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

/etc/init.d/network restart

• To setup hostname.

vi /etc/hostname


• The most useful command for me ifconfig has not been installed.

yum -y install net-tools

• According to the new network interfaces naming scheme, network interface has name ens160 instead of eth0. I decided to rename it w/o disabling new scheme. To do it, I was needed to create a new file for rules. Reboot is required.

vi /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:32:00:01", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


• I got kernel messages like “localhost kernel: dm-1: WRITE SAME failed. Manually zeroing.”. I applied workaround mentioned here and here, but none of these solved the solution. Just let it go for a while.

• Setting up NTP to keep local time quite precise:

yum -y install ntp

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/PST8PDT /etc/localtime

vi /etc/ntp.conf
server pool.ntp.org iburst prefer

systemctl enable ntpd
systemctl start ntpd
ntpq -p

• Disable SELinux:

vi /etc/selinux/config

You can disable it manually to avoid from reboot:

setenforce 0

sestatus | grep -i mode
Current mode:                   permissive
Mode from config file:          permissive

• To get root’s emails:

vi /etc/aliases
# Person who should get root's mail
root:           alexey@gmail.com


Cacti installation

• Install necessary packages.

yum -y install httpd php php-mysql php-snmp mariadb-server net-snmp net-snmp-utils rrdtool-devel

• Configure TZ for PHP:

vi /etc/php.ini
date.timezone = PST8PDT

• Enable MySQL:

systemctl status mariadb
systemctl enable mariadb
systemctl start mariadb

• Setup mysql root password:

mysqladmin -u root -h password your_root_password

• Create DB for cacti:

mysql -h -u root -p -e 'CREATE DATABASE cacti'

• Grand privileges for cactiuser:

mysql -h -u root -p

mysql> grant all on cacti.* to cactiuser@localhost identified by 'cacti_password';
mysql> flush privileges;

• Select the latest Cacti version from http://www.cacti.net/downloads/ and install it:

cd /var/www/html/
mkdir cacti
cd cacti

yum -y install wget
wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz
tar zxvf cacti*
cp -R cacti*/* .

# Cleaning:
rm -rf *.tar.gz cacti-*

• Import DB then check the result:

mysql -u cactiuser --password='cacti_password' cacti < cacti.sql

mysql -u cactiuser --password='cacti_password' -e 'show tables from cacti'

# Cleaning:
rm -f cacti.sql

• Configure DB access parameters:

vi include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti_password";
$database_port = "3306";

$url_path = "/";

• Configure Apache:

vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/cacti"

systemctl start httpd
systemctl enable httpd
systemctl status httpd

• Disable iptables/firewall:

systemctl stop firewalld
systemctl disable firewalld

• Go to http://server_ip/, use default login/password admin/admin and perform initial installation.
• Create special user for poller and provide privileges for important folders:

useradd cactiuser
chown -R cactiuser /var/www/html/cacti/rra/ /var/www/html/cacti/log/

• Enable poller:

vi /etc/crontab
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

• Check log file:

tail -f /var/www/html/cacti/log/cacti.log

Admin area