How to install the nslookup, host OR dig commands in Linux?

Sometimes you are unable to use the nslookup, host OR dig command on your Linux server and receives the following message

-bash: nslookup: command not found -bash: host: command not found -bash: dig: command not found

The reason is the package required for the commands to work isn’t installed during the OS installation.

These are all DNS related commands useful to check the DNS report of a domain/IP.

You need to install the package bind-utils which offer the commands like nslookup, host, dig and others.

SSH to your server as root and execute

 yum install bind-utils


[Snippet] Debugging Smarty on a live site

Development server? Staging server? What are they? Sometimes we have to debug code on a live server. You know it.

Adding the following code to your Smarty template will enabled the Smarty Debug Console for your eyes only.

{if $smarty.server.REMOTE_ADDR == 'YOUR.IP.ADDRESS'}



STUN Session Traversal Utilities for NAT

STUN might well save your VoIP ass. We’ve been experiencing more and more issues with our VoIP solution with regards to one-way audio. We were convinced it was  NAT issue, in that cheap, crappy twenty pound routers couldn’t do NAT traversal correctly. Installing an over-powered pfSense box didn’t solve the problem. Continue reading “STUN Session Traversal Utilities for NAT”

Apache redirects based on IP Address/Subnet

Ever needed to redirect a source IP address or source subnet in apache?

Why? Redirect annoying spam bots, users or other individuals away from your blog for example.

Slam the following code into your .htaccess file or VirtualHost Directive. Continue reading “Apache redirects based on IP Address/Subnet”

MySQL: Can’t get hostname for your address

Can”t remotely login to your shiney, new MySQL server due “Can’t get hostname for your address” or “Can’t get hostname for your address”. Another random MySQL error message.

Simply put, if you look in the logs, MySQL cannot lookup your IP/hostname. Its that simple.

Is your DNS broke? Or just on a Local Area Network with no DNS anyway?
Just add skip-name-resolve option to the [mysqld] section of your my.cnf/my.ini

Convert phpBB IP Addresses

phpBB stores its IP addresses in a funky format. They’re useless to the human eye!

Convert them to normal IPs with the following code

SELECT CONCAT( CONV( substring( poster_ip, 1, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 3, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 5, 2 ) , 16, 10 ) , '.', CONV( substring( poster_ip, 7, 2 ) , 16, 10 ) ) AS IP
FROM phpbb_posts
WHERE `poster_id` = USERID
LIMIT 0 , 30
This code will convert all know IPs from a selected user (In my case 51).

Setting up and using NFS on Ubuntu

Network File System, NFS, has been around since Noah first networked his ark.

Setting up and using NFS on Ubuntu is surprisingly easy. i9000 Networks needed a slightly revised backup solution in one of it’s sites.

Obviously you’ll need two or more servers. One I’ll refer to as the server which will host the backups and the second/subsequent servers, which are the clients, ie. the live servers that need backing up.

Here’s how I did it.

Continue reading “Setting up and using NFS on Ubuntu”