27
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Virtualboxのホストオンリーアダプターvboxnet0について知る

Last updated at Posted at 2014-09-09
  • Virtualboxのホストオンリーアダプターはvboxnet0を通して通信する。
  • Vagrantfileに以下設定している場合、vboxnet0と192.168.33.10は同一ネットワークアドレスにいる必要がある。
  config.vm.network "private_network", ip: "192.168.33.10"
vboxnet一覧を表示
$ VBoxManage list -l hostonlyifs
Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
DHCP:            Disabled
IPAddress:       192.168.33.1
NetworkMask:     255.255.255.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet0

Name:            vboxnet1
GUID:            786f6276-656e-4174-8000-0a0027000001
DHCP:            Disabled
IPAddress:       192.168.43.1
NetworkMask:     255.255.255.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:01
MediumType:      Ethernet
Status:          Down
VBoxNetworkName: HostInterfaceNetworking-vboxnet1

IPAddress欄を参考。

vboxnet1を削除

VBoxManage hostonlyif remove vboxnet1

vboxnet1を作成

VBoxManage hostonlyif create

ホストOSがmacの場合

  • ゲストOSのIPに、ホストOSのvboxnet0と同一サブネットに割り振る
ホストOSがmacの場合
$ /sbin/ifconfig vboxnet0
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 0a:00:27:00:00:00
	inet 192.168.33.1 netmask 0xffffff00 broadcast 192.168.33.255
  • 上記よりホストOSのmacのvboxnet0のIPが192.168.33.1/24だとわかる。

  • http://192.168.33.10/ にアクセスしページが見れることを確認。

ホストOSがCentOS7の場合

ホストOSがCentOS7の場合
$ ip -f inet addr show vboxnet0
4: vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    inet 192.168.56.101/24 brd 192.168.56.255 scope global dynamic vboxnet0
       valid_lft 896sec preferred_lft 896sec
  • 上記よりホストOSのCentOS7のvboxnet0のIPが192.168.56.101/24だとわかる。
Vagrantfile
+  config.vm.network "private_network", ip: "192.168.56.10"
27
29
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
27
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?