· 

Hostnames vs Static IP Addresses

The Server entry in yaMPC Connection Settings scene allows ether hostname or IP address. Also, the Scan button displays both hostnames and IP addresses and allows you to choose either. This blog will discuss pros and cons of each and how to setup Static IP addresses.

 

If you temporarily test a distribution or a DAC with yaMPC, entering the hostname into the Server entry is more convenient because you can use the same hostname when you change DAC or computer (e.g. Raspberry-pi). While if you set your music player permanently (e.g. at your living room or anyplace), entering IP address into the Server entry is recommended because it is faster than hostname to connect to MPD. (Note: I am talking about only speed of network connection. After connecting to a MPD, yaMPC gets album data and queue from the MPD, then displays Queue).

 

A hostname (e.g. volumio.local) is converted to an IP address (e.g. 192.168.0.18) before yaMPC connects to an MPD. It takes 1 or 2 second(s). You can skip this step by entering an IP address instead of a hostname. Then, the IP address is converted to a MAC address (e.g. B5:27:EB:E0:A1:99) of your computer's LAN interface, but this step is done in an instant.

 

However, a drawback of using IP address is that it changes. When you connect your computer (Raspberry-pi) to your local network, your router gives an IP address to the computer. This dynamic allocation of IP addresses is called Dynamic Host Configuration Protocol (DHCP). DHCP may allocate a different IP address to your computer when it boots next time. To use IP address for MPD connection, you need a Static IP address rather than a Dynamic IP address.


For Static IP addresses, you can set mapping of a Static IP address and MAC address with your router settings. Check manual (or help) of your router.

 

Some routers provide very easy ways to set up Static IP addresses. For example, by just tapping a check box of a pair of IP address and MAC address to fix an IP address for a computer.
(left: TP-Link's Deco M5's settings) 


Alternatively, you can use an IP address which is not used by your router's DCHP.

 

This router's DHCP uses IP addresses from 172.16.0.100 to 172.16.0.250 (left). So, for example, you can use 172.16.0.50 for your computer (raspberry-pi).

To use a static IP address without DHCP, you have to set an IP address at your computer side. If your distribution is Volumio, set Automatic IP to Off, then enter a Static IP address and the default Gateway IP address (i.e. your router's IP address).

If your distribution is MoOde, change Addressing Assignment to STATIC at the Network Config.


About Zeroconf

 

Converting from a hostname (or name including domain name) to an IP address is called name resolution. Domain Name System (DNS) is usually used for name resolution. Your router queries an IP address of a name to the DNS server which is provided by your Internet provider. The DNS server knows IP address of public names, for example 'volumio.org'. However, obviously, it does not know IP address of your 'volumio.local'. Then, how yaMPC can connect to your volumio.local? YaMPC uses Zeroconf or mDNS (multicast DNS) for name resolution. With Zeroconf, your iPhone queries by multicast to your local network, then your computer (e.g. Raspberry-pi) responds to the query. Apple's implementation of Zeroconf is called Bonjour and Linux's implementation of Zeroconf is called Avahi. yaMPC uses iPhone's Bonjour to query and Avahi on Volumio responds its IP address. It takes 1 or 2 second(s) from this query to the response. If you use a Static IP address, you can skip this step, hence, it become faster to connect to MPD.