LoginSignup
0
0

Hyper-VでのNATネットワーク作成方法

Posted at

本当にうまくいかず苦労したので備忘録。

参考サイト
https://askme4tech.com/how-create-nat-switch-hyper-v

Windowsターミナルを管理者で立ち上げ。
image.png

Hyper-V に仮想スイッチを作成。
New-VMSwitch -SwitchName "VM-SW01" -SwitchType Internal

NATゲートウェイ作成。
New-NetIPAddress -IPAddress 172.31.1.254 -PrefixLength 24 -InterfaceAlias "vEthernet (VM-SW01)"

NATネットワーク作成
New-NetNat -Name NAT-NW01 -InternalIPInterfaceAddressPrefix 172.31.1.0/24

Ubuntuのネットワーク設定
image.png
image.png

sudo netplan apply

Windowsターミナルで以下のコマンドを打つ。
Get-NetNatSession

なにがしか表示が出れば正常に機能している。
出ないのであれば、設定がおかしい可能性がある。
自分は、Ubuntu側のデフォルトゲートウェイの設定をしていないことが原因でした。そりゃーインターネットにつながらんわ(笑)

あとはSSH接続もやりたいが今のところうまくいっていない

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0