2025-08-03 11:54:46 +01:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
|
|
|
|
|
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
|
|
|
|
# configures the configuration version (we support older styles for
|
|
|
|
|
# backwards compatibility). Please don't change it unless you know what
|
|
|
|
|
# you're doing.
|
|
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
|
# VM 1 Configuration
|
|
|
|
|
config.vm.define "vm1" do |vm1|
|
2025-08-04 21:44:28 +01:00
|
|
|
vm1.vm.box = "ubuntu/jammy64"
|
2025-08-03 11:54:46 +01:00
|
|
|
|
|
|
|
|
# run ip link to list network interfaces on linux
|
|
|
|
|
# run ipconfig to list network interfaces on Windows
|
|
|
|
|
# Example output:
|
|
|
|
|
# Ethernet adapter vEthernet (WSL):
|
|
|
|
|
# Connection-specific DNS Suffix . :
|
|
|
|
|
# IPv6 Address. . . . . . . . . . . : fe80::xxxx:xxxx:xxxx:xxxx%xx
|
|
|
|
|
# IPv4 Address. . . . . . . . . . . : 192.168.x.x
|
|
|
|
|
# Subnet Mask . . . . . . . . . . . :
|
|
|
|
|
# on macOS, run ifconfig to list network interfaces
|
|
|
|
|
# Example output:
|
|
|
|
|
# en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
|
|
|
|
# options=400<LINKSTATE>
|
|
|
|
|
# ether xx:xx:xx:xx:xx:xx
|
|
|
|
|
# inet6 fe80::xxxx:xxxx:xxxx:xxxx%en0 prefixlen 64 scopeid 0x4
|
|
|
|
|
# inet 192.168.x.x netmask 0xffffff00 broadcast 192.168.x.255
|
|
|
|
|
|
|
|
|
|
# This configuration sets up a private network for inter-VM communication
|
|
|
|
|
# and a public network for external access.
|
|
|
|
|
# The private network uses DHCP to assign IP addresses automatically.
|
|
|
|
|
# Private network for inter-VM communication using DHCP
|
|
|
|
|
|
|
|
|
|
# Uncomment the following line to use a specific network interface for the public network
|
|
|
|
|
# and replace "wlp0s20f3" with your actual network interface name.
|
2025-08-04 21:44:28 +01:00
|
|
|
vm1.vm.network "public_network", bridge: "wlp0s20f3"
|
2025-08-03 11:54:46 +01:00
|
|
|
|
|
|
|
|
vm1.vm.network "private_network", type: "dhcp"
|
|
|
|
|
|
|
|
|
|
vm1.vm.provider "virtualbox" do |vb|
|
|
|
|
|
vb.memory = "2048" # 2GB memory
|
|
|
|
|
vb.cpus = 2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vm1.vm.provision "shell", inline: <<-SHELL
|
|
|
|
|
sudo apt-get update
|
2025-08-04 21:44:28 +01:00
|
|
|
sudo apt-get install -y software-properties-common python3-pip python3-apt jq
|
|
|
|
|
# python3 -m pip install --upgrade pip
|
2025-08-03 11:54:46 +01:00
|
|
|
SHELL
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# VM 2 Configuration
|
|
|
|
|
config.vm.define "vm2" do |vm2|
|
2025-08-04 21:44:28 +01:00
|
|
|
vm2.vm.box = "ubuntu/jammy64"
|
2025-08-03 11:54:46 +01:00
|
|
|
|
|
|
|
|
# Private network for inter-VM communication using DHCP
|
|
|
|
|
vm2.vm.network "private_network", type: "dhcp"
|
|
|
|
|
|
|
|
|
|
# Public network for external access
|
|
|
|
|
vm2.vm.network "public_network", bridge: "wlp0s20f3"
|
|
|
|
|
|
|
|
|
|
vm2.vm.provider "virtualbox" do |vb|
|
|
|
|
|
vb.memory = "2048" # 2GB memory
|
|
|
|
|
vb.cpus = 2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vm2.vm.provision "shell", inline: <<-SHELL
|
|
|
|
|
sudo apt-get update
|
2025-08-04 21:44:28 +01:00
|
|
|
sudo apt-get install -y software-properties-common python3-pip python3-apt jq
|
|
|
|
|
# python3 -m pip install --upgrade pip
|
2025-08-03 11:54:46 +01:00
|
|
|
SHELL
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# VM 3 Configuration
|
|
|
|
|
config.vm.define "vm3" do |vm3|
|
2025-08-04 21:44:28 +01:00
|
|
|
vm3.vm.box = "ubuntu/jammy64"
|
2025-08-03 11:54:46 +01:00
|
|
|
|
|
|
|
|
# Private network for inter-VM communication using DHCP
|
|
|
|
|
vm3.vm.network "private_network", type: "dhcp"
|
|
|
|
|
|
|
|
|
|
# Public network for external access
|
|
|
|
|
vm3.vm.network "public_network", bridge: "wlp0s20f3"
|
|
|
|
|
|
|
|
|
|
vm3.vm.provider "virtualbox" do |vb|
|
|
|
|
|
vb.memory = "2048" # 2GB memory
|
|
|
|
|
vb.cpus = 2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vm3.vm.provision "shell", inline: <<-SHELL
|
|
|
|
|
sudo apt-get update
|
2025-08-04 21:44:28 +01:00
|
|
|
sudo apt-get install -y software-properties-common python3-pip python3-apt jq
|
|
|
|
|
# python3 -m pip install --upgrade pip
|
2025-08-03 11:54:46 +01:00
|
|
|
SHELL
|
|
|
|
|
end
|
|
|
|
|
end
|