How to emulate Internet in multi machine environment with Vagrant -


I am creating a frequency multi-machine configuration file. Here's a part:

  Vagrant.configure (2) do | Config | Config.vm.box = "chef / cents -7.0" config.vm.define "radius" do | Radius | Radius.vm.hostname = "radius-server" end config.vm.define "mysql" do | Mysql | Mysql.vm.hostname = "mysql-server" end end  

How can I simulate the situation in which the above two virtual machines are different from the internet by different networks? I could create two separate private networks, which contained two separate private IP addresses such as 192.68.1.3 for the first virtual machine and 192.168.2.3 for the second virtual machine. In this case machines will be in different networks. But can they talk to each other?

Yes, they can talk.

Router (Mini) acts as the Internet:

  acts as the network:  = [192.168.1.3] & lt; = & Gt; [*. * 1.1] = router = [*. * 2.1] & lt; = & Gt; [192.168.2.3] = b  

Description

The easiest way is because it has IP addresses on both of these networks to assign a router role to physical host (I think they are in 192.168.1.1 and 192.168.2.1 in your example). Otherwise, they are just numbers and if Wagront does not complain, then the network will work from public categories with IP address (be careful to disconnect the physical network for clear testing).

  • Just enable physical navigation in the OS routing (forwarding).
  • And make sure the routes are configured on each virtual machine for each other through this router:

      A shell & gt; IP path 192.168.1.1b shell and gt; IP Route defaults to 192.168.2.1  

Note: Technically, because network private IP addresses They are not roulette, they are not roulette (AFAIK, the real internet router packets leave them with these private IP addresses, while home router nets them). Note that VMs are connected to two different networks by using

task Vagrant file

test example libvirt / P>

  VAGRANTFILE_API_VERSION = "2" Vagrant.configure (VAGRANTFILE_API_VERSION) tax | Config | Config.vm.provider "libvirt" config.vm.define "rhel7_minion" do | Rhel7_minion | Rhel7_minion.vm.box = "uvsmtid / CentOS-7.1-1503-GNOME" rhel7_minion.vm.synced_folder, '/ awara', disabled: true rhel7_minion.vm.network 'private_network' ,: '.' Libvirt__network_name = & gt; 'Primary_vagrant_private_net', IP: '192.168.1.2' ,: libvirt__netmask = & gt; '255.255.255.0' ,: libvirt__forward_mode = & gt; 'Route' ,: libvirt__dhcp_enabled = & gt; Do the true end config.vm.define "rhel5_minion". Rhel5_minion | Rhel5_minion.vm.box = "uvsmtid / CentOS-5.5- at least" rhel5_minion.vm.synced_folder, '/ awara', disabled: true rhel5_minion.vm.network 'private_network' ,: '.' Libvirt__network_name = & gt; 'Secondary_vagrant_private_net', IP: '192.168.2.3' ,: libvirt__netmask = & gt; '255.255.255.0' ,: libvirt__forward_mode = & gt; 'Route' ,: libvirt__dhcp_enabled = & gt; True end stop  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -