Quantcast
Viewing all articles
Browse latest Browse all 11

Configuring NAT for Hyper-V VMs

# Create new switch  
New-VMSwitch -SwitchName NAT -SwitchType Internal
Image may be NSFW.
Clik here to view.

# You can find the interface index by running: Get-NetAdapter

Image may be NSFW.
Clik here to view.

# Run the following to create the NAT Gateway:

New-NetIPAddress -IPAddress 192.168.4.1 -PrefixLength 24 -InterfaceIndex 53
Image may be NSFW.
Clik here to view.

# Configure the NAT network

New-NetNat -Name NAT -InternalIPInterfaceAddressPrefix “192.168.4.0/24”
Image may be NSFW.
Clik here to view.

# Add a static mapping to a NAT

A static mapping enables an incoming connection from an external network to access a host on an internal network through the NAT.


Add-NetNatStaticMapping -NatName NAT -Protocol TCP -ExternalIPAddress "0.0.0.0/24" -ExternalPort 80 -InternalIPAddress "192.168.4.20" -InternalPort 80
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 11

Trending Articles