Find Public IP from Cisco IOS CLI

Dealing with ISP modems are a pain. I needed to find out the public ip of a dsl modem after it had changed on me. I was hoping this solution would be as simple as it looks, and it is.

more http://ifconfig.me/ip/

Or if you don’t have DNS configured on the Cisco device:

more http://153.121.72.212/ip/

 

Advertisements

Windows SNMP Service missing tabs

If you’re trying to configure SNMP on a server from a remote workstation, make sure you have SNMP installed on the remote workstation or you’ll miss the Agent, Traps, and Security tab on the SNMP service properties.

Thanks to thomasmaurer.ch for getting me on the right track.

snmp_service_properties.png
w/o SNMP installed on the remote workstation you can’t fully manage SNMP remotely.

Reverse web proxy (with certs)

Here is a great tutorial for setting up a reverse proxy for webservers. (Kudos Tyler and the Ajenti project.)

Caveats:

  • As of 2018-07-10, Ajenti didn’t work on Ubuntu 18.04, a dependency was broken.
  • I setup the cert for site1.domain.com, then site2.domain.com complained it was using site1’s cert, until I ran certbot and gave site2 it’s own cert. Then everything was working.

Global hotkey for New Mail

I found how to make a global hotkey shortcut that opens a new email and I’ve found it quite useful.

  1. Create a new shortcut on the desktop.
  2. Point it to the outlook.exe file.
  3. In the Target field append /c ipm.note at the end.
  4. Select a key for the shortcut field. (I selected “m”, ctrl+alt will be automatically added.)

new_mail_shortcut.PNG

"C:\Program Files (x86)\Microsoft Office\Office16\OUTLOOK.EXE" /c ipm.note

Now I can press Ctrl+Alt+m anywhere and I get a new email window in Outlook.

ESX disconnected from vCenter

One of my esx 5.5 u3 hosts was disconnected from vCenter. The VMs were still running but reconnecting it to vCenter would result in an vmodl.fault.HostCommunication error.

vmodl-fault-hostcomm.png

I logged into the console and looked at the logs and saw that the ramdisk /tmp was full. I verified that it was full with esxcli system visorfs ramdisk list [1]

A simple ls -al /tmp showed that an error log file was filling up the entire ramdisk. I deleted the file and the host automatically reconnected to vCenter.
del_log_file.png

Reclaiming space on VMs

Here are some great posts about reclaiming unused space in esxi.

WHAT’S NEW IN ESXI 6.5 STORAGE PART I: UNMAP

IN-GUEST UNMAP FIX IN ESXI 6.5 PART I: WINDOWS

IN-GUEST UNMAP, ENABLEBLOCKDELETE AND VMFS-6

To get automatic space reclamation you’ll need:

  • ESXi 6.5 Update 1
  • iSCSI volume formatted with VMFS6. (I think VMFS5 works but there are caveats.)
  • Thin provisioned disks.
  • discard option enabled on mount points for your Linux guests.

My new esxi 6.5 host connecting to iscsi volume on FreeNAS 11.0 works like a charm at least when I force and UNMAP with sudo fstrim /

I haven’t had it enabled long enough to watch it work it’s magic, but apparently this means no more filling the drive with zeros, then punching a hole while the machine is offline.

UPDATE 2018-01-20: The magic happens immediately. You can see the updated datastore size immediately after deleting a large file in a linux VM.

It also means that as much as I hate setting up iSCSI, I’m not going to go back to NFS if it doesn’t have this.

Convert VMDK to Thin without vMotion

Storage vMotion is wonderful but vMotion isn’t available without vCenter. bah!

This was a nice guide:

  1. Enable SSH to the host.
  2. Browse to the VM
    cd /vmfs/volumes/<datastore>/<vm>
  3. Create a thin version of the VM.
    vmkfstools -i d <vharddrive>.vmdk -d thin <vharddrive>-thin.vmdk
  4. Remove the thick .vmdk
  5. Attach the thin .vmdk
  6. Delete the old .vmdk and *-flat.vmdk

 

Windows Spotlight Wallpaper

Windows Spotlight has some nice wallpaper and I’d like to keep a couple for later use, so here’s the shortest Powershell script I could make to save them to my Pictures directory:

$src = "$env:LOCALAPPDATA\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"

$dest = "$env:USERPROFILE\Pictures\Windows Spotlight"

Get-ChildItem "$src" | where {$_.length -gt "141160"} | foreach {cp "$src\$_" "$dest\$_.jpg"}

I only copy files greater than 141160 bytes because some files in that directory are not wallpapers and the largest non-wallpaper file is 141160 bytes. So it’s a good starting point.

If user exists?

Getting a simple script to check if an AD user exists has been a nightmare. I wanted something simple and straightforward and I finally found it.

$userobj = $(try {Get-ADUser $user} catch {$null})
if ($userobj -ne $null) {
   Write-Host "$user already exists" -foregroundcolor Green
} else {
   Write-Host "$user not found " -foregroundcolor Red
}

Another options would be to use dsquery:

if (dsquery user -samid $user) {
   Write-Host"$($user.name) exists."
} else {
   Write-Host"$($user.name) doesn't exist."
}

These are the simplest options I can find.