Skip to content

Instantly share code, notes, and snippets.

@johnrizzo1
Created April 27, 2017 19:56
Show Gist options
  • Save johnrizzo1/7418557026933b66301ebf0d69859adf to your computer and use it in GitHub Desktop.
Save johnrizzo1/7418557026933b66301ebf0d69859adf to your computer and use it in GitHub Desktop.
Vagrant_HyperV Development Notes
HyperV Support
- Get Static IP Working
- Public, Private and External
- Get DHCP Working
- Public and Private but probably not external
- Move network selection to the config.vm.network definition (bridge???) instead of provider options
- Install Linux Integration Services on Linux Guests
- Add obvious provider options such as
HyperV Network Types
- Public Network
- with NAT
- without NAT
- Private Network
- External Network
- they would need to specify which interface is the physical interface if we are creating the network
- Network Selection: This needs to be added if they want to select a specific network
- Do we want to allow them to specify Switch Extensions
Private Networks ----------------------------------------------------------------
Vagrant private networks allow you to access your guest machine by some address that is not
publicly accessible from the global internet. In general, this means your machine gets an address
in the private address space.
IPv4 Support
config.vm.network "private_network", type: "dhcp"
config.vm.network "private_network", ip: "192.168.50.4"
IPv6 Support
config.vm.network "private_network", ip: "fde4:8dba:82e1::c4"
config.vm.network "private_network", ip: "fde4:8dba:82e1::c4", netmask: "96"
Disable Auto-Configuration
config.vm.network "private_network", ip: "192.168.50.4", auto_config: false
Port Forwarding ----------------------------------------------------------------
Defining a Forward Port
config.vm.network "forwarded_port", guest: 80, host: 8080
This will allow accessing port 80 on the guest via port 8080 on the host
Other Port Forwarding Options
- auto_correct (boolean)
- guest (int)
- gust_ip (string)
- host (int)
- host_ip (string)
- protocol (string)
- id (string)
Forward Port Protocols
config.vm.network "forwarded_port", guest: 2003, host: 12003, protocol: "tcp"
config.vm.network "forwarded_port", guest: 2003, host: 12003, protocol: "udp"
Port Collisions
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
Public Networks ----------------------------------------------------------------
Vagrant public networks are less private than private networks, and the exact meaning actually
varies from provider to provider, hence the ambiguous definition. The idea is that while private
networks should never allow the general public access to your machine, public networks can.
config.vm.network "public_network", use_dhcp_assigned_default_route: true
Static IP
config.vm.network "public_network", ip: "192.168.0.17"
Default Network Interface
config.vm.network "public_network", bridge: "en1: Wi-Fi (AirPort)"
config.vm.network "public_network", bridge: [
"en1: Wi-Fi (AirPort)",
"en6: Broadcom NetXtreme Gigabit Ethernet Controller",
]
Disable Auto-Configuration
config.vm.network "public_network", auto_config: false
HyperV Specific Configuration ----------------------------------------------------------------
config.vm.provider "hyperv" do |h|
h.vmname (string)
### CPU
h.cpus (integer)
# virtual machine reserve (pct, defaults 0)
# virtual machine limit (pct, defaults 100)
# relative weight (pct, defaults 100)
### Memory
h.memory (integer)
h.maxmemory (integer)
# Dynamic Memory (boolean)
# Memory buffer (%)
# Memory Weight
h.enable_virtualization_extensions (boolean) # I have to look at this a bit more since I can't
# figure out what it maps to in HyperV
# I think it has to be done using the powershell
# modules.
### Networking (many of these only make sense on the interface definition
# so it probably makes sense to put them there.)
h.vlan_id (integer)
# Enable bandwidth management (boolean)
# minimum bandwidth (integer)
# maximum bandwidth (integer)
# Enable Virtual Machine Queue (boolean, default true)
# Enable IPsec task offloading (integer, range 1-4096, default 512)
h.mac (string)
# enable mac address spoofing (boolean, default false)
# enable dhcp guard (boolean, default false)
# enable router advertisement guard (boolean, default false)
# protected network (boolean, default true)
# port mirroring mode (default none, options Destination or Source)
# nic teaming (boolean, default false)
# device naming (boolean, default false)
h.ip_address_timeout (integer)
### Storage Options
h.differencing_disk (boolean)
h.vm_integration_services = {
guest_service_interface: true,
heartbeat: true,
key_value_pair_exchange: false,
shutdown: true,
time_synchronization: true,
vss: true
# data exchange is this key_value_pair_exchange
# backup? is this vss
}
# Snapshots???
# Specify Generation 1 or 2
# Enable/Disable Secure Boot
# Set the secure boot template
# Microsoft Windows, Microsoft UEFI Certificate Authority, Open Source Shielded VM
# Encryption Support
# Enable Trusted Platform Module
# Encrypt state and virtual machine migration traffic
# Enable Shielding
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment