Skip to content

Instantly share code, notes, and snippets.

View Pristavkin's full-sized avatar

Alexey Pristavkin Pristavkin

  • 07:31 (UTC +03:00)
View GitHub Profile
@Pristavkin
Pristavkin / hyper-v-static-ip.md
Last active July 26, 2022 11:41 — forked from mzaglia/hyper-v-static-ip.md
Static IP Hyper-V Ubuntu VM

First in a powershell create a new network switch

New-VMSwitch -SwitchName "Hyper-V [VM NAT]" -SwitchType Internal
Get-NetAdapter       // (note down ifIndex of the newly created switch as INDEX)
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex <INDEX>
New-NetNat -Name HyperV-NATnetwork -InternalIPInterfaceAddressPrefix 192.168.0.0/24

In your ubuntu server open your network netplan