Setting Up a Custom DNS for Testing Purposes

These are the files I used to configure a test DNS to reply to all DNS requests for ANY .com to my test server.

Once this is up and running just configure each server’s /etc/resolv.conf file to point to this server.

[root@ats-check ~]# cat /etc/named.conf
options {
# listen-on port 53 { 127.0.0.1; };
# listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
# memstatistics-file "/var/named/data/named_mem_stats.txt";
# allow-query { any; };
# allow-transfer { localhost; 2.2.2.2; };
recursion no;

dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;

/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";

managed-keys-directory "/var/named/dynamic";
};

zone "com" IN {
type master;
file "all.com.zone";
allow-update { none; };
};

zone "test000000.com" IN {
type master;
file "test000000.com.zone";
allow-update { none; };
};

# 10.22.190.90
zone "190.22.10.in-addr.arpa" IN {
type master;
file "/var/named/190.22.10.rev";
allow-update { none; };
};

logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};

zone "." IN {
type hint;
file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

include "/etc/rndc.key";

[root@ats-check ~]# cat /var/named/all.com.zone
$TTL 816400
@ IN SOA com. root.test000001.com. (
100 ; serial
1H ; refresh
1M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS ns1.test000001.com.
@ IN A 172.19.107.164
ns1 IN A 172.19.107.164
@ IN MX 10 mail.test000001.com.
mail IN A 172.19.107.164
WWW IN A 172.19.107.164
* IN A 172.19.107.164

[root@ats-check ~]# cat /var/named/190.22.10.rev
$TTL 86400
@ IN SOA test000000.com. root.test000000.com. (
100 ; serial
1H ; refresh
1M ; retry
1W ; expiry
1D) ; minimum
@ IN NS ns1.test000000.com.
1 IN PTR binggo.test000000.com.

[root@ats-check ~]# cat /etc/resolv.conf

#nameserver 10.255.250.11
#nameserver 10.255.251.11
#search dc1.corp.gd jomax.paholdings.com hosting.corp.gd gdhosting.gdg int.godaddy.com
nameserver 127.0.0.1

[root@ats-check ~]# cat /var/named/test000000.com.zone
$TTL 86400
@ IN SOA test000000.com. root.test000000.com. (
100 ; serial
1H ; refresh
1M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS ns1.test000000.com.
@ IN A 10.22.190.90
ns1 IN A 10.22.190.90
@ IN MX 10 mail.test000000.com.
mail IN A 10.22.190.90
WWW IN A 10.22.190.90

vimdiff – updated diff view after changes

After invoking a vimdiff of two files, I will often sync changes from one file into the other. (I, personally, like using ‘dp’ to ‘diff push’ a change from one window into the other. After making changes, it is sometimes necessary to update the view of the diff in the two files. You can either exit and return (inefficient and slow), or simply ‘:diffupdate’.

Linux history without line numbers

I use my history to track what commands I have executed for a given project.  As often as I try to keep my project notes up to date, I often fall behind in the heat of the moment.  I will often refer back to my history to remind me what commands, and in what order I ran them.  Using this command, I can dump my history without line numbers so I can copy/paste into my notes:

history | cut -c 8-

Linux – Bash – Perl – Colorize tail -f output

I tail out a lot of Linux log files, and sometimes I want to highlight when certain messages scroll on the screen. This one-liner will tail a log file and highlight the entire line when certain keywords or phrases (based on the regex).

tail -f | perl -pe 's/.*example1.*/\e[31m$&\e[0m/g; s/.*example2.*/\e[32m$&\e[0m/g'

Essentially, this uses Perl’s substitute to replace the line which matches the regex with an Escape sequence to colorize the output \e[31m$ then the line itself followed by an Escape sequence to turn off all text attributes \e[0m.

In the example above, ‘example1’ will be output with the text attribute of 31 which sets the foreground (text color) of red. Whereas ‘example2’ will be output with the text attribute of 32 which will set the text color to green. To see a table of color codes and other ANSI text attributes (like bold, background color, blink, etc) see  ANSI escape code on Wikipedia.

Hello world!

Every programmer, software developer, engineer, or whatever you choose to call yourself, knows that, in any new language, it is tradition to write your first program as a “Hello, World” program.

This is my first official WordPress post, and it is only fitting that is a “Hello, World”.