# [SOLVED] dnsmasq oddity

## rainer

I'm running into various problems with a cups server I'm setting up (https://forums.gentoo.org/viewtopic-t-803332.html) but incidentally I found out that it may be a result of me running dnsmasq. What I discovered, and I want to ask you guys who know much better than I do    :Wink:  :

Is it possible that my dnsmasq server takes its own /etc/hosts file which is

```

# IPv4 and IPv6 localhost aliases

127.0.0.1       localhost fitpc

192.168.1.2     fitpc

::1             localhost ip6-localhost ip6-loopback fitpc

```

and, on this basis tells all machines on the network to set up another alias fitpc for themselves? I.e. I have a machine called "godesberg". When I ssh 192.168.1.2 godesberg dutifully connects to the dnsmasq server. If I ssh fitpc, godesberg gets connected to itself, i.e. 127.0.0.1! I have observed the same behavious on another computer on the network.

But can it really be true?   :Rolling Eyes:    It can be rather easily solved (I think), but before I start messing around with config files, potentially upsetting other users, I'd rather confirm that my observation makes sense.

Thanks,

RainerLast edited by rainer on Sun Nov 22, 2009 7:38 am; edited 1 time in total

----------

## erik258

it's probably not that it's telling every machine on the network that they are fitpc.  Rather, it's resolving fitpc to the ip 127.0.0.1 for everyone, thereby pointing them back at their own computers.

If /etc/hosts is the source of the problem (and it may be) you could remove fitpc from the localhost line, leaving it on the 192.168.1.2 line.  

The problem may also be caused by a line analagous to 

```
127.0.0.1       localhost fitpc 
```

 in a different dnsmasq file, but it's been many years since I migrated from dnsmasq to bind, so I'm afraid I can't recall exactly what files might be involved.

----------

## rainer

 *Quote:*   

> it's probably not that it's telling every machine on the network that they are fitpc. Rather, it's resolving fitpc to the ip 127.0.0.1 for everyone, thereby pointing them back at their own computers. 

 

I think that is what I meant - sorry for the bad expression.

In the meantime, the /etc/hosts file says - and that is what you suggest

```
127.0.0.1       localhost

192.168.1.2     fitpc
```

and everything works perfectly as it should. I have two more dnsmasq configuration files, but no reference to fitpc or 127..0.0.1, so no problem.

I was wondering whether this behaviour of dnsmasq is a bug or not. I googled a little but did not really find anything, and since it works now, I somewhat lost the drive. But still...

----------

## erik258

 *Quote:*   

> I was wondering whether this behaviour of dnsmasq is a bug or not. I googled a little but did not really find anything, and since it works now, I somewhat lost the drive. But still...

 

I don't think so.  I think dnsmasq uses /etc/hosts to resolve local names.  You said that the address of fitpc was 127.0.0.1, and it dutifully followed your directions and told everyone else that.  Misconfiguration issue.

----------

