iptraf boxes do not show up well

On one of my servers running CentOS 6 I had iptraf not displaying the boxes in dialogues correctly.  It’s usually fixed by updating the session configuration on putty to translate to utf-8 but in this case that did not work.

While the system is a clone from another machine where it works well (puppet confirms) all I had to do is create an alias in my ./bashrc for iptraf to NCURSES_NO_UTF8_ACS=1  iptraf as such :

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

alias iftop='NCURSES_NO_UTF8_ACS=1 iftop'
alias iptraf='NCURSES_NO_UTF8_ACS=1  iptraf'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

As you can deduce the same issue and solution happened with iftop. 🙂

Oh the result :

Ejnoy 🙂

Quick script to get path to latest nagios version

If you need to automate the retrieval of the latest Nagios version path to download this is how I do it.

Nothing fancy and it breaks if they change the sourceforge site but we can fix when that happens 🙂

 

curl -v http://www.nagios.org/download/core/thanks/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1

Result:

http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz

Of course this comes in handy when pulling for the clients being monitored so by extension:

 curl -v http://www.nagios.org/download/plugins/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1

Result:

http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz

Getting the files in a script is as easy as :

curl -v http://www.nagios.org/download/plugins/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1 | xargs wget

Ping me if this stops working for you.

Enjoy.

Wireshark: cutting the crap

DisplayFilters

Wireshark uses display filters for general packet filtering while viewing and for its ColoringRules.

The basics and the syntax of the display filters are described in the User’s Guide.

The master list of display filter protocol fields can be found in the display filter reference.

If you need a display filter for a specific protocol, have a look for it at the ProtocolReference.

 

Examples

Show only SMTP (port 25) and ICMP traffic:

  •  tcp.port eq 25 or icmp

Show only traffic in the LAN (192.168.x.x), between workstations and servers — no Internet:

  • ip.src==192.168.0.0/16 and ip.dst==192.168.0.0/16

(more…)

Quick How to install tomcat

# yum install yum-priorities

# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install the JPackage Project repository.

(more…)

Create a raw disk redirection vmdk in Virtualbox

Original Post here.

VBoxManage internalcommands createrawvmdk -filename d:\VMs\gCFRAW.vmdk -rawdisk \\.\PhysicalDrive4

C:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands createrawvmdk -filename d:\VMs\gCFRAW.vmdk -rawdisk \\.\PhysicalDrive4

Oracle VM VirtualBox Command Line Management Interface Version 3.2.8
(C) 2005-2010 Oracle Corporation
All rights reserved.

RAW host disk access VMDK file d:\VMs\gCFRAW.vmdk created successfully.

You can also access specific partitions of host physical disk from VirtualBox, run the same command with additional switches,

VBoxManage internalcommands createrawvmdk -filename c: \Users \sunuser \.Virtualbox \VDI \ mydrive.vmdk -rawdisk \ \. \ PhysicalDrive4 -partitions 1,4

1,4 : are the partitions numbers of PhysicalDrive 0. It will allow you to access the first and fourth partitions of the physical drive.

This command also will create a VMDK file and you can access the drives as explained in first method.

 

mkpasswd on Centos 6.x

I happened to need mkpasswd command in CentOS 6.3 minimal:

While there is no package for the tool it can be found in expect command. So run as shown :

yum install expect

(more…)

Install Exim on centOS

Exim is no longer available as a standard package, but as with most pieces of Linux software, it’s still only a few commands away. If you want to install Exim to use, or just to try, all you need do is:

Install the EPEL (Extra Packages for Enterprise Linux) repository:

wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -i epel-release-6-5.noarch.rpm

Install the Exim package

yum install -y exim-mysql

Disable Postfix (the default MTA)

service postfix stop
chkconfig postfix off

Set Exim as the default MTA

alternatives --config mta

And finally start Exim

chkconfig exim on
service exim start

You should now be running Exim, and probably want to visit the official documentation site.

Disable IPv6 in centOS

  • Edit /etc/sysconfig/network and set “NETWORKING_IPV6” to “no”
  • For 5.4 and later, replace in /etc/modprobe.conf

 

alias ipv6 off

by

options ipv6 disable=1

Alternative (which might be easier and works on any release with /etc/modprobe.d):

# touch /etc/modprobe.d/disable-ipv6.conf
# echo "install ipv6 /bin/true" >> /etc/modprobe.d/disable-ipv6.conf
  • For CentOS 5.3 or older, add the following to /etc/modprobe.conf :

 

alias ipv6 off
alias net-pf-10 off
  • Run /sbin/chkconfig ip6tables off to disable the IPv6 firewall
  • Reboot the system

<!> With the 5.4 update symbol/ipv6 module dependency capabilities have been introduced; therefore, if IPv6 has been previously disabled as above an upgrade to the bonding driver in 5.4 will result in the bonding kernel module failing to load. For the module to load properly use instead:

# touch /etc/modprobe.d/disable-ipv6.conf
# echo "options ipv6 disable=1" >> /etc/modprobe.d/disable-ipv6.conf

<!> <!> Upstream employee Daniel Walsh recommends not disabling the ipv6 module but adding the following to /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1

In a short way this is what I do:

[root@toro.maranello.local ~]#echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf

While there I would turn off the IPV6Tables service as well

[root@toro.maranello.local ~]# service ip6tables save
[root@toro.maranello.local ~]# service ip6tables stop
[root@toro.maranello.local ~]# chkconfig ip6tables off

NOTE: SSH x11 forwarding may (and probably will) stop working if you disable the IPv6 …just a heads up :)…

nJoy 😉

Linux prompt tweak ..

Just a note for my favorite :

add to the  ~/.bash_profile

PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "

result :

Prompt reloaded
My favorite Linux prompt.

 

Troubleshooting network connection failures VMWare Workstation

Symptoms

You are experiencing these issues:

  • No network connectivity for a virtual machine
  • Cannot connect to the Internet from the guest operating system
  • Bridged, Host-only or Network Address Translation (NAT) networking fails

Purpose

This article helps you to determine the cause of networking problems affecting one or more virtual machines. The steps in this article address whether the networking has been misconfigured on the host operating system, guest operating system or virtual machine.

Resolution

(more…)