Skip to content

Instantly share code, notes, and snippets.

@arton
Created July 5, 2016 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arton/3712ca25c745de8e45d877b78543813f to your computer and use it in GitHub Desktop.
Save arton/3712ca25c745de8e45d877b78543813f to your computer and use it in GitHub Desktop.
Create NAT
Windows 2012 R2のHyper-V用NAT
New-VMSwitch -SwitchName "Hyper-V-Switch" - SwitchType Internal
Get-NetIPAddress -InterfaceAlias "vEthernet (Hyper-V-Switch)"
IPAddress : 169.254.141.105 ……… 適当なものが振られる
InterfaceIndex : n ………………… 後で使う
InterfaceAlias : vEthernet (Hyper-V-Switch)
AddressFamily : IPv4
Type : Unicast
PrefixLength : 16
……
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex n
IPAddress : 192.168.0.1
InterfaceIndex : n
InterfaceAlias : vEthernet (Hyper-V-Switch)
AddressFamily : IPv4
Type : Unicast
……
New-NeNnat -Name Hyper-V-NAT -ExternalIPInterfaceAddressPrefix 外部IPアドレス/32
... InternalIPInterfaceAddressPrefixではない
Add-NetNatExternalAddress -Natname Hyper-V-NAT -IPAddress 外部IPアドレス
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment