KVM Implementation with Proxmox¶
KVM Server implementation with Proxmox repositories and setup iommu , pci passtrouhg settings
MainBoard Information¶
Manufacturer |
Supermicro |
Product Name |
SSG-2028R-E1CR24H |
Version |
123456789 |
Serial Number |
S174836X6411468 |
UUID |
00000000-0000-0000-0000-0cc47a6efda2 |
Wake-up Type |
Power Switch |
SKU Number |
085915D9 |
Family |
SMC X10 |
Product-Name |
X10DRH-iT |
Serial-Number |
NM162S008122 |
Type |
Motherboard |
Proxmox Repositories¶
Enterprise or Not Enterprise
Enterprise Repositories¶
The Enterprise repository for The Proxmox subscription model is based on the number of physical servers and their occupied CPU sockets. A CPU socket (or slot) is a specific place on the motherboard where your CPU plugs in. Most motherboards have one, two, or four CPU sockets. The CPU socket count is the number of CPU sockets on your motherboard that are actually occupied with a physical CPU.
Affordable Price
Access to Enterprise repository
Complete feature-set
Community support
1 |
|
Install Proxmox VE¶
Add an /etc/hosts entry for your IP address
The hostname of your machine must be resolvable via /etc/hosts
.
This means that in /etc/hosts
you need one of the following entries
for your hostname:
1 IPv4 or
1 IPv6 or
1 IPv4 and 1 IPv6
Note: This also means removing the address 127.0.1.1
that might
be present as default.
For instance, if your IP address is 192.168.15.77
, and your hostname
prox4m1
, then your /etc/hosts
file could look like:
127.0.0.1 localhost
192.168.15.77 prox4m1.proxmox.com prox4m1
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
You can test if your setup is ok using the hostname
command:
hostname --ip-address
192.168.15.77 # should return your IP address here
Add the Proxmox VE repository key as root (or use sudo):
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
Update your repository and system by running:
apt update && apt full-upgrade
Install the Proxmox VE Kernel¶
First you need to install and boot the Proxmox VE kernel, as some packages depend on specific kernel compile flags to be set or feature extensions (e.g., for apparmor) to be available.
1 |
|
apt install pve-kernel-5.15
1 |
|
Note that while the pve-kernel-5.15 is the default stable kernel for the Proxmox VE 7.x series, there’s also a newer opt-in kernel available with pve-kernel-6.2, possibly helping to resolve some hardware related woes on modern systems.
Install the Proxmox VE packages¶
apt install proxmox-ve postfix open-iscsi
Configure packages which require user input on installation according to your needs.
If you have a mail server in your network, you should configure postfix as a satellite system. Your existing mail server will then be the relay host
which will route the emails sent by Proxmox VE to their final recipient. If you don’t know what to enter here, choose local only and leave the system name
as is.
Remove the Debian Kernel¶
Proxmox VE ships its own kernel and keeping the Debian default kernel can lead to trouble on upgrades, for example, with Debian point releases. Therefore, you must remove the default Debian kernel:
1 |
|
1 |
|
Update and check grub2 config by running:
update-grub2
Recommended: Remove the os-prober Package¶
The os-prober package scans all the partitions of your host to create dual-boot GRUB entries. But the scanned partitions can also include those assigned to virtual machines, which one doesn’t want to add as boot entry.
If you didn’t install Proxmox VE as dual boot beside another OS, you can safely remove the os-prober package:
apt remove os-prober
Connect to the Proxmox VE web interface¶
Connect to the admin web interface of the local hypervisor link If you have a fresh install and have not added any users yet, you should select PAM authentication realm and login with root user account.
Network Configuration¶
Note
For Configure a Virtual Private Network node refer to VPN Config
For Configure a Wireless interface refer to Wpa Supplicant
Bridged networking aka: “shared physical device”¶
Install bridge utils on debian
sudo apt install bridge-utils
Config an interface as bridge to guest machines
How to view the current configuration of the interfaces
With ip
command
1 |
|
With ifconfig
1 |
|
Add bridge configuration to interfaces file
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
1 2 3 4 5 6 7 |
|
1 2 |
|
1 2 3 |
|
Enabling IOMMU¶
Do I have iommu ?
1 |
|
- How to enable IOMMU on Intel and AMD product?
Go to BIOS screen and find the
VT-d
orIOMMU
from the NorthBridge Configuration and change that setting to “Enabled”, and save it. In case of CentOS6.x and RedHat6.x, you have to addintel_iommu=on
oramd_iommu=on
to kernel option too.
Note
Ensure that AMD-Vi/Intel VT-d
is supported by the CPU and enabled in the BIOS settings.
Both normally show up alongside other CPU features (meaning they could be in an overclocking-related menu)
either with their actual names VT-d
or AMD-Vi
or in more ambiguous terms such as
“Virtualization technology”, which may or may not be explained in the manual.
Manually enable IOMMU support by setting the correct kernel parameter depending on the type of CPU in use:
Success
For Intel CPUs (VT-d) set intel_iommu=on. Since the kernel config option CONFIG_INTEL_IOMMU_DEFAULT_ON is not set in linux. For AMD CPUs (AMD-Vi), it is on if kernel detects IOMMU hardware support from BIOS.
You should also append the iommu=pt parameter. This will prevent Linux from touching devices which cannot be passed through.
Check Grub Parameter¶
For check if iommu is enable in grub kernel option
1 2 3 |
|
Add the parameter in /etc/default/grub
1 2 3 4 5 6 7 8 9 10 11 |
|
After that update grub:
sudo update-grub2
Modules Enable¶
1 2 3 4 |
|
After changing anything modules related, you need to refresh your initramfs. On {pve} this can be done by executing:
# update-initramfs -u -k all
Finish Configuration¶
Finally reboot to bring the changes into effect and check that it is indeed enabled.
# dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
Verify IOMMU interrupt remapping is enabled¶
It is not possible to use PCI passthrough without interrupt remapping. Device assignment will fail with ‘Failed to assign device “[device name]”: Operation not permitted’ or ‘Interrupt Remapping hardware not found, passing devices to unprivileged domains is insecure.’.
All systems using an Intel processor and chipset that have support for Intel Virtualization Technology for Directed I/O (VT-d), but do not have support for interrupt remapping will see such an error. Interrupt remapping support is provided in newer processors and chipsets (both AMD and Intel).
To identify if your system has support for interrupt remapping:
dmesg | grep 'remapping'
[ 0.179058] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
[ 0.179350] DMAR-IR: Enabled IRQ remapping in x2apic mode
If you see one of the following lines:
AMD-Vi: Interrupt remapping enabled
DMAR-IR: Enabled IRQ remapping in x2apic mode
(‘x2apic’ can be different on old CPUs, but should still work)
then remapping is supported.
Testing the Configuration under Linux¶
The following instructions will explain how to test if the CPU supports VT-x and, if that is the case, how to test if the BIOS settings permit this feature to be used.
Does the CPU support VT-x?¶
On a Linux system, you can test if the CPUs will support VT-x with the help of the /proc/cpuinfo utility. If the vmx setting is listed among the flags, the CPU will support VT-x, in principle:[2]
root@grml~# cat /proc/cpuinfo
processor: 0
vendor_id: GenuineIntel
cpu family: 6
model 15:
model name: Intel(R) Xeon(R) CPU 5110 @ 1.60GHz
stepping: 6
cpu MHz: 1595.896
cache size: 4096 KB
physical id: 0
siblings: 2
core id: 0
cpu cores: 2
apicid: 0
initial apicid: 0
fpu: yes
fpu_exception: yes
cpuid level: 10
wp: yes
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall
nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl
vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow
bogomips: 3193.78
clflush size: 64
cache_alignment: 64
address sizes: 36 bits physical, 48 bits virtual
power management:
[...]
Do the BIOS Settings permit VT-x usage?¶
If the BIOS will permit the usage of VT-x can be determined with the help of the rdmsr (read msr) utility from the msr-tools tool package[3] MSR stands for machine-specific register, although sometimes model-specific register is used.[4] MSRs are used to set specific values for the hardware in use or to transfer values between the BIOS and the kernel.
The VT-x lock function is stored in the IA32_FEATURE_CONTROL machine-specific register (MSR address 0x3a).[5] This MSR contains the following three bits:[6]
Bit 0: lock bit
Bit 1: activate VMXON in SMX mode
Bit 2: activate VMXON outside of SMX mode
The BIOS must set Bits 1 and 2, or all three bits (including Bit 0) so that VT-x support will be enabled.
The Linux Live CD from grml 64 for May 2009 will be used in this
example. The msr-tools will be installed by means of the
apt-get update
and subsequent apt-get install msr-tools
commands. So that rdmsr can access the MSRs, the msr kernel module will
have to be installed.
Example 1: Deactivating Intel VT-x in the BIOS¶
If Intel VT-x has been deactivated in the BIOS (or the server was not
turned off and back on after the setting was activated), the
rdmsr 0x3a
command will return 1 (meaning that only Bit 0 has
been set).
root@grml ~ # modinfo msr
filename: /lib/modules/2.6.28-grml64/kernel/arch/x86/kernel/msr.ko
license: GPL
description: x86 generic MSR driver
author: H. Peter Anvin <hpa@zytor.com>
srcversion: 645F15590C9CD893B156AD6
depends:
vermagic: 2.6.28-grml64 SMP preempt mod_unload
root@grml ~ # modprobe msr
root@grml ~ # rdmsr 0x3a
1
root@grml ~ #
Example 2: Activating Intel VT-x in the BIOS¶
With the example server (an Intel SR2500), the rdmsr 0x3a
command
returns 5, if Intel VT-x has been activated in the BIOS (Bits 0 and
2 have therefore been set).
root@grml ~ # modinfo msr
filename: /lib/modules/2.6.28-grml64/kernel/arch/x86/kernel/msr.ko
license: GPL
description: x86 generic MSR driver
author: H. Peter Anvin <hpa@zytor.com>
srcversion: 645F15590C9CD893B156AD6
depends:
vermagic: 2.6.28-grml64 SMP preempt mod_unload
root@grml ~ # modprobe msr
root@grml ~ # rdmsr 0x3a
5
root@grml ~ #
IOMMU supported but deactivated¶
IOMMU Full Activated¶
High Availability Cluster¶
Note
Proxmox Article Next Article about HA is taken from Proxmox Website