Cisco UCS – set SSH idle-timeout

FI# terminal session-timeout <n>
0-525600 Terminal Time Out (in minutes)

Of course, setting to „0“ which is disabling the timeout is for productive devices all, but no good practice 😉

… but handy in isolated Lab environments.

Visio Diagrams with Python: Colors

24 Colors to choose from.

„Cells“ contain all „Shape-Format“-Properties

Details: https://docs.microsoft.com/en-us/office/client-developer/visio/cells-visio-shapesheet-reference

# Line-Color
# https://docs.microsoft.com/de-de/office/client-developer/visio/linecolor-cell-line-format-section
oval2.Cells("LineColor").FormulaForce = 3

# Fill-Color
# https://docs.microsoft.com/de-de/office/client-developer/visio/fillforegnd-cell-fill-format-section
rect1.Cells("FillForegnd").FormulaForce=3

# Fill-Pattern "0" - no fill
# https://docs.microsoft.com/de-de/office/client-developer/visio/fillpattern-cell-fill-format-section
rect2.Cells("FillPattern").FormulaForce=0

# Fill-Pattern "3"

# yellow background
# https://docs.microsoft.com/de-de/office/client-developer/visio/fillbkgnd-cell-fill-format-section
#
# light-blue foreground
#
oval1.Cells("FillPattern").FormulaForce = 3
oval1.Cells("FillBkgnd").FormulaForce = 5
oval1.Cells("FillForegnd").FormulaForce = 7

Result

Visio Diagrams with Python: Connectors

Connect two existing Shapes

The API is somehow weird, since it creates an (Shape-)Object, but it doesn’t return it.

  • you’ll have to fetch the last object in the shapes-List
#https://docs.microsoft.com/en-us/office/vba/api/visio.shape.autoconnect
rect1.AutoConnect(rect2,0)
#
#https://docs.microsoft.com/en-us/office/vba/api/visio.shapes.itemu
connector1=shapes.ItemU(len(shapes))
#
connector1.Text = "Connector1"
# 
#https://docs.microsoft.com/de-de/office/client-developer/visio/linecolor-cell-line-format-section
# * color "3" is "light green"
connector1.Cells("LineColor").FormulaForce = 3
#
#https://docs.microsoft.com/de-de/office/client-developer/visio/conlinerouteext-cell-shape-layout-section
# * ConLineRouteExt "2" is "Curved"
connector1.Cells("ConLineRouteExt").FormulaForce = 2

Result

>>> len(shapes)
6

Azure – Pricing API

This is a really nice feature – the Azure Pricing REST-API:

https://docs.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices

It pulls a structured JSON-Dataset for (not only) Virtual Machines out of the Azure-Webshop.

For example – the following filter:
https://prices.azure.com/api/retail/prices?$filter=serviceName eq ‚Virtual Machines‘ and priceType eq ‚Consumption‘ and endswith(armRegionName, ‚europe‘) and (startswith(skuName, ‚D‘) or startswith(skuName, ‚E‘) or startswith(skuName, ‚F‘) or startswith(skuName, ‚M‘)) and endswith(skuName,‘ Spot‘)
displays the price for only

  • „VMs“

with specific properties:

  • no Reservation
  • in „.*europe“-Locations
  • with Types „D.*“ or „E.*“ or „F.*“ or „M.*“
  • Spot-Intances

but – if you don’t want „Spot“ Instances, you’d guess this filter-Statement: https://prices.azure.com/api/retail/prices?$filter=serviceName eq ‚Virtual Machines‘ and priceType eq ‚Consumption‘ and endswith(armRegionName, ‚europe‘) and (startswith(skuName, ‚D‘) or startswith(skuName, ‚E‘) or startswith(skuName, ‚F‘) or startswith(skuName, ‚M‘)) and not endswith(skuName,‘ Spot‘)

to end with … and not endswith(skuName,‘ Spot‘) according to https://docs.microsoft.com/en-us/azure/search/search-query-odata-logical-operators but this breaks the call – the API returns :

{"Error":{"Code":"BadRequest","Message":"Invalid OData parameters supplied"}}

Microsoft Azure – Hyperthreading and Nested Virtualization

Go to https://docs.microsoft.com/en-us/azure/virtual-machines/acu and look for:

***Hyper-threaded and capable of running nested virtualization

The following „script“ pulls the SKUs out of the table:

wget -O - --no-check-certificate https://docs.microsoft.com/en-us/azure/virtual-machines/acu | egrep -B2 "\*\*\*" | egrep "data-linktype" | sed -E "s/^.+relative-path..([^\<]+).+$/SKU: \1/g"
C:\RH>echo "Hyper-threaded and capable of running nested virtualization" && wget -q -O - --no-check-certificate https://docs.microsoft.com/en-us/azure/virtual-machines/acu | egrep -B2 "\*\*\*" | egrep "data-linktype" | sed -E "s/^.+relative-path..([^\<]+).+$/SKU: \1/g"
"Hyper-threaded and capable of running nested virtualization"
SKU: D_v3
SKU: Ds_v3
SKU: Dv4
SKU: Dsv4
SKU: Ddv4
SKU: Ddsv4
SKU: E_v3
SKU: Es_v3
SKU: Ev4
SKU: Esv4
SKU: Edv4
SKU: Edsv4
SKU: F2s_v2 - F72s_v2
SKU: M

Next Step? Finding one with enough memory for an acceptable price.

Cisco TECDEV-2765

Preparation

C:\> pip install pyang
Collecting pyang
Downloading https://files.pythonhosted.org/packages/5e/b4/4f1937f18914b847168ea596b77e04d75d28ff937ecc4ac7da210b17ad78/pyang-2.1.1-py2.py3-none-any.whl (572kB)
100% |████████████████████████████████| 573kB 3.6MB/s
Collecting lxml (from pyang)
Downloading https://files.pythonhosted.org/packages/aa/17/b9ccbdd50f66258d362561dbfe3cf4aaa60c82c4bba0302b3f52ab730b99/lxml-4.4.2-cp37-cp37m-win_amd64.whl (3.7MB)
100% |████████████████████████████████| 3.7MB 5.2MB/s
Installing collected packages: lxml, pyang
Successfully installed lxml-4.4.2 pyang-2.1.1
You are using pip version 10.0.1, however version 20.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\> python -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/57/36/67f809c135c17ec9b8276466cc57f35b98c240f55c780689ea29fa32f512/pip-20.0.1-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 7.0MB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-20.0.1


C:\cd lab
C:\LAB>cd GIT


C:\LAB\GIT> git clone https://github.com/YangModels/yang.git
Cloning into 'yang'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 30728 (delta 6), reused 12 (delta 3), pack-reused 30709
Receiving objects: 100% (30728/30728), 61.09 MiB | 11.29 MiB/s, done.
Resolving deltas: 100% (23142/23142), done.
Checking out files: 100% (32215/32215), done.


C:\LAB\GIT> git clone https://github.com/mikemikhail/ML-anomaly_detection-demo.git
Cloning into 'ML-anomaly_detection-demo'...
remote: Enumerating objects: 61, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 178 (delta 30), reused 4 (delta 1), pack-reused 117
Receiving objects: 100% (178/178), 51.86 MiB | 11.27 MiB/s, done.
Resolving deltas: 100% (30/30), done.

 

Windows LAN-MTU Test

The default-MTU allows max. 1472-byte sized ping-packets to be sent (28 Bytes will always get added: 20 Byte IPv4-Header, 8 Byte ICMP-Header).

If you want to test the max. MTU of the LAN, you have to modify the IP-MTU of the Windows-NIC.

List all Interfaces

C:\>netsh interface ipv4 show interfaces

Idx Met MTU State Name
--- ---------- ---------- ------------ ---------------------------
1 75 4294967295 connected Loopback Pseudo-Interface 1
27 55 1500 disconnected WLAN
12 25 1500 disconnected Local Area Connection* 9
8 25 1500 disconnected Local Area Connection* 10
4 5 1500 disconnected ETH_DELL
23 25 1500 connected VirtualBox_Host3
13 25 1500 connected ETH_DOCK
24 25 1500 connected VirtualBox_Host1
11 25 1500 connected VirtualBox_Host2
9 25 1500 connected Npcap Loopback Adapter
5 25 65536 connected Ethernet
15 25 1500 connected VirtualBox Host-Only Network #4
14 1 1500 disconnected Ethernet 4

Interesting is for example ETH_DOCK – my active NIC when the Laptop is mounted to the „docking-station“.
C:\>netsh interface ipv4 show subinterface 13

MTU MediaSenseState Bytes In Bytes Out Interface
------ --------------- --------- --------- -------------
1500 1 255082163 60077137 ETH_DOCK

This doesn’t prove anything – the IP-Packet wont be sent through the NIC, Windows prints the „Packet neneds to be fragmented but DF set“-Message instead.
C:\>ping 192.168.2.1 -l 9000 -f

Pinging 192.168.2.1 with 9000 bytes of data:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.

Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Modify the IP-MTU

C:\>netsh interface ipv4 set subinterface 13 mtu=9000 store=persistent
The requested operation requires elevation (Run as administrator).

@Retry as admin
C:\WINDOWS\system32>netsh interface ipv4 set subinterface 13 mtu=9000 store=persistent
Ok.

Verify the IP-MTU again
C:\> netsh interface ipv4 show subinterface 13

MTU MediaSenseState Bytes In Bytes Out Interface
------ --------------- --------- --------- -------------
9000 1 255253609 60683324 ETH_DOCK

Now the IP-Ping is sent into the LAN-Switch.

C:\> ping 192.168.2.1 -l 8972 -f

Pinging 192.168.2.1 with 8972 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Timeout?

Action Plan:

  • check device 192.168.2.1 – is it powert up?
  • fix the LAN-Switch-MTU?
  • fix the IP-MTU of end-device „192.168.2.1“

IEEE 802.1ax – LACP: How to virtually tear down a DC using a Linux-Server

more than ten years later (IEEE 802.1ax-2008), but everybody calls it 802.3ad and serverguys still prefer static bonding with round-robin distribution [without telling network admins about that decision] to confuse (or tear down) ethernet-networks.

What a stupid default: default bond0 interface with balance round robin mode Awsome 🙂

FWM-2-STM_LOOP_DETECT How a single server affects vMotion, SLB-VIP-Mobility, First-Hop Redundancy-Protocols (VRRP, HSRP you name it) in 2019.

I won’t expect technology like software-defined-networks to solve human ignorance.

COT – Common OVF Tool

…this article should have been published at 2017-11-23, i forgot to press the right botton.

So, an update might be needed, anyone still interested in cot today?

Release 2.1 (2018-01-29) is the current release, containing some fixes (https://github.com/glennmatthews/cot/blob/master/CHANGELOG.rst)

  • COT installation using PIP

So, let’s go, following

administrator@lx-ubuntu:~$ sudo pip install cot
sudo: pip: command not found


thats embarassing.

Install PIP first

$ sudo apt-get update
$ sudo apt-get install python-pip

$ pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Try it again

$ sudo pip install cot
...
Successfully installed backports.shutil-get-terminal-size-1.0.0 colorlog-3.1.4 cot-2.1.0 ndg-httpsclient-0.5.1 pyvmomi-6.7.0.2018.9 verboselogs-1.7
$ cot --version
Common OVF Tool (COT), version 2.1.0
Copyright (C) 2013-2017 the COT project developers.
  • Optional: Argument-Completion

Not essential, but handy.

$sudo pip install argcomplete
...
Successfully installed argcomplete-1.9.4
  • COT helpers

A full installation requires so called „cot-helpers“ to use all features.

$ cot install-helpers --verify-only
Results:
-------------
COT manpages: DIRECTORY NOT FOUND: /usr/local/man/man1
fatdisk:      NOT FOUND
mkisofs:      NOT FOUND
ovftool:      NOT FOUND
qemu-img:     NOT FOUND
vmdktool:     NOT FOUND
$ sudo apt-get install xutils-dev
...
Setting up xutils-dev (1:7.7+5ubuntu1) ...
$ sudo cot install-helpers
...
Results:
-------------
COT manpages: already installed, no updates needed
fatdisk:      INSTALLATION FAILED: [Errno 1] Helper program './RUNME' exited with error 1
mkisofs:      version 2.1, present at /usr/bin/mkisofs
ovftool:      INSTALLATION FAILED: No support for automated installation of ovftool, as VMware requires a site login to
              download it. See https://www.vmware.com/support/developer/ovf/
qemu-img:     version 2.11.1, present at /usr/bin/qemu-img
vmdktool:     version 1.4, present at /usr/local/bin/vmdktool

[Errno 1] Unable to install some helpers

first fix „fatdisk“ which is used to inject configs into OVA-Files


$ sudo cp /usr/include/x86_64-linux-gnu/bits/stdint-intn.h /usr/include/x86_64-linux-gnu/bits/stdint-intn.h.bak
$ sudo vi /usr/include/x86_64-linux-gnu/bits/stdint-intn.h


uncomment

 typedef __int64_t int64_t;


to

//typedef __int64_t int64_t;


and run the helper-installation again:

$ sudo cot install-helpers
...
NOTICE  : Successfully installed 'fatdisk'
Results:
-------------
COT manpages: already installed, no updates needed
fatdisk:      successfully installed to /usr/local/bin/fatdisk, version 1.0
mkisofs:      version 2.1, present at /usr/bin/mkisofs
ovftool:      INSTALLATION FAILED: No support for automated installation of ovftool, as VMware requires a site login to
              download it. See https://www.vmware.com/support/developer/ovf/
qemu-img:     version 2.11.1, present at /usr/bin/qemu-img
vmdktool:     version 1.4, present at /usr/local/bin/vmdktool

[Errno 1] Unable to install some helpers


But it threw a lot of warnings..
warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘int64_t {aka long long int}’ [-Wformat=]
… but it compiles… Memo: Try manual compilation…

$ mkdir fatdisk
$ cd fatdisk
$ wget -O fatdisk.tgz https://github.com/goblinhack/fatdisk/archive/master.tar.gz
$ tar zxf fatdisk.tgz
$ cd fatdisk-master/
$ ./RUNME

OFVTool of course has to be installed manually
Download from VMware: OVFTOOL-Download

Upload to the Linux-Server using Putty-SCP(PSCP) and public-key-authentication:

C:\Downloads&gt;pscp -scp -i C:\rh.priv.ppk VMware-ovftool-4.3.0-7948156-lin.x86_64.bundle administrator@192.168.56.101:
VMware-ovftool-4.3.0-7948 | 35623 kB | 35623.9 kB/s | ETA: 00:00:00 | 100%

At the Linux-Server

$ ls -l
total 35644
-rw-r--r-- 1 administrator administrator 36478864 Oct 15 18:36 VMware-ovftool-4.3.0-7948156-lin.x86_64.bundle
$ chmod a+x VMware-ovftool-4.3.0-7948156-lin.x86_64.bundle
$ sudo ./VMware-ovftool-4.3.0-7948156-lin.x86_64.bundle
...
Installing VMware OVF Tool component for Linux 4.3.0
    Configuring...
[######################################################################] 100%
Installation was successful.
administrator@lx-ubuntu:~$ cot install-helpers --verify-only
Results:
-------------
COT manpages: already installed, no updates needed
fatdisk:      version 1.0, present at /usr/local/bin/fatdisk
mkisofs:      version 2.1, present at /usr/bin/mkisofs
ovftool:      version 4.3, present at /usr/bin/ovftool
qemu-img:     version 2.11.1, present at /usr/bin/qemu-img
vmdktool:     version 1.4, present at /usr/local/bin/vmdktool