LoginSignup
26

More than 5 years have passed since last update.

VirtualBox上のUbuntuでNAT+ホストオンリーネットワーク構成にするメモ

Last updated at Posted at 2015-02-23

さいきんUbuntu Server 14.04LTS環境をVirtualBox上に作りました。このような仮想環境上のLinuxのネットワーク設定は仮想NICを2個使ってNATアダプタ+ホストオンリーアダプタで運用するのが最適解だと思います。以下なども参照のこと。

しかしUbuntuの場合(?)は勝手にeth1を有効にしてくれないので、設定変更しないとホストオンリーネットワークが使えません。そこで/etc/network/interfaces末尾に次のように設定します。

auto eth1
iface eth1 inet static
address 192.168.56.99
netmask 255.255.255.0

VirtualBoxのホストオンリーアダプタの初期設定では192.168.56.2から192.168.56.99が固定IPで割り当てて良い場所になっているので、その範囲で好きなIPアドレスに設定すると良いでしょう。

上記設定をして再起動すればホストマシンから特定のVMにsshできる環境の完成です。

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
26