Why can I ping via IP address but not hostname?
Solution 1:
Try sudo apt-get install winbind
You probably want to add 'wins' where it says "hosts:" in /etc/nsswitch.conf
Solution 2:
You can also sudo apt install samba
This has an auxillary result of making the hostname available across the LAN.
Instructions on ubuntu.com