とりあえずこれでできた
1. Create Virtual Switch
PS C:\> New-VMSwitch -SwitchName "NAT" -SwitchType Internal
2. Find the interface index
PS C:\> Get-NetAdapter
3. Configure the NAT gateway
PS C:\> New-NetIPAddress -IPAddress 172.16.0.1 -PrefixLength 24 -InterfaceIndex 28
InterfaceIndex の数値は 2で確認した数値を指定
4. Create NAT network
PS C:\> New-NetNat -Name NatNetwork -InternalIPInterfaceAddressPrefix 172.16.0.0/24
5. 仮想マシン上で固定IPを設定
Inside virtual machine you should set up TCP/IPv4 properties for network adapter manually like this:
IP Address:
172.16.0.2 or any other IP up to 172.16.0.254
Subnet mask:
255.255.255.0
Default gateway:
172.16.0.1
DNS server:
Place IP address of DNS server that is used on host network adapter, i.e. 192.168.1.1 or 8.8.8.8
ホストマシンのDNSを指定してあげればOK
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
~~~~
ONBOOT=yes
DEVICE=eth0
IPADDR=172.16.0.123
PREFIX=24
GATEWAY=172.16.0.1
DNS1=1.2.3.4
ZONE=public
~~~~
・・やっぱしWindowsはあんまし好きくない