Obtain TCP Network netstat output without netstat

There are times you may be on a system and for whatever insane reason, netstat is not installed.

Here is how you can obtain interface information without netstat

# awk '(f==0) { i=1; while ( i<=NF) {n[i] = $i; i++ }; f=1; next} (f==1){ i=2; while ( i<=NF){ printf "%s = %d\n", n[i], $i; i++}; f=0}'  /proc/net/netstat |column -t

Example results

# awk '(f==0) { i=1; while ( i<=NF) {n[i] = $i; i++ }; f=1; next} (f==1){ i=2; while ( i<=NF){ printf "%s = %d\n", n[i], $i; i++}; f=0}'  /proc/net/netstat |column -t
SyncookiesSent             =  0
SyncookiesRecv             =  0
SyncookiesFailed           =  5
EmbryonicRsts              =  0
PruneCalled                =  0
RcvPruned                  =  0
OfoPruned                  =  0
OutOfWindowIcmps           =  0
LockDroppedIcmps           =  0
ArpFilter                  =  0
TW                         =  1160
TWRecycled                 =  0
TWKilled                   =  0
PAWSPassive                =  0
PAWSActive                 =  0
PAWSEstab                  =  5
DelayedACKs                =  25254
DelayedACKLocked           =  21
DelayedACKLost             =  4129
ListenOverflows            =  0
ListenDrops                =  0
TCPPrequeued               =  419476
TCPDirectCopyFromBacklog   =  7131447
TCPDirectCopyFromPrequeue  =  70660208
TCPPrequeueDropped         =  0
TCPHPHits                  =  650154
TCPHPHitsToUser            =  35433
TCPPureAcks                =  241811
TCPHPAcks                  =  29236
TCPRenoRecovery            =  0
TCPSackRecovery            =  21
TCPSACKReneging            =  0
TCPFACKReorder             =  0
Posted in Linux, Networking | Tagged , | Leave a comment

Using Windows version of IPMITool called (ipmiutil) does not work when attempting to activate an SOL connection.

IPMIUtil is the Windows Equivalent of IPMITOOLS.

It may be downloaded from Sourceforge:  http://ipmiutil.sourceforge.net/

After installing the appropriate Windows Binary, here is the basic syntax of ipmiutil after you install the binary

c:\Users\Support>ipmiutil
ipmiutil ver 3.18
Usage: ipmiutil <command> [other options]
   where <command> is one of the following:
        alarms  show/set the front panel alarm LEDs and relays
        leds    show/set the front panel alarm LEDs and relays
        discover        discover all IPMI servers on this LAN
        cmd     send a specified raw IPMI command to the BMC
        config  list/save/restore BMC configuration parameters
        dcmi    get/set DCMI parameters
        ekanalyzer      run EKeying analyzer on FRU files (deprecated, see fru)
        events  decode IPMI events and display them
        firewall        show/set firmware firewall functions
        fru     show decoded FRU inventory data, write asset tag
        fwum    OEM firmware update manager extensions
        getevt  get IPMI events and display them, event daemon
        getevent        get IPMI events and display them, event daemon
        health  check and show the basic health of the IPMI BMC
        hpm     HPM firmware update manager extensions
        lan     show/set IPMI LAN parameters, users, PEF rules
        picmg   show/set picmg extended functions
        power   issue IPMI reset or power control to the system
        reset   issue IPMI reset or power control to the system
        sel     show/clear firmware System Event Log records
        sensor  show Sensor Data Records, readings, thresholds
        serial  show/set IPMI Serial & Terminal Mode parameters
        sol     start/stop an SOL console session
        smcoem  SuperMicro OEM functions
        sunoem  Sun OEM functions
        delloem Dell OEM functions
        tsol    Tyan SOL console start/stop session
        user    list or modify IPMI LAN users
        wdt     show/set/reset the watchdog timer
   common IPMI LAN options:
       -N node  Nodename or IP address of target system
       -U user  Username for remote node
       -P/-R pswd  Remote Password
       -E   use password from Environment IPMI_PASSWORD
       -F   force driver type (e.g. imb, lan2)
       -J 0 use lanplus cipher suite 0: 0 thru 14, 3=default
       -T 1 use auth Type: 1=MD2, 2=MD5(default), 4=Pswd
       -V 2 use priVilege level: 2=user(default), 4=admin
       -Y   prompt for remote password
       -Z   set slave address of local MC
For help on each command (e.g. 'sel'), enter:
   ipmiutil sel -?
ipmiutil , usage or help requested

Many of the basic commands DO work.

C:\>ipmiutil user list 1 -N 10.132.14.27 -U admin -P mypass99 -V 3
ipmiutil user ver 3.18
Connecting to node  10.132.14.27
User  1: chan=1         disabled          Admin
User  2: chan=1         disabled          Admin         szadm
User  3: chan=1          enabled        No access       admin
User  4: chan=1         disabled        No access
User  5: chan=1         disabled        No access
User  6: chan=1         disabled        No access
User  7: chan=1         disabled        No access
User  8: chan=1         disabled        No access
User  9: chan=1         disabled        No access
User 10: chan=1         disabled        No access
ipmiutil user, completed successfully

Example viewing sensor data also works

C:\>ipmiutil sensor -N 10.132.14.27 -U admin -P mypass99 -V 3
ipmiutil sensor version 3.18
Connecting to node  10.132.14.27
-- BMC version 2.21, IPMI version 2.0
_ID_ SDR_Type_xx ET Own Typ S_Num   Sens_Description   Hex & Interp Reading
0001 SDR Full 01 01 20 a 01 snum 33 DRIVE14_TEMP     = 20 OK   32.00 degrees C
0002 SDR Full 01 01 20 a 02 snum 6f PVCCSA_CPU1      = 2e OK   0.92 Volts
0003 SDR Full 01 01 20 a 01 snum 01 PCH_TEMP         = 2d OK   45.00 degrees C
0004 SDR Full 01 01 20 a 01 snum 13 CPU1_DIMMB1_TEMP = 00 Absent 0.00 na
0005 SDR Full 01 01 20 a 04 snum 4b FAN_TACH5        = 70 OK   11200.00 RPM
0006 SDR Full 01 01 20 a 01 snum 11 CPU1_DIMMA1_TEMP = 00 Absent 0.00 na
0007 SDR Full 01 01 20 a 02 snum 6d PVCCIN_CPU1      = 59 OK   1.78 Volts
0008 SDR Full 01 01 20 a 01 snum 36 DRIVE17_TEMP     = 1f OK   31.00 degrees C
0009 SDR Full 01 01 20 a 04 snum 48 FAN_TACH2        = 83 OK   13100.00 RPM
000a SDR Full 01 01 20 a 01 snum 27 DRIVE2_TEMP      = 1f OK   31.00 degrees C
000b SDR Full 01 01 20 a 02 snum 72 VOLT_PVNN        = 32 OK   1.00 Volts
000c SDR Full 01 01 20 a 04 snum 4f FAN_TACH9        = 73 OK   11500.00 RPM
000d SDR Full 01 01 20 a 01 snum 32 DRIVE13_TEMP     = 1f OK   31.00 degrees C
000e SDR Full 01 01 20 a 01 snum 3a DRIVE21_TEMP     = 20 OK   32.00 degrees C
000f SDR Full 01 01 20 a 04 snum 5d PSU0_FAN1        = 82 OK   13000.00 RPM
0010 SDR Full 01 01 20 a 04 snum 4d FAN_TACH7        = 73 OK   11500.00 RPM

However, when attempting to initialize a Serial Over Lan (SOL) connection using ipmiutil you may encounter a condition where you do not see a login prompt or the expected screen output.

Example:

Even when following the usage and specifying a ~? for help you do not SEE A login prompt. The terminal remains black and does not show anything.

Even if you attempt to TYPE on the screen, you will see text but it will then disconnect.

The PROBLEM is that the Windows Command Prompt does not correctly render the Terminal Output.

The SOLUTION is to use a Linux and/or MAC system and ipmitool.

Posted in Windows | Tagged , , , , | 1 Comment

VMWare VM shows duplicate IP for same host after Migrating (VMotion) the VM to another ESXi Storage Host

In the following example I ran into an issue whereby I was attempting to:

Migrate VMware Virtual Machine (VM) 2012_DC01.BINTRI.AD from ESXi Host-A to ESXi Host-B

The Migration was successful.

However after the VMotion completed, when I attempted to 'ping' my VM host IP Address it showed that there was a Duplicate IP address!

# ping -I ens192 172.16.241.187
PING 172.16.241.187 (172.16.241.187) from 172.16.242.196 ens192: 56(84) bytes of data.
64 bytes from 172.16.241.187: icmp_seq=1 ttl=128 time=0.459 ms
64 bytes from 172.16.241.187: icmp_seq=1 ttl=128 time=0.460 ms (DUP!)
64 bytes from 172.16.241.187: icmp_seq=2 ttl=128 time=0.529 ms
64 bytes from 172.16.241.187: icmp_seq=2 ttl=128 time=0.529 ms (DUP!)

I knew my client (2012_DC01.BINTRI.AD) only had a single ethernet interface.

Initially thinking someone grabbed my IP address on the network, I ran the following to display the MAC address

# arping -c 1 -I ens192 172.16.241.187
ARPING 172.16.241.187 from 172.16.242.51 ens192
Unicast reply from 172.16.241.187 [00:50:56:AF:7A:19]  1.390ms
Unicast reply from 172.16.241.187 [00:50:56:AF:7A:19]  1.432ms
Sent 1 probes (1 broadcast(s))
Received 2 response(s)

This told me that there was the SAME MAC address (00:50:56:AF:7A:19) responding to IP 172.16.241.187

Because I wanted to be doubly sure, I used nmap to tell me the OS type/etc and I was able to verify it is a Windows Server 2012 Client MAC Address (00:50:56:AF:7A:19)

# nmap -FO --system-dns 172.16.241.187

Starting Nmap 6.40 ( http://nmap.org ) at 2022-01-24 16:02 PST
Nmap scan report for dc01.bintri.ad (172.16.241.187)
Host is up (0.00033s latency).
Not shown: 95 closed ports
PORT      STATE SERVICE
53/tcp    open  domain
80/tcp    open  http
139/tcp   open  netbios-ssn
445/tcp   open  microsoft-ds
49152/tcp open  unknown
MAC Address: 00:50:56:AF:7A:19 (VMware)
Device type: general purpose
Running: Microsoft Windows 7|2012
OS CPE: cpe:/o:microsoft:windows_7:::ultimate cpe:/o:microsoft:windows_2012
OS details: Microsoft Windows 7 or Windows Server 2012
Network Distance: 1 hop

OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 4.47 seconds

Because I knew MAC Address (00:50:56:AF:7A:19) belonged to (2012_DC01.BINTRI.AD) there was 'something' in ESXi that believed there were 2 instances running!

I powered off VM 2012_DC01.BINTRI.AD using vCenter.

Yet I was still able to ping the IP address.

I went to the source ESXi Host-A and verified that it did not exist.

This told me that something was still resident in memory on either ESXi Host-A, or ESXi Host-B

I ssh'd into ESXi Host-A and ran the following command:

# esxcli vm process list

I looked for any processes open for host 2012_DC01.BINTRI.AD. I saw none.

I then ssh'd into ESXi Host-B and also ran

# esxcli vm process list

Except this time I saw in the output:

# esxcli vm process list
AD_2012_DC01.BINTRI.AD
   World ID: 136755
   Process ID: 0
   VMX Cartel ID: 136754
   UUID: 42 2f 8d 75 b6 84 51 78-90 5b 06 84 b2 e4 d5 22
   Display Name: AD_2012_DC01.BINTRI.AD
   Config File: /vmfs/volumes/d81de9d4-9c2bbc60/AD_2012_BENDC01.BINTRI.AD/AD_2012_BENDC01.BINTRI.AD.vmx

Because I powered off the VM, this told me that there was a process that needed to be stopped.

Therefore I used the 'World ID' and ran the following:

# esxcli vm process kill -t force -w=136755

Re-running esxcli vm process list now showed the process was gone.

I attempted to ping the IP address and this time it did not respond; as expected.

I then powered on the VM, and now when I ping, there is only a single IP Address

# ping 172.16.241.187
PING 172.16.241.187 (172.16.241.187) 56(84) bytes of data.
64 bytes from 172.16.241.187: icmp_seq=1 ttl=128 time=1.68 ms
64 bytes from 172.16.241.187: icmp_seq=2 ttl=128 time=0.348 ms
64 bytes from 172.16.241.187: icmp_seq=3 ttl=128 time=0.606 ms

Posted in VMWare | Tagged , , , , | Leave a comment

Include Line Numbers to bash set-x debug output

There are times you need to view the line numbers in a bash script to view script execution.

Within bash 'set -x' either at the shell, or within the bash script will display debug output.

To include line numbers you can use the PS4='${LINENO}:'

The $PS4 variable in Bash is used for the prompt printed before the command line is echoed when the debugging shell option -x is set with the set builtin command

EXAMPLE

#!/bin/bash
PS4='${LINENO}: '
echo "Hello"
echo "World

OUTPUT

# ./test.sh
+ PS4='${LINENO}: '
6: echo Hello
Hello
7: echo World
World
Posted in Command Line FU | Tagged , | Leave a comment

How to get rid of that annoying “Add to Reading List” option in Google Chrome when you click on the star to make a bookmark.


In the Google Chrome URL put in chrome://flags/#read-later


Scroll down to Reading List Section

Click on the Drop down and select DISABLED on Reading List and Reading List 'New ' badge promo

Click on Relaunch Chrome in the bottom right.


Whallah!

You're Welcome..

Posted in Google Chrome | Tagged , , , , , | Leave a comment

Using Home and End Key on MAC External Keyboard in Royal TSX Terminal AND Regular MAC applications (apps)

I went all over the know Interwebz Universe attempting to find a solution for this and finally figured out a way to make both happen.

The original problem was that I could use Karabiner Elements for Mac to setup my External MAC keyboard to use various familiar Windows keyboard actions (such as pressing the HOME or END key) in applications such as TextEdit/Word/Outlook/etc.

However... the problem was, when launching Terminal (specifically in Royal TSX) I was unable to make it work.

It became an either/or relationship. I was only able to get one or the other working.

SOLUTION



PART I

In Karabiner Element I go to Add Complex Modifications

Then click on Add rule




Then search for 'home' and the following rule that will use COMMAND+a  for HOME and COMMAND+e for END


Import the rules

And then select ENABLE for these TWO


Now you will see the following



Now in your apps such as TextEdit/Outlook/Word/etc, pressing the HOME key will bring the cursor to the beginning of the line,or END key to the end of the line.



PART II

In ROYAL TSX

Locate your Terminal and go to properties


Scroll down to ADVANCED --> INPUT then go to  KEY MAPPINGS



Click on ADD Then click SET and press the HOME key


It will then populate the keystroke. Scroll down and select SEND HEX CODE


For the HOME Key Enter 0x10




Repeat the above except for the END key, use 0x05
|


Now back at the main screen we can see we have to new combinations for the HOME and END key




SUCCESSFUL RESULTS

APPLICATION EXAMPLE:





ROYAL TSX TERMINAL EXAMPLE







Posted in MAC-OSX | Leave a comment

Mouse Lag after upgrading to Big Sur

Recently I upgraded my laptop to Mac OSX Big Sur and it has been a Mouse Nightmare with my Logitec MX Master 2S Mouse

I went to the Logitech Support website and referenced the following link regarding Big Sur Problems

After upgrading the Logitec drivers, the issue persisted.

I found the following solution that helped to reset the Mouse settings


$ mkdir $HOME/backups
$ find $HOME/Library/Preferences -type f -iname "*mouse*" -exec mv -f {} $HOME/backups \;
$ reboot

But the main problem in my case, was that I was connecting my mouse to my MACBook laptop thru a USB extender.

The MACBook Pro only has 2 USB ports.

I purchased a 5 port USB extender I was using for all devices and I had the Logitec Bluetooth Adapter plugged into the USB Extender; apparently this causes latency.

As a matter of troubleshooting I removed all USB devices and plugged only the Logitec Bluetooth Device in and the mouse worked perfectly.

Because I needed the ports, I paired the mouse with the native Bluetooth, and now all is well in Mouse Madness Universe!

Posted in MAC-OSX | Leave a comment

Welcome

Welcome to my blog. This is my first post and I will be sharing more information soon.

Posted in Comments & Announcements | Leave a comment