Newsletter # 18 - Host naming organisation for your local lab Jan 31 2020
Hello,
I hope you had a good January, and ready for the weekend and February. I'm certainly going to try to get as much rest as possible this weekend. It has been a busy few weeks, and the year has just started! We'll see how everything goes from here.
Time seems to be going by super fast. I feel as if I just started the Newsletter, but this is issue #18. I hope there are many more to come, and that you are enjoying them as much as I am.
This week I've been pondering about the state of tech, everything seems to be changing so fast. I sometimes worry about our constant need for novelty. We are always pursuing the newest Framework or tools. There is not much thought on maintainability. This focus on novelty has also pushed us to build tools and projects that won't last. We don't worry about documentation or building a tool that will work for years. We only look for creating new features, not maintenance.
What is interesting is how different things are on our core infrastructure; it has been running for decades. Most of our most critical systems still run on Cobol. I encourage you to listen to this interesting episode of Command Line Heroes on The infrastructure effect: Cobol and Go. I think you'll enjoy it.
Long-lived projects take into account maintainability. One such project is OpenVMS. This OS is another example of infrastructure that has held the test of time. OpenVMS had its first release 42 years ago (October 25, 1977) and its latest release two years ago (July 10, 2017). Probably one of the oldest running OSs. As you might expect, there is a history I want to share with you related to OpenVMS, and that is the story of "Why is Wednesday, November 17, 1858 the base time for OpenVMS (VAX VMS)?". It's a short story that you can read in a couple of minutes, and you'll see the interesting implications that using this date has. Here is the link:
https://www.slac.stanford.edu/rkj/crazytime.txt
Let me know if you enjoy it as much as I did.
Ok, before saying good bye. Let's talk about this week's post on "Host naming organisation for your local lab". I've been working on my local lab, creating many VMs and a couple of devices. Sometimes it's hard to remember all the IP's and ports that I assigned. So to keep things cleaner, I decided to use names instead of IPs and do some port forwarding to always use the standard ports on every VM or Container. What this means is that when I create a VM and I map one of its ports (Let's say 22 for ssh) to a port on my localhost (e.g. 2223), I would like to give the VM a name (e.g. Pangea) and I would like to be able to use the default port for each service. So I could:
1
2
3
$ ssh pangea
# instead of doing
$ ssh -p 2223 127.0.0.1
I am making use of loopback aliases and port forwarding to keep track of every host and service. That way I can set the services to the default ports and only worry about the names. If you are struggling with the same problem, maybe that approach might also work for you. Here is the link:
https://rderik.com/blog/host-naming-organisation-for-your-local-lab/
Alright, that's it for this week. Have a fun weekend.
Derik
Tip of the week
Bash aliases are handy. There are a few that I always set. For example ls, I always want to see colours on my terminal:
1
2
3
4
5
6
7
8
9
# Detect which `ls` flavour is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-GFh"
fi
# Always use color output for `ls`
alias ls="ls ${colorflag}"
If you see my configuration for macOS, it uses the flags -GFh, to display colour (-G), add a trailing / to directories and a trailing * to executables (-F), and the -h adds the human-readable size when using the long format. But it can backfire. For example:
1
2
3
4
5
6
7
8
9
$ ls -1
#The random output on my current directory
Info.plist
IntoAccount.crypted
IntoAccount.ipa
Payload/
example.py
test*
test.swift
You can tell that test is an executable, but If we want to pipe that output to another command, it won't find the file with name test* the name is test the * is display decoration.
So how to fix it without having to remove the alias? Enter command:
1
2
3
4
5
6
7
8
$ command ls -1
Info.plist
IntoAccount.crypted
IntoAccount.ipa
Payload
example.py
test
test.swift
No trailing slash for directories, or * for executables. The command command is also useful to show what the command is actually going to execute:
1
2
$ command -v ls
alias ls='ls -GFh'
Very handy. I encourage you to read the man page of command(1) for additional information.