Proxmox Virtual Environment(虛擬機(jī))
-
安裝VIM編輯工具
apt-get updateapt-get install vim -y
硬件直通
-
網(wǎng)卡直通
-
第一步
修改內(nèi)核配置
vi /etc/default/grubIntel-CPU
在里面找到:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet”然后修改為
GRUB_CMDLINE_LINUX_DEFAULT=”quiet intel_iommu=on”AMD-CPU
在里面找到:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet”然后修改為
GRUB_CMDLINE_LINUX_DEFAULT=”quiet amd_iommu=on”-
第二走
更新數(shù)據(jù)
update-grub添加配置
打開(kāi) vi /etc/modules 添加 vfio vfio_iommu_type1 vfio_pcioptions vfio_virq更新數(shù)據(jù)
update-initramfs -u -k all重啟系統(tǒng)
reboot查看IOMMU相關(guān)信息,沒(méi)有輸出就代表失敗
dmesg | grep -e DMAR -e IOMMU??如果上面這些都弄完了添加了PCI設(shè)備無(wú)法開(kāi)啟虛擬機(jī)的話(huà)需要在
/etc/modprobe.d/pve-blacklist.conf文件里面添加一行options vfio_iommu_type1 allow_unsafe_interrupts=1來(lái)啟用不安全的中斷
-
-
-
網(wǎng)卡SR-IOV直通
https://zhuanlan.zhihu.com/p/356437308
腳本
#! /bin/sh # # Copyright (C) 2011, 2012, 2016 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ### BEGIN INIT INFO # Provides: openvswitch-switch # Required-Start: $network $named $remote_fs $syslog $openvswitch-switch # Required-Stop: $remote_fs $openvswitch-switch # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: SR-IOV initialization. #Description: Initializing VM's network with sriov support. ### END INIT INFO start () { #enable Sriov 把enp12s0虛擬12個(gè)網(wǎng)卡 echo 12 > /sys/class/net/enp12s0/device/sriov_numvfs ip link set dev enp12s0 up ip link set dev enp12s0 vf 0 mac aa:bb:cc:dd:ee:f1 ip link set dev enp12s0 vf 1 mac aa:bb:cc:dd:ee:f2 ip link set dev enp12s0 vf 2 mac aa:bb:cc:dd:ee:f3 ip link set dev enp12s0 vf 3 mac aa:bb:cc:dd:ee:f4 ip link set dev enp12s0 vf 4 mac aa:bb:cc:dd:ee:f5 ip link set dev enp12s0 vf 5 mac aa:bb:cc:dd:ee:f6 ip link set dev enp12s0 vf 6 mac aa:bb:cc:dd:ee:f7 ip link set dev enp12s0 vf 7 mac aa:bb:cc:dd:ee:f8 ip link set dev enp12s0 vf 8 mac aa:bb:cc:dd:ee:f9 ip link set dev enp12s0 vf 9 mac aa:bb:cc:dd:ee:a0 ip link set dev enp12s0 vf 10 mac aa:bb:cc:dd:ee:a1 ip link set dev enp12s0 vf 11 mac aa:bb:cc:dd:ee:a2 #initial OVS bridge systemctl restart networking # ovs-vsctl --no-wait add-br br0-ovs # ovs-vsctl add-port br0-ovs enp12s0 # Manager Interface # ip link set dev enp12s0v3 up # ip address add 192.168.0.99/24 dev enp12s0v3 # ip route add default via 192.168.0.1 } stop () { [ "$READ_INTERFACES" != "no" ] && network_interfaces ifdown ovs_ctl stop } case $1 in start) start ;; stop | force-stop) stop ;; *) echo "Usage: $0 {start|stop}" >&2 exit 1 ;; esac exit 0 -
硬盤(pán)直通
進(jìn)入PVE的SSH,或者直接進(jìn)入PVE管理網(wǎng)頁(yè)Shell
查看你現(xiàn)在的存儲(chǔ)設(shè)備的序列號(hào):
ls /dev/disk/by-id然后就能看到所有存儲(chǔ)設(shè)備的序列號(hào)
比如我的軟路由主機(jī)上有兩塊硬盤(pán),一個(gè)東芝SSD,一個(gè)是西數(shù)的硬盤(pán),需要掛載的是西數(shù)的硬盤(pán)
我的西數(shù)硬盤(pán)序列號(hào)是ata-WDC_WDXXXX_XXXX_XXXX,記住這個(gè)序列號(hào)
然后輸入以下代碼(請(qǐng)把硬盤(pán)序列號(hào)換成你硬盤(pán)的,100換成你LEDE的虛擬機(jī)ID)
qm set 901 -scsi3 /dev/disk/by-id/scsi-35000c500593c505f如果返回以下信息,說(shuō)明已成功掛載
update VM 100: -scsi1 /dev/disk/by-id/ata-WDC_WDXXXX_XXXX_XXXX然后可以進(jìn)入PVE管理網(wǎng)頁(yè),查看是否真的掛載成功.如果看到LEDE虛擬機(jī)硬件設(shè)備里有這個(gè),就說(shuō)明成功.
-
顯卡直通
查看顯卡ID
lspci -v | grep VGA
使用SPICE控制臺(tái)
-
下載網(wǎng)址
https://virt-manager.org/download/
-
使用方式
顯卡虛擬化
https://foxi.buduanwang.vip/virtualization/pve/592.html/
鏈路聚合
- 聚合模式說(shuō)明
虛擬硬盤(pán)互轉(zhuǎn)硬盤(pán)
-
img轉(zhuǎn)硬盤(pán)



