Ubuntu 18.04 VMをVirtual Box Natネットワークに接続する

Ubuntu 18.04 VMをVirtual Box Natネットワークに接続する

VirtualBox Nat Networkingを使用して仮想マシンネットワークを設定しようとしています。一部の VM、特に Coreos ボックスと Metasploitable クラスターはよく接続されています。他のもの、特に私が自分で設定したUbuntu仮想マシンはそうではありません。

NATネットワーク設定は次のとおりです

$ VBoxManage natnetwork list fabian
NAT Networks:

Name:        fabian
Network:     172.17.8.0/24
Gateway:     172.17.8.1
IPv6:        No
Enabled:     Yes

/etc/network/interfacesUbuntu vmsファイルを読むために編集してみました。

# interface(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

# network interface
auto enp0s3
iface enp0s3 inet dhcp

/etc/network/interfaces(この部分は、ネットワークによく接続されているように見えるUbuntuベースの仮想マシンであるMetasploitableのファイルに基づいています。)

ただし、実行しようとすると停止$ sudo systemctl restart networkingし、タイムアウトします。以下に出力を含めました$ journalctl -xe。以前はいくつかの項目が含まれていましたが、メッセージは同じですが、間隔が異なるようです。

ネットワークインターフェイスを設定するために接続するときに何か抜けましたか?

Oct 23 10:22:49 burp-vm systemd-resolved[290]: Using degraded feature set (UDP) for DNS server 8.8.8.8.
Oct 23 10:22:52 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 20 (xid=0x6914771e)
Oct 23 10:22:52 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 20 (xid=0x6914771e)
Oct 23 10:22:54 burp-vm systemd-resolved[290]: Using degraded feature set (UDP) for DNS server 8.8.4.4.
Oct 23 10:23:12 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 9 (xid=0x6914771e)
Oct 23 10:23:12 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 9 (xid=0x6914771e)
Oct 23 10:23:21 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 9 (xid=0x6914771e)
Oct 23 10:23:21 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 9 (xid=0x6914771e)
Oct 23 10:23:30 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:23:30 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:23:42 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:23:42 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:23:54 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 11 (xid=0x6914771e)
Oct 23 10:23:54 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 11 (xid=0x6914771e)
Oct 23 10:24:05 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 15 (xid=0x6914771e)
Oct 23 10:24:05 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 15 (xid=0x6914771e)
Oct 23 10:24:20 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 21 (xid=0x6914771e)
Oct 23 10:24:20 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 21 (xid=0x6914771e)
Oct 23 10:24:39 burp-vm systemd-resolved[290]: Using degraded feature set (TCP) for DNS server 8.8.8.8.
Oct 23 10:24:39 burp-vm systemd-resolved[290]: Using degraded feature set (TCP) for DNS server 8.8.4.4.
Oct 23 10:24:41 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 7 (xid=0x6914771e)
Oct 23 10:24:41 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 7 (xid=0x6914771e)
Oct 23 10:24:48 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:24:48 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:25:00 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 10 (xid=0x6914771e)
Oct 23 10:25:00 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 10 (xid=0x6914771e)
Oct 23 10:25:10 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:25:10 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 12 (xid=0x6914771e)
Oct 23 10:25:22 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 11 (xid=0x6914771e)
Oct 23 10:25:22 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 11 (xid=0x6914771e)
Oct 23 10:25:33 burp-vm dhclient[1889]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x6914771e)
Oct 23 10:25:33 burp-vm ifup[1867]: DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x6914771e)
Oct 23 10:25:35 burp-vm systemd[1]: networking.service: Start operation timed out. Terminating.
Oct 23 10:25:35 burp-vm systemd[1]: networking.service: Main process exited, code=killed, status=15/TERM
Oct 23 10:25:35 burp-vm systemd[1]: networking.service: Failed with result 'timeout'.
Oct 23 10:25:35 burp-vm systemd[1]: Failed to start Raise network interfaces.

ベストアンサー1

Ubuntu 17.10以降、このifupdownツールは廃止予定のツールと見なされ、置き換えられましたnetplan。このパッケージを使用するには、インストールする必要があります/etc/network/interfacesifupdown

あなたの場合は、次のツールを使用してネットワークを設定する必要がありますnetplan

設定ファイルは以下にあります/etc/netplan/。次のようにファイルを作成/編集します*.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true

ネットワーク管理者がインストールされている場合は、次のものrenderer: networkdと交換できます。renderer: NetworkManager

次に、次を実行します。

sudo netplan generate
sudo netplan apply

望むより:

Netplan 構成例

Netplanへの移行

おすすめ記事