12

I'm running dnsmasq,

address=/chat.freenode.net/130.239.18.172
address=/chat.freenode.net/140.211.167.105

But seems dnsmasq only recognize the last record, what should I do?

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
daisy
  • 53,527
  • 78
  • 236
  • 383

3 Answers3

17

Create a file, say /etc/hosts.chat.freenode.net, that has the same format as /etc/hosts file and list all IP addresses with name in this file:

130.239.18.172 chat.freenode.net
140.211.167.105 chat.freenode.net

Then add to the dnsmasq.conf the following line:

addn-hosts=/etc/hosts.chat.freenode.net

Or put these two lines into /etc/hosts if dnsmasq is set to read in the /etc/hosts.

Then restart dnsmasq

Enjoy.

Serge
  • 8,371
  • 2
  • 23
  • 28
  • Yep, easier to maintain – daisy Nov 24 '12 at 06:43
  • I guess the only problem with using `/etc/hosts` would be that the local machine would always resolve the first one instead of getting a round-robin distribution from dnsmasq. – Jeff Puckett Apr 05 '17 at 22:04
  • 1
    @JeffPuckettII although resolver library would return the first found entry always, the answer is related to the setting `dnsmasq` to read `/etc/hosts` – Serge Apr 07 '17 at 10:07
6

Okay, after nearly 10 years, the setting in the question post is now valid since dnsmasq 2.86 release.

address=/chat.freenode.net/130.239.18.172
address=/chat.freenode.net/140.211.167.105

$ host chat.freenode.net 10.0.0.53
Using domain server:
Name: 10.0.0.53
Address: 10.0.0.53#53
Aliases:

chat.freenode.net has address 140.211.167.105
chat.freenode.net has address 130.239.18.172
jch
  • 61
  • 1
  • 1
-4

Copy the existing ifcfg-etho to ifcfg-eth0:0 and change the existing IP to your virtual IP (the one you want to add).

It can be found at /etc/sysconfig/network-scripts.

Restart the network and try to ping the virtual IP.

pconcepcion
  • 300
  • 3
  • 11
Amigo
  • 1