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?

3 Answers 3

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.

3
  • Yep, easier to maintain
    – daisy
    Nov 24, 2012 at 6: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. Apr 5, 2017 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 7, 2017 at 10:07
9

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
1
  • This is the way. (in 2023) Oct 14, 2023 at 0:19
-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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .