Skip to content

Hostname is not registered by DNSMASQ  #43

@electrocucaracha

Description

@electrocucaracha

According to the vagrant-libvirt documentation Libvirt uses DNSMASQ as DHCP service to register the IP addresses to allow East-West Traffic through hostnames.

  • Vagrant v2.2.6
  • vagrant-libvirt v0.0.45
  • Dnsmasq v2.79
  • Libvirt v4.0.0
  • QEMU 2.11.1
Vagrant.configure("2") do |config|
  config.vm.synced_folder '.', '/vagrant', disabled: true
  config.vm.box = 'opensuse/Tumbleweed.x86_64'
  config.vm.box_version = '1.0.20191210'
  ["vm01", "vm02"].each do |vm|
    config.vm.define "#{vm}" do |nodeconfig|
      nodeconfig.vm.hostname = "#{vm}"
    end
  end
end
$ sudo cat /var/lib/libvirt/dnsmasq/virbr?.status
[
  {
    "ip-address": "192.168.121.89",
    "mac-address": "52:54:00:56:a4:36",
    "client-id": "ff:00:56:a4:36:00:01:00:01:25:85:91:3e:52:54:00:56:a4:36",
    "expiry-time": 1576198869
  },
  {
    "ip-address": "192.168.121.135",
    "mac-address": "52:54:00:02:8c:fa",
    "client-id": "ff:00:02:8c:fa:00:01:00:01:25:85:91:3e:52:54:00:02:8c:fa",
    "expiry-time": 1576198869
  }
]
$ vagrant ssh vm01 -- ping -c 3 vm02
PING vm02 (192.168.121.101) 56(84) bytes of data.
From 192.168.121.89 (192.168.121.89) icmp_seq=1 Destination Host Unreachable
From 192.168.121.89 (192.168.121.89) icmp_seq=2 Destination Host Unreachable
From 192.168.121.89 (192.168.121.89) icmp_seq=3 Destination Host Unreachable

--- vm02 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2046ms
pipe 3
$ vagrant ssh vm01 -- ping -c 3 192.168.121.89
PING 192.168.121.89 (192.168.121.89) 56(84) bytes of data.
64 bytes from 192.168.121.89: icmp_seq=1 ttl=64 time=0.028 ms
64 bytes from 192.168.121.89: icmp_seq=2 ttl=64 time=0.062 ms
64 bytes from 192.168.121.89: icmp_seq=3 ttl=64 time=0.027 ms

--- 192.168.121.89 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2041ms
rtt min/avg/max/mdev = 0.027/0.039/0.062/0.016 ms

If I change the Vagrantfile for using a CentOS vagrant box I get the following results.

$ sudo cat /var/lib/libvirt/dnsmasq/virbr?.status
[
  {
    "ip-address": "192.168.121.101",
    "mac-address": "52:54:00:89:6e:61",
    "hostname": "vm02",
    "expiry-time": 1576198670
  },
  {
    "ip-address": "192.168.121.30",
    "mac-address": "52:54:00:4e:92:9b",
    "hostname": "vm01",
    "expiry-time": 1576198670
  }
]
$ vagrant ssh vm01 -- ping -c 3 vm02
PING vm02 (192.168.121.101) 56(84) bytes of data.
64 bytes from vm02 (192.168.121.101): icmp_seq=1 ttl=64 time=0.479 ms
64 bytes from vm02 (192.168.121.101): icmp_seq=2 ttl=64 time=0.471 ms
64 bytes from vm02 (192.168.121.101): icmp_seq=3 ttl=64 time=0.477 ms

--- vm02 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.471/0.475/0.479/0.025 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions