我的第二個網卡(pci-e 卡)上的網路僅適用於具有 macvtap 或網橋的 kvm 虛擬機器?

我的第二個網卡(pci-e 卡)上的網路僅適用於具有 macvtap 或網橋的 kvm 虛擬機器?

好吧,我有第二個1 gig NIC(PCI-e 卡),我的第一個是我的板載1 gig NIC,但無論如何,我想為我的kvm 虛擬機擁有第二個NIC,但我似乎無法讓它與macvtap 一起工作甚至橋接我的第二個網卡。每次我開始安裝客戶 Ubuntu 作業系統時,我都無法連接網路來完成安裝。我希望能夠使用 Macvtap,但我似乎找不到任何設定它的文檔,所以我只想嘗試建立一個運行的橋接器供我的虛擬機器使用。

以下是我的/etc/network/interfaces文件:

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

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface (On board 1Gb/s NIC)
auto eth0
iface eth0 inet static
       address 192.168.0.12
       netmask 255.255.255.0
       gateway 192.168.0.1
       dns-nameservers 192.168.0.1

# The secondary network interface (HIRO PCI-E card 1 Gb/s)
#auto eth1
#iface eth1 inet manual

# The bridge interface for my VMs
auto vmbr0
iface vmbr0 inet static
            address 192.168.0.11
            netmask 255.255.255.0
            gateway 192.168.0.1
            dns-nameservers 192.168.0.1
            bridge_ports eth1
            bridge_stp off
            bridge_fd 0
            bridge_maxwait 0

因此,現在透過此設置,我可以使橋正常工作,但是當我使用--networkbridge:vmbr0 將虛擬機連接到它時,我進入安裝並開始執行它,但當它嘗試時,我被磚牆擊中在虛擬機器中設定網路。我可以透過手動設定網路來解決這個問題,但是當它需要時我無法存取 Ubuntu 存檔,然後我再次在安裝過程中停止。

如果有幫助的話,這是我用於 virt-install 的命令:

sudo virt-install \
--name vm01 \
--vcpus=2 \
--ram=2048 \
--disk vol=vms/vm01 \
--network bridge:vmbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/' \
--extra-args 'console=ttyS0,115200n8 serial'

我不使用 vnc 的原因是因為我喜歡透過 SSH 從終端執行所有操作。

TL:DR - 需要讓我的第二個網卡為我的虛擬機工作,我想我已經成功了,但是當我在來賓作業系統的安裝過程中,當它試圖到達網路外部時,我陷入了困境。我是否遺漏了什麼或需要遵循的指南?任何幫助都會非常好,謝謝。

相關內容