# MPD refusing connection. [SOLVED]

## dartleader

Hello everyone, I am running MPD as my music server on my main box. The port I am using (6660) is listed as open when I scan ports on the localhost with nmap. However, when I attempt to connect to MPD with ncmpcpp or vimpc from my laptop, the connection is refused. Upon inspection with nmap, the port 6660 is closed when viewed from another computer on the same LAN. This was working correctly prior to a system update a couple months ago. I have checked the relevant dotfiles and the correct ports are specified.

I have tried adding the port to my iptables and accepting TCP connections but have had no success.

What should I try next?Last edited by dartleader on Sat Aug 03, 2019 8:08 pm; edited 1 time in total

----------

## Hu

Please show the output of ss -npl for port 6660 on whichever protocol(s) MPD uses.  If I were to guess, I would say it is bound to localhost, so it can only be reached from localhost.  This is a reasonable security default, so it is possible that upstream changed this on purpose to improve security of the default installation.

----------

## dartleader

Output of ss -npl | ack 6660:

```
tcp  LISTEN 0      0                                       127.0.0.1:6660                   0.0.0.0:*                                                           

tcp  LISTEN 0      0                                           [::1]:6660                         *:*                                                           

```

----------

## Hu

That confirms it.  Your server is now listening on localhost, so the kernel will not permit connections from remote systems.  To fix this, tell MPD to bind to the wildcard address instead of localhost.

----------

## dartleader

 *Hu wrote:*   

> That confirms it.  Your server is now listening on localhost, so the kernel will not permit connections from remote systems.  To fix this, tell MPD to bind to the wildcard address instead of localhost.

 Could you direct me to where I could learn to do that? All the results I've found by searching for wildcards just points me to command-line globbing and wildcard expansion, nothing about IP addresses and config files. I have tried changing the host from "localhost" to "*" without success.

Thank you for your time.

----------

## BT

It seems that MPD 0.21 listens on $XDG_RUNTIME_DIR/mpd/socket by default if no bind_to_address setting exists. See the MPD listeners documentation for more information.

I don't know if MPD can bind to a wildcard address. Instead you can add the following to the MPD configuration file:

```
bind_to_address         "192.168.0.1"
```

Change 192.168.0.1 to the IP address of the system running MPD.

----------

## Hu

If MPD can take a specific address to bind, then passing 0.0.0.0 as the address to bind should be a wildcard bind.

----------

## dartleader

 *Hu wrote:*   

> If MPD can take a specific address to bind, then passing 0.0.0.0 as the address to bind should be a wildcard bind.

 Upon binding the address to 0.0.0.0 in /etc/mpd.conf, I get the following results from ss -npl | ack 6660:

```
tcp  LISTEN 0      0                                         0.0.0.0:6660                   0.0.0.0:*
```

Now my mpd server is working as expected, thank you for your help!

Although, now I am having an unrelated issue with ncmpcpp, addressed in this thread:

https://forums.gentoo.org/viewtopic-t-1100192-highlight-.html[/code]

----------

