Quick Ping Test Script

This is not my finest work but I needed to put a ping test script together in a pinch that would log the result and run until I stopped it.

Here’s what I came up with:

# Very Basic Ping Script
# Enter the domain to be monitored here
while :
# Line Separation
echo "###############################">>ping.log;
# Date Stamp Log
echo `date` >>ping.log
# ping starget host for 5 ping intervals
ping -c5 $domain | grep loss | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10}' >>ping.log
# optional (enable verbose ouput to console)
# cat ping.log
        sleep 1

The ping.log it generates looks like this:

$ cat ping.log 
Tue Nov 10 05:05:44 CST 2015
5 packets transmitted, 5 packets received, 0.0% packet loss 
Tue Nov 10 05:05:49 CST 2015
5 packets transmitted, 5 packets received, 0.0% packet loss 
Tue Nov 10 05:05:54 CST 2015
5 packets transmitted, 5 packets received, 0.0% packet loss 
Tue Nov 10 05:05:59 CST 2015
5 packets transmitted, 5 packets received, 0.0% packet loss 

Not fancy but it works…

Toshiba Satellite C55D-B510 Hard Drive Upgrade


The Toshiba Satellite C55D-B510 is a low price system that runs great as an entry level laptop. A friend of mine recently purchased one for school and asked me to take a look at why it was performing super slow.

After investigating further aside from the bloatware issues, the laptop had a 5400 RPM Toshiba drive in it. I was unpleasantly surprised to find that this speed of SATA drive was still on the market! Luckily I just happened to have a 7200 RPM drive laying around that was brand new as I recently replaced my own laptop hard drive with a SSD. I figured since I had to pop the hood on this machine that I might as well take pictures and document it. Below are the steps to pull the drive and replace it!

Step 1. Remove the bottom cover – This process was fairly easy. Just simply remove the two screws that hold in the battery, pull the battery away from the laptop, and then remove the rest of the screws ( they are a small phillips head type screw). Start at the bottom right corner with the laptop upside down and the the battery bay facing away from you and gently pry the corners away from the chassis. Beware, if you feel to much resistance STOP and look for a screw you may have missed (it’s easy to do!).



Step2. Locate the Hard Drive – The Hard Drive is located on the bottom left and is in a blue soft plastic enclosure. It’s held in my two tabs at the front that are sticking into two slots while the drive itself is held in by the sata power and sata connector ports.



Step 3. Removing the Hard Drive – Simply pull the tabs up gently and release them from the slots. Then slightly pull up on the front of the drive and gently pull it away from the sata power and connector ports.



Step 5. Remove the blue harness  – Take off the harness from the drive by simply slipping it off. The place it on the new drive and follow these steps in reverse!




Step 6. Completion – Once everything is reassembled you have been upgraded!

It’s a pretty simple procedure and as you can see from the shot of the motherboard on step 2 you can also easily upgrade the memory on this system. By default it comes with 4GB of RAM in a single DIMM so you can easily add another. If you plan on going through this trouble I would definitely recommend a SSD if it is in the budget as an SSD will have a great impact on performance. Hope this helps someone out there!



Macrium Reflect – A Great Tool For Managing Disks and Backups


I have recently needed to perform a few disk migrations via clones and I always need a solid backup solution for my Windows desktop machines. Macrium reflect always gets the job done!

The free version located here is a very feature rich offering and I could easily see myself paying for the full product license.

A few successful projects I have completed with this software are:

  • Creation of backup images.
  • Disk to Disk clones
  • Backups sent to network devices.

This review is short and sweet but it does not give this product the justice it deserves. If you are looking to clone a disk or backup your systems definitely take the time to check this software out!

– Dustin


Enabling Promiscuous Mode For A Vswitch On Vsphere 6


I run a VMWare based infrastructure for my personal hosting projects and love it because of the Vswitch capabilities.

Since I am a firm believer in following security best practices on these type of deployment I have a NIDS service in path that is collecting information about threats that are being leveraged against my public facing services. To facilitate the monitoring of the traffic with my NIDS platform I have to be able to collect traffic data from the Vswitch and the simplest way to facilitate this is enabling promiscuous mode on the private Vswitch.

Here’s a quick walkthrough on how to complete this:

Step 1. Log into Vsphere and click on the host –> configuration –> and the corresponding Vswitch properties ( I.e. the screenshots below are for Vswitch 3)

Screen Shot 2015-07-18 at 6.26.26 AM


Step 2. On the next screen highlight the Vswitch and click –> Edit

Screen Shot 2015-07-18 at 6.26.48 AM


Step 3. From the Edit screen click –> Security

Screen Shot 2015-07-18 at 6.27.12 AM


Step 4. Check the Promiscuous Mode box and select “Accept” from the dropdown menu. Click –> OK

Screen Shot 2015-07-18 at 6.27.26 AM

You now have Promiscuous mode enabled on the Vswitch and can configure an NIDS system to monitor the ingress and egress traffic on the Vswitch.

If you have any comments or questions feel free to leave feedback below!

– Dustin

Quick and dirty nginx installation on CentOS 7


CentOS 7 is a great Linux distribution but one thing it does lack is an official Nginx package in the default distribution mirrors. There are a few methods of working around this including the use of EPEL but for this tutorial I will use Nginx’s official repository for the installation.

Let’s get started!

Step 1.
Establishing a connection to the repository via yum is simple. simply create and edit a new repository file as shown below:

vi /etc/yum.repos.d/nginx.repo

add the following:

name=nginx repo

Step 2.
Next we will install the nginx server by running the following yum installation command:

yum install nginx

You will have to acknowledge the install but you can make this silent by adding a -y to the installation command if you wish.

Step 3.
One the installation is completed you can start the nginx server by running the following command:

service nginx start

Step 4.
You will probably want nginx to auto start at boot time. In CentOS 7 you will use the following systemd command to do this:

systemctl enable nginx

Step 5.
You can verify it is properly enabled by running the following command in systemd:

systemctl is-enabled nginx

If the output says “enabled” then nginx is properly set to start on boot.

Here’s a few examples of useful commands to help you in the event you are having issues with your nginx server.

Check the sanity of a config file:

[example@proxy ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Check the status of the nginx server:

[example@proxy ~]# service nginx status
Redirecting to /bin/systemctl status nginx.service
nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: active (running) since Sun 2015-02-15 11:15:22 CST; 25min ago
Docs: http://nginx.org/en/docs/
Main PID: 28703 (nginx)
CGroup: /system.slice/nginx.service
├─28703 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
└─28704 nginx: worker process

Feb 15 11:15:22 proxy.01.example.com nginx[28699]: nginx: the configuration...
Feb 15 11:15:22 proxy.01.example.com nginx[28699]: nginx: configuration fil...
Feb 15 11:15:22 proxy.01.example.com systemd[1]: Started nginx - high perfo...
Hint: Some lines were ellipsized, use -l to show in full.

In the event these two check out and it’s still not working you probably have a connectivity issue. The default policies on CentOS 7 have http blocked so that would be a great place to start assuming connectivity has been verified.

On a parting note one last step I would recommend when tidying up the install would be to disable the version header. You can edit the nginx.conf and add the following directive to do this:

server_tokens off;

This guide was meant to be very basic and I plan on doing a deeper dive into virtual hosts, proxies, and addition configurations in a future post.

Hope you enjoy!
– Dustin

A little script I wrote in PHP for GeoIP lookups

Being fully transparent I am a system admin by trade so my code is not the greatest. That being said, I figured I would release a little bit of PHP code I wrote for a tool I have created as it is useful for pulling GeoIP data and displaying it in HTML.  It uses PHP Curl, gethostbyname, JSON decode, and the Telize.com JSON GeoIP webservice.


 // PHP GeoIP Lookup Script - 11/15/2014 by Dustin Larmeir ([email protected])
// Form Input

// Grabs the domain name via the input form and converts it to a IP address
$hostname = $_POST['INPUT'];
$ipaddress = gethostbyname($hostname);

// Grabs IP address from form (basic method)
$url = "http://www.telize.com/geoip/".$ipaddress;
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
// Closing

// get the results and json_decode the answer
$geoip_data = (json_decode($geoip_json, true));

// Echo output from JSON decoding and PHP arrays
echo "IP Address: "; echo($geoip_data["ip"]);
echo "Organization: "; echo($geoip_data["isp"]);
echo "City: "; echo($geoip_data[city]);
echo "State: "; echo($geoip_data[region]);
echo "Country: "; echo($geoip_data[country]);
echo "Time Zone: "; echo($geoip_data[timezone]);
echo "";