1. Introduction

These are some devices running on my home network:

  1. My first MacBook.

  2. My second MacBook and cell phone.

  3. My company’s laptop (Dell 3410).

  4. My daughter’s MacBook and cell phone.

  5. My wife’s laptop and cell phone.

  6. My son’s laptop and cell phone.

So, in order to identify these devices on my network, I need a better way to name them. This document shows you how do I define the hostname for some of these devices. It also shows you the network configuration in some of them.

2. MacBooks

2.1. pj0m

My first MacBook, bought in 2010.

2.2. pj1m

My second MacBook, bought in 2017.

Actual macOS and hardware overview:

pj1m

pj1m.hardware

3. Hostnames

3.1. Name formation

  1. The first two letters: device owner’s initials. Examples:

    • pj: Paulo Jeronimo

    • co: Company (or Contractor)

  2. The third letter: the device number (in Crockford’s Base32).

  3. The fourth letter: device operational system. Examples:

    • a: Android

    • i: iOS

    • m: macOS

    • u: Ubuntu

    • w: Windows

3.2. Virtualized machines (VMs)

VMs contains a dash (-) in their hostname used as a separator for two parts of the name. The first part is the name of the host machine. The second part is freely named but I usually name it containing at least two characters:

  1. First character: a letter identifying the operational system.

  2. Second character: a digit in base32.

3.3. Examples

  1. pj0m: first PJ’s MacBook running a macOS operational system.

  2. pj1m-u0: first virtualized Ubuntu machine running on host macOS on the second PJ’s MacBook (pj1m).

  3. co0u: first company’s laptop running a Ubuntu operational system.

4. IPs reservation by hostname

Reserved IPs: from 2 to 21 (20 ips).

  1. Reserved for pj0m (4 ips): 2-5.

  2. Reserved for pj1m (8 ips): 6-13.

    • Wi-Fi: 6.

    • Wired: 7.

    • Reserved for VMs: 8-13.

  3. Reserved for co0u (8 ips): 14-21.

    • Wired: 14.

    • Wi-Fi: 15.

    • Reserved for VMs: 16-21.

5. Network configuration

5.1. router

router

5.2. pj1m

These are my network configurations for pj1m. Hostname:

pj1m.hostname

Wi-Fi:

pj1m.wifi

Wi-Fi TCP/IP:

pj1m.wifi.tcpip

Wi-Fi DNS:

pj1m.wifi.dns

5.3. co0u

Wired TCP/IP (IpV4) configuration:

co0u.wired

5.4. Ping from one host to another

pj@pj1m:~$ ping co0u.local
PING co0u.local (192.168.15.14): 56 data bytes
64 bytes from 192.168.15.14: icmp_seq=0 ttl=64 time=3.858 ms
64 bytes from 192.168.15.14: icmp_seq=1 ttl=64 time=3.805 ms
^C
$ ssh co0u.local
pj@co0u:~$ ping pj1m.local
PING pj1m.local (192.168.15.6) 56(84) bytes of data.
64 bytes de 192.168.15.6 (192.168.15.6): icmp_seq=1 ttl=64 tempo=3.99 ms
64 bytes de 192.168.15.6 (192.168.15.6): icmp_seq=2 ttl=64 tempo=313 ms
^C

6. VNC connection (between pj1m and co0u)

6.1. pj1m → co0u

6.1.1. co0u steps

VNC packages installation:

$ sudo apt install tightvncserver xfce xfce-goodies
$ dpkg -l | grep vnc
ii  libvncclient1:amd64                        0.9.12+dfsg-9ubuntu0.3                amd64        API to write one's own VNC server - client library
ii  remmina-plugin-vnc:amd64                   1.4.2+dfsg-1ubuntu1                   amd64        VNC plugin for Remmina
ii  tigervnc-common                            1.10.1+dfsg-3                         amd64        Virtual network computing; Common software needed by servers
ii  tigervnc-standalone-server                 1.10.1+dfsg-3                         amd64        Standalone virtual network computing server

VNC configuration:

$ mkdir -p ~/.vnc && cd $_
$ cat > xstartup.xfce4 <<'EOF'
#!/bin/sh

xrdb $HOME/.Xresources
startxfce4 &
EOF
$ ln -f xstartup.xfce4 xstartup

VNC start:

$ vncserver -geometry 1280x780 -depth 24

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n

New 'co0u:1 (pj)' desktop at :1 on machine co0u

Starting applications specified in /home/pj/.vnc/xstartup
Log file is /home/pj/.vnc/co0u:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/pj/.vnc/passwd :1 to connect to the VNC server.
You will be prompted to create a password.

VNC execution verify:

$ ss -nlt | grep 5901
LISTEN  0        5              127.0.0.1:5901           0.0.0.0:*
LISTEN  0        5                  [::1]:5901              [::]:*

To stop the VNC server, type:

$ vncserver -kill :1

6.1.2. Connection to co0u

On pj1m terminal, type:

$ ssh -L 59000:localhost:5901 -C -N -l pj co0u.local
# Type Ctrl+Z to get the shell again

$ # Put the ssh execution running in the background
$ bg
$ open vnc://localhost:59000

6.1.3. Troubleshooting

To XFCE starts a terminal, I needed to do this configuration (using a terminal already opened):

$ sudo update-alternatives --config x-terminal-emulator
There are 2 choices for the alternative x-terminal-emulator (providing /usr/bin/x-terminal-emulator).

  Selection    Path                             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gnome-terminal.wrapper   40        auto mode
  1            /usr/bin/gnome-terminal.wrapper   40        manual mode
  2            /usr/bin/xfce4-terminal.wrapper   40        manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/xfce4-terminal.wrapper to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in manual mode