Skip to content

Instantly share code, notes, and snippets.

@da5is
Created January 23, 2021 03:24
Show Gist options
  • Save da5is/65b56a2a133478a7b1bfb35f757daa5f to your computer and use it in GitHub Desktop.
Save da5is/65b56a2a133478a7b1bfb35f757daa5f to your computer and use it in GitHub Desktop.

VM Creation

  • E2s_v4 - approximate cost is 159.14 / month
  • Diagnostics account: storagehypervguestdiags
  • Add home IP address to NSG

VM Configuration

PS C:\Users\matt> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
vEthernet (InternalNAT)   Hyper-V Virtual Ethernet Adapter           *12* Up           00-15-5D-00-04-00        10 Gbps
Ethernet                  Microsoft Hyper-V Network Adapter             4 Up           00-0D-3A-13-5B-41        50 Gbps
  • Add internal network address to the internal NAT switch created previously - New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex 12 - this defines the gateway as being 192.168.0.1 and the internal network being 192.168.0.0/24
PS C:\Users\matt> New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex 12

IPAddress         : 192.168.0.1
InterfaceIndex    : 12
InterfaceAlias    : vEthernet (InternalNAT)
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Tentative
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

IPAddress         : 192.168.0.1
InterfaceIndex    : 12
InterfaceAlias    : vEthernet (InternalNAT)
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Invalid
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : PersistentStore
  • Create the NAT network that matches the ip addresses that are used above - New-NetNat -Name "InternalNat" -InternalIPInterfaceAddressPrefix 192.168.0.0/24
PS C:\Users\matt> New-NetNat -Name "InternalNat" -InternalIPInterfaceAddressPrefix 192.168.0.0/24

Name                             : InternalNat
ExternalIPInterfaceAddressPrefix :
InternalIPInterfaceAddressPrefix : 192.168.0.0/24
IcmpQueryTimeout                 : 30
TcpEstablishedConnectionTimeout  : 1800
TcpTransientConnectionTimeout    : 120
TcpFilteringBehavior             : AddressDependentFiltering
UdpFilteringBehavior             : AddressDependentFiltering
UdpIdleSessionTimeout            : 120
UdpInboundRefresh                : False
Store                            : Local
Active                           : True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment