Access by name
I don't remember IP addresses. I prefer to refer to servers by their name,
Note: underscores should not be used in hostnames. avahi will not work with underscores, use dashes instead. For the tvheadend server ♣hostname♣, I am using = tvheadend
Once avahi is installed on ubuntu, it allows me to ssh into the TVheadend PC using:
$ ssh ♣username♣@♣hostname♣.local
For me, it is easier to refer to a server by ♣hostname♣.local.
Step 1. Install avahi-daemon
Find the IP address of the new device. Open a terminal window and run the command:
$ ssh <username>@<ip-address>
Install avahi-daemon
$ sudo apt-get install avahi-daemon -y
These can be added to the above line, but thye don't seem to be required
avahi-discover avahi-utils libnss-mdns mdns-scan
$ logout
Then login using either
$ ssh <username>@tvheadend.local
$ ssh <username>@tvheadend
Step 2. Verify it all works [optional]
Then login using
$ ssh ♣username♣@tvheadend.local
or
$ shh ♣username♣@tvheadend
Try pinging the device
$ hostname
♣hostname♣
$ ping ♣hostname♣.local
If you would like to change the hostname do the following, otherwise, go to the next step
$ sudo nano /etc/hosts
My local area network is 192.168.1.x. My hosts file is:
127.0.0.1 localhost
127.0.1.1 ♣hostname♣
IPv6 is disabled so skip the stuff below
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
CTRL-O, CTR-X, ENTER to save and exit the editor
The hostname file should contain just one entry:
$ sudo nano /etc/hostname
♣hostname♣
CTRL-O, CTR-X, ENTER to save and exit the editor
If you changed the hostname, then reboot
$ sudo reboot