AntonioMeireles / ClearLinux-packer

Clear Linux guest boxes for Vagrant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hostname is not registered by DNSMASQ service

electrocucaracha opened this issue · comments

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.5
  • vagrant-libvirt v0.0.45
  • Dnsmasq v2.79
  • Libvirt v4.0.0
  • QEMU 2.11.1
File.exists?("/usr/share/qemu/OVMF.fd") ? loader = "/usr/share/qemu/OVMF.fd" : loader = File.join(File.dirname(__FILE__), "OVMF.fd")
if not File.exists?(loader)
  system('curl -O https://download.clearlinux.org/image/OVMF.fd')
end

Vagrant.configure("2") do |config|
  config.vm.synced_folder '.', '/vagrant', disabled: true
  config.vm.box = 'AntonioMeireles/ClearLinux'
  config.vm.box_version = '31130'
  config.vm.provider 'libvirt' do |v|
    v.loader = loader
  end
  ["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.51",
    "mac-address": "52:54:00:bf:89:1c",
    "client-id": "01:52:54:00:bf:89:1c",
    "expiry-time": 1569858772
  },
  {
    "ip-address": "192.168.121.66",
    "mac-address": "52:54:00:1b:7a:34",
    "client-id": "01:52:54:00:1b:7a:34",
    "expiry-time": 1569858772
  }
]
$ vagrant ssh vm01
clear@vm01 ~ $ ping -c 3 vm02
ping: unknown host vm02
clear@vm01 ~ $ ping -c 3 192.168.121.51
PING 192.168.121.51 (192.168.121.51) 56(84) bytes of data.
64 bytes from 192.168.121.51: icmp_seq=1 ttl=64 time=0.385 ms
64 bytes from 192.168.121.51: icmp_seq=2 ttl=64 time=0.478 ms
64 bytes from 192.168.121.51: icmp_seq=3 ttl=64 time=0.476 ms

--- 192.168.121.51 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2031ms
rtt min/avg/max/mdev = 0.385/0.446/0.478/0.046 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.27",
    "mac-address": "52:54:00:7c:bb:b5",
    "hostname": "vm02",
    "expiry-time": 1569860754
  },
  {
    "ip-address": "192.168.121.68",
    "mac-address": "52:54:00:c3:96:4e",
    "hostname": "vm01",
    "expiry-time": 1569860755
  }
]
$ vagrant ssh vm01
[vagrant@vm01 ~]$ ping -c 3 vm02
PING vm02 (192.168.121.27) 56(84) bytes of data.
64 bytes from vm02 (192.168.121.27): icmp_seq=1 ttl=64 time=0.506 ms
64 bytes from vm02 (192.168.121.27): icmp_seq=2 ttl=64 time=0.277 ms
64 bytes from vm02 (192.168.121.27): icmp_seq=3 ttl=64 time=0.450 ms

--- vm02 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.277/0.411/0.506/0.097 m

@electrocucaracha

hi! (sorry lag).

this looks to be an unfortunate side effect of this. looking at getting this right this week.

All the best, (&& thanks for your patience)

António

@electrocucaracha

624135f should have this handled: 31770 box (just uploaded) already consumes the fix and seems to behave as expected. Can you confirm that on your side, and if all OK just close this issue ?

Thanks again for your patience!

All the best,

António

@AntonioMeireles I have checked the change on my Lab environment and it works, thanks for fixing this issue.