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/interfaces읽기 위해 Ubuntu 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(이 부분은 네트워크에 잘 연결된 것으로 보이는 우분투 기반 가상 머신인 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/interfaces.ifupdown

귀하의 경우에는 다음 도구를 사용하여 네트워크를 구성해야 합니다 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으로 마이그레이션

관련 정보