우선, 저의 서투른 영어 실력에 대해 사과드리고 싶습니다.
나는 보통 몇 시간, 며칠, 심지어 몇 주 동안 연구한 후에 답을 찾지만, 오늘은 길을 잃은 기분이고 도움이 필요하다고 생각합니다.
표적:
내 목표는 Netplan과 브리지 인터페이스를 설정하는 것입니다. 이 브리지 인터페이스는 DHCP를 통해 게스트 운영 체제(KVM)에 IP 주소를 제공합니다.
질문:
내 게스트 운영 체제가 브리지 인터페이스를 통해 연결을 설정할 수 없습니다. Netplan의 구성이나 게스트 운영 체제를 설치하는 데 사용되는 매개 변수로 인해 문제가 발생할 수 있습니다.
문맥:
내 서버는 외부 공급자가 호스팅하는 클라우드 서버인 Ubuntu Bionic 18.04 LTS를 실행하고 있습니다. 설치하려는 게스트 운영 체제도 Ubuntu Bionic 18.04 LTS 릴리스입니다. 내 서버는 하드웨어 가상화를 지원하며 하드웨어 가속 KVM 가상 머신을 실행할 수 있습니다.
호스트 운영 체제의 초기 네트워크 상태:
출력은 ifconfig -a
다음과 같습니다
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.52.16.185 netmask 255.255.255.0 broadcast 10.52.16.255
inet6 fe80::f816:3eff:fe82:c5fe prefixlen 64 scopeid 0x20<link>
inet6 2001:1600:4:8:f816:3eff:fe82:c5fe prefixlen 64 scopeid 0x0<global>
ether fa:16:3e:82:c5:fe txqueuelen 1000 (Ethernet)
RX packets 255880 bytes 22882442 (22.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 582 bytes 49337 (49.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 138 bytes 10546 (10.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 138 bytes 10546 (10.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
출력은 ip route
다음과 같습니다
default via 10.52.16.1 dev ens3 proto dhcp metric 100
10.52.11.0/24 dev ens3 proto dhcp scope link metric 100
10.52.16.0/24 dev ens3 proto kernel scope link src 10.52.16.185
10.52.20.0/24 dev ens3 proto dhcp scope link metric 100
10.52.24.0/24 dev ens3 proto dhcp scope link metric 100
169.254.169.254 via 10.52.16.1 dev ens3 proto dhcp metric 100
출력은 lspci
다음과 같습니다
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
$ networkctl -a 상태
● 1: lo
Link File: /lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
State: carrier (unmanaged)
Address: 127.0.0.1
::1
● 2: ens3
Link File: /lib/systemd/network/99-default.link
Network File: /run/systemd/network/10-netplan-ens3.network
Type: ether
State: routable (configured)
Path: pci-0000:00:03.0
Driver: virtio_net
Vendor: Red Hat, Inc.
Model: Virtio network device
HW Address: fa:16:3e:82:c5:fe
Address: 10.52.16.185
2001:1600:4:8:f816:3eff:fe82:c5fe
fe80::f816:3eff:fe82:c5fe
Gateway: 10.52.16.1
fe80::f816:3eff:fee7:1ea5
DNS: XX.XX.XX.XX
YY.YY.YY.YY
Search Domains: myprovider.ext
지금까지 내가 한 일:
첫 번째 단계는 브리지 인터페이스를 생성하는 것입니다 br0
. Ubuntu 18을 실행하고 있기 때문에~해야 한다이를 위해 Netplan을 사용하십시오.
Netplan의 초기 구성은 다음 /etc/netplan/50-cloud-init.yaml
과 같습니다.
network:
version: 2
ethernets:
ens3:
dhcp4: true
match:
macaddress: fa:16:3e:82:c5:fe
mtu: 8950
set-name: ens3
이 구성으로 많은 테스트를 수행했지만 브리지 인터페이스(br0)가 IP를 얻을 수 없습니다. 결국 NetworkManager를 렌더러로 사용하게 되었고 다음 /etc/netplan/50-cloud-init.yaml
구성이 작동했습니다.
network:
version: 2
renderer: NetworkManager
ethernets:
ens3:
dhcp4: false
dhcp6: false
match:
macaddress: fa:16:3e:82:c5:fe
set-name: ens3
mtu: 8950
bridges:
br0:
interfaces: [ens3]
dhcp4: true
dhcp6: false
mtu: 8950
parameters:
stp: true
forward-delay: 4
Netplan을 사용한 출력은 ifconfig -a
다음과 같습니다.
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 8950
inet 10.52.16.185 netmask 255.255.255.0 broadcast 10.52.16.255
inet6 fe80::f816:3eff:fe82:c5fe prefixlen 64 scopeid 0x20<link>
inet6 2001:1600:4:8:f816:3eff:fe82:c5fe prefixlen 64 scopeid 0x0<global>
ether fa:16:3e:82:c5:fe txqueuelen 1000 (Ethernet)
RX packets 6364 bytes 468754 (468.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 75 bytes 11528 (11.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 8950
ether fa:16:3e:82:c5:fe txqueuelen 1000 (Ethernet)
RX packets 8132 bytes 713045 (713.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 114 bytes 13490 (13.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 176 bytes 11840 (11.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 176 bytes 11840 (11.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Netplan을 사용한 출력은 ip route
다음과 같습니다.
10.52.11.0/24 dev br0 proto dhcp scope link metric 425
10.52.16.0/24 dev br0 proto kernel scope link src 10.52.16.185 metric 425
10.52.20.0/24 dev br0 proto dhcp scope link metric 425
10.52.24.0/24 dev br0 proto dhcp scope link metric 425
169.254.169.254 via 10.52.16.1 dev br0 proto dhcp metric 425
Netplan을 사용한 출력은 lspci
다음과 같습니다.
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
Netplan을 사용한 출력은 networkctl -a status
다음과 같습니다.
● 1: lo
Link File: /lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
State: carrier (unmanaged)
Address: 127.0.0.1
::1
● 2: ens3
Link File: /run/systemd/network/10-netplan-ens3.link
Network File: n/a
Type: ether
State: carrier (unmanaged)
Path: pci-0000:00:03.0
Driver: virtio_net
Vendor: Red Hat, Inc.
Model: Virtio network device
HW Address: fa:16:3e:82:c5:fe
● 3: br0
Link File: /lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: routable (unmanaged)
Driver: bridge
HW Address: fa:16:3e:82:c5:fe
Address: 10.52.16.185
2001:1600:4:8:f816:3eff:fe82:c5fe
fe80::f816:3eff:fe82:c5fe
Gateway: 10.52.16.1
fe80::f816:3eff:fee7:1ea5
게스트 OS 설치:
이제 브리지 인터페이스가 괜찮아 보이고 가상화에 필요한 패키지( qemu qemu-kvm libvirt-bin bridge-utils virt-manager
)를 설치하고 libvirtd
서비스를 시작했습니다.
virt-install
그런 다음 다음 명령을 사용하여 첫 번째 게스트 OS를 설치하려고 했습니다 .
$ sudo virt-install \
--name projectname \
--ram 1024 \
--vcpus 1 \
--network bridge:br0 \
--disk path=/srv/data/projectname,size=2 \
--os-type Linux \
--os-variant=ubuntu18.04 \
--location 'http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/' \
--graphics none \
--extra-args 'console=ttyS0' \
--console pty,target_type=serial
불행하게도 설치 프로그램은 아래와 같이 DHCP를 사용하여 네트워크를 구성하지 못합니다.
네트워크 자동 구성에 실패했습니다.
게스트 운영 체제 설치 시도가 실패한 후의 네트워크 상태:
출력은 ifconfig -a
다음과 같습니다
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 8950
inet 10.52.16.185 netmask 255.255.255.0 broadcast 10.52.16.255
inet6 fe80::f816:3eff:fe82:c5fe prefixlen 64 scopeid 0x20<link>
inet6 2001:1600:4:8:f816:3eff:fe82:c5fe prefixlen 64 scopeid 0x0<global>
ether fa:16:3e:82:c5:fe txqueuelen 1000 (Ethernet)
RX packets 289453 bytes 301978563 (301.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 70249 bytes 7101505 (7.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 8950
ether fa:16:3e:82:c5:fe txqueuelen 1000 (Ethernet)
RX packets 294080 bytes 306373898 (306.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 71779 bytes 7183441 (7.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 332 bytes 27936 (27.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 332 bytes 27936 (27.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:06:10:e5 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:06:10:e5 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 8950
inet6 fe80::fc54:ff:fe8e:6a11 prefixlen 64 scopeid 0x20<link>
ether fe:54:00:8e:6a:11 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1 bytes 90 (90.0 B)
TX errors 0 dropped 108892 overruns 0 carrier 0 collisions 0
출력은 ip route
다음과 같습니다
default via 10.52.16.1 dev br0 proto dhcp metric 425
10.52.11.0/24 dev br0 proto dhcp scope link metric 425
10.52.16.0/24 dev br0 proto kernel scope link src 10.52.16.185 metric 425
10.52.20.0/24 dev br0 proto dhcp scope link metric 425
10.52.24.0/24 dev br0 proto dhcp scope link metric 425
169.254.169.254 via 10.52.16.1 dev br0 proto dhcp metric 425
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
출력은 lspci
다음과 같습니다
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon
출력은 networkctl -a status
다음과 같습니다
● 1: lo
Link File: n/a
Network File: n/a
Type: loopback
State: carrier (unmanaged)
Address: 127.0.0.1
::1
● 2: ens3
Link File: n/a
Network File: n/a
Type: ether
State: carrier (unmanaged)
Path: pci-0000:00:03.0
Vendor: Red Hat, Inc.
Model: Virtio network device
HW Address: fa:16:3e:82:c5:fe
● 3: br0
Link File: n/a
Network File: n/a
Type: ether
State: routable (unmanaged)
Driver: bridge
HW Address: fa:16:3e:82:c5:fe
Address: 10.52.16.185
2001:1600:4:8:f816:3eff:fe82:c5fe
fe80::f816:3eff:fe82:c5fe
Gateway: 10.52.16.1
fe80::f816:3eff:fee7:1ea5
● 4: virbr0
Link File: /lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: no-carrier (unmanaged)
Driver: bridge
HW Address: 52:54:00:06:10:e5
Address: 192.168.122.1
● 5: virbr0-nic
Link File: /lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: off (unmanaged)
Driver: tun
HW Address: 52:54:00:06:10:e5
● 7: vnet0
Link File: /lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: degraded (unmanaged)
Driver: tun
HW Address: fe:54:00:8e:6a:11
Address: fe80::fc54:ff:fe8e:6a11
위와 동일한 명령을 시도했지만 br0을 virbr0으로 바꿨습니다. 설치는 성공했지만 이는 잘못된 것 같습니다(지금까지 본 모든 튜토리얼에 따르면...).
질문
- Netplan을 사용해야 할까요, 아니면 완전히 제거해야 할까요?
- 기본 네트워크 렌더러를 사용해야 합니까, 아니면 NetworkManager를 사용해야 합니까?
- 내 Netplan이 올바르게 구성되어 있나요?
- virt-install 매개변수가 정확합니까?
- ...내가 뭘 잘못했나요?