我正在使用Vagrant管理多个虚拟机.网络配置为私有,已设置IP地址并分配主机名.如下面的Vagrantfile所示.
虚拟机可以通过IP地址相互通信,但我想知道如何允许虚拟机使用其分配的主机名进行通信.即如何从中完成ping comtest2
工作comtest1
?
Vagrantfile:
Vagrant.configure("2") do |config| config.vm.define "comtest1" do |comtest1| comtest1.vm.box = "precise32" comtest1.vm.hostname = "comtest1" comtest1.vm.network "private_network", ip: "192.168.10.21" end config.vm.define "comtest2" do |comtest2| comtest2.vm.box = "precise32" comtest2.vm.hostname = "comtest2" comtest2.vm.network "private_network", ip: "192.168.10.22" end end
mestachs.. 16
用https://github.com/adrienthebo/vagrant-hosts欺骗dns解决方案?
用https://github.com/adrienthebo/vagrant-hosts欺骗dns解决方案?
你可以使用Zeroconf.它在网络中广播主机名,并使其可供本地网络上的其他主机使用.这样您就可以使用test1.local,test2.local等访问您的主机.
只要安装avahi-daemon
和libnss-mdns
!