I Need to setup 2 vagrant machine with public network,so follow this link to https://www.vagrantup.com/docs/networking/public_network.html edit the Vagrantfile.
But only one machine only have public static ip. another one not get public static ip.
this is my vagrant machine configuration:
Machine 1 Vagrant File:
Vagrant.configure("2") do |config|
config.vm.box = "man2"
config.ssh.username = "vagrant"
config.vm.hostname = "www.myhost.net"
config.ssh.forward_agent = "true"
config.vm.network "public_network", ip: "192.168.1.10"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=666"]
end
Machine 2 Vagrant File:
Vagrant.configure("2") do |config|
config.vm.box = "man1"
config.ssh.username = "vagrant"
config.vm.hostname = "www.myhost.net"
config.ssh.forward_agent = "true"
config.vm.network "public_network", ip: "192.168.1.20"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=777"]
end
While Vagrant up
System Ask Which interface should the network bridge to?
I Choose Both machie as 1 "eno1"
1) eno1
2) docker0
3) veth54294ac
4) virbr0
5) vethc81d7f7
6) br-08179b343476
7) br-1d45dec94893
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
default: Which interface should the network bridge to? 1
then, Vagrant ssh Both machine
only one machine have public static ip , another machine doesn't show public ip.
if I choose Different Bridge network in any one system some think like: (machine 2) to
1) eno1
2) docker0
3) veth54294ac
4) virbr0
5) vethc81d7f7
6) br-08179b343476
7) br-1d45dec94893
option: 4 (virbro) ot others now, also same issue.
Update 1:
Before I tried Same Setup its working fine, only different Version of Vagrant and VirtualBox
Before Tried:
Fedrora 23
Vagrant 1.8.1
virtualbox 5.0
Now tried:
Fedrora 23
Vagrant 1.8.6
Virtualbox 5.1.6
Any Restrictions in this versions.
Why?
System cannot share same Bridge network ?
Suggest me how to resolve this problem.
Your
Vagrantfile
seems good to me. It may be yourMachine2
IP192.168.1.20
is assigned to other system. if assigned to other system then DHCP will not assign this IP to your machine. if you are sure these IPs not assigned to other system then make itstatic
otherwise you can give like :in This case DHCP will release IP that is available.
No need to write separate
Vagrantfile
for each VM. you can create a singleVagrantfile
for multiple VM like:if you want to up
server1
then doTo up all VM then do
For ssh use like:
yes , it can share bridge network. you can create multiple VM with single bridge.
For more info you can refer Documentation