LoginSignup
1
1

More than 5 years have passed since last update.

Debian+VirtualBoxでNAT接続出来ないので状況メモ

Posted at

よくわからんので現状を整理。なんでかなー。

概要

Windows 8にVirtualBoxをインストールし、Debian環境を準備した。VMにホストオンリーアダプターを追加、設定したところ、外部ネットワークに繋がらなくなった。

設定

Windows 8.1

  • 最近「Windowsのリフレッシュ」を行ったばかり

VirtualBox

  • v4.3.6
    • v4.0, 4.2も試したけど状況変わらず
  • ホストオンリーネットワークを一つ作成済み
  • IPv4 192.168.56.1,_ 255.255.255.0
  • DHCP無効
    • 有効にしても変わらない

VM

  • アダプター1: (初期設定のまま)
    • NAT
    • ケーブル接続: ON
  • アダプター2: (割り当て以外は初期設定のまま)
    • ホストオンリーアダプター
    • VirtualBox Host-Only Ethernet Adapter
    • プロミスキャスト: 拒否
    • ケーブル接続: ON

Debian

  • v7.3 (Wheezy)
  • 最初にbasic system tools(だっけ?)のみ選択してインストール

/etc/network/interfacesの設定

末尾にホストオンリーアダプターの設定を追加したのみ。

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet static
  address 192.168.56.101
  netmask 255.255.255.0
  gateway 192.168.56.1

状況

  • 外部ネットワークに接続出来ない
    • ping example.comでunknown host
    • eth1をdhcpにすると繋がる
    • eth1を設定しないと繋がる
  • ホストオンリーは繋がる
    • SSHとか出来る
    • ホスト側のウェブブラウザーからApacheに繋がる
    • eth1をdhcpにするとIPv6は発行されるのにIPv4が発行されない(それはそれで謎)
  • ちなみに起動時"Starting MTA"が遅い。ネットワークのタイムアウトを待ってる風。

pingとか

ginpei@debian:~$ ping example.com
ping: unknown host example.com
ginpei@debian:~$ traceroute example.com
example.com: Name or service not known
Cannot handle "host" cmdline arg `example.com' on position 1 (argc 1)

ifconfigの結果

root@debian:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:7f:ce:63
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe7f:ce63/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1180 (1.1 KiB)  TX bytes:1152 (1.1 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:e3:04:28
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fee3:428/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:199 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18571 (18.1 KiB)  TX bytes:20350 (19.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
1
1
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
1
1