Ubuntu KVM - 橋接 - 將主機與 NIC 隔離

Ubuntu KVM - 橋接 - 將主機與 NIC 隔離

我有一個帶有 4 個實體網卡的 Ubuntu 伺服器。其中 2 個,我想對主機“隱藏”,因此主機本身可能無法訪問這 2 個網卡上的流量,只能訪問我將它們傳遞到的虛擬機(直通)。

有人知道一個好的教程或有一個快速的描述,最好的方法是什麼?

這樣我的虛擬機器就可以充當防火牆,我不會有以任何方式暴露主機的風險。

答案1

關鍵字是 PCI 直通。使用這種方法,可以將PCI設備直接綁定到VM,而主機根本看不到這些設備。

這是 中 PCI 直通定義的範例virt-manager

<hostdev mode="subsystem" type="pci" managed="yes">
  <source>
    <address domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
  </source>
  <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
</hostdev>

若要將裝置新增至虛擬機器中virt-manager,請執行下列步驟:

1. Make sure the VM is shut down.
2. Open the VM details tab, and click "Add Hardware" on the left bottom.
3. Select `PCI Host Device`.
4. Select your device from the list.

此後,當 VM 啟動時,設備將與主機斷開連接,並附加到 VM。

相關內容