passthrough
This commit is contained in:
parent
38c65fd5dc
commit
53b7cbe1dd
44
README.md
44
README.md
@ -1 +1,43 @@
|
|||||||
#MyNote
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
16
linux/caddy.md
Normal file
16
linux/caddy.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# caddy
|
||||||
|
|
||||||
|
## caddyfile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
*.nps.veypi.com:80 {
|
||||||
|
reverse_proxy 127.0.0.1:800
|
||||||
|
# or
|
||||||
|
file_server [<matcher>] [browse] {
|
||||||
|
root /
|
||||||
|
hide <files...>
|
||||||
|
index <filenames...>
|
||||||
|
browse [<template_file>]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
23
linux/net.sh
23
linux/net.sh
@ -6,29 +6,20 @@
|
|||||||
# Distributed under terms of the MIT license.
|
# Distributed under terms of the MIT license.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
LANG=""
|
LANG=""
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
up_time1=`ifconfig $1 | grep "bytes" | awk '{print $6}'`
|
up_time1=`ifconfig $1 | grep "TX packets" | awk '{print $5}'`
|
||||||
down_time1=`ifconfig $1 | grep "bytes" | awk '{print $2}'`
|
down_time1=`ifconfig $1 | grep "RX packets" | awk '{print $5}'`
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
clear
|
clear
|
||||||
|
up_time2=`ifconfig $1 | grep "TX packets" | awk '{print $5}'`
|
||||||
up_time2=`ifconfig $1 | grep "bytes" | awk '{print $6}'`
|
down_time2=`ifconfig $1 | grep "RX packets" | awk '{print $5}'`
|
||||||
down_time2=`ifconfig $1 | grep "bytes" | awk '{print $2}'`
|
|
||||||
|
|
||||||
up_time1=${up_time1}
|
|
||||||
up_time2=${up_time2}
|
|
||||||
down_time1=${down_time1}
|
|
||||||
down_time2=${down_time2}
|
|
||||||
|
|
||||||
up_time=`expr $up_time2 - $up_time1`
|
up_time=`expr $up_time2 - $up_time1`
|
||||||
down_time=`expr $down_time2 - $down_time1`
|
down_time=`expr $down_time2 - $down_time1`
|
||||||
up_time=`expr $up_time / 1024`
|
up_time=`expr $up_time / 1024`
|
||||||
down_time=`expr $down_time / 1024`
|
down_time=`expr $down_time / 1024`
|
||||||
|
echo 上传速度: $up_time KB/s
|
||||||
echo 上传速度: $up_time kb/s
|
echo 下载速度: $down_time KB/s
|
||||||
echo 下载速度: $down_time kb/s
|
|
||||||
done
|
done
|
||||||
|
|||||||
20
linux/pack_sys.md
Normal file
20
linux/pack_sys.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 打包系统
|
||||||
|
|
||||||
|
https://blog.csdn.net/zanj0525/article/details/79129375
|
||||||
|
https://github.com/chamuco/respin
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo add-apt-repository ppa:sergiomejia666/respin
|
||||||
|
sudo apt-get install respin
|
||||||
|
sudo respin backup
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
2
|
||||||
|
|
||||||
|
https://www.cnblogs.com/jikexianfeng/p/6103504.html
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
10
linux/rip
10
linux/rip
@ -9,26 +9,26 @@ from_port=$3
|
|||||||
to=$4
|
to=$4
|
||||||
to_port=$5
|
to_port=$5
|
||||||
|
|
||||||
if ! [ -e "$1" ]; then
|
if ! [ -n "$1" ]; then
|
||||||
echo "iptable chan not found" >&1
|
echo "iptable chan not found" >&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -e "$2" ]; then
|
if ! [ -n "$2" ]; then
|
||||||
echo "from host not found" >&1
|
echo "from host not found" >&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! [ -e "$3" ]; then
|
if ! [ -n "$3" ]; then
|
||||||
echo "from port not found" >&1
|
echo "from port not found" >&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -e "$4" ]; then
|
if ! [ -n "$4" ]; then
|
||||||
echo "destination host not found" >&1
|
echo "destination host not found" >&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -e "$5" ]; then
|
if ! [ -n "$5" ]; then
|
||||||
echo "destination port not found" >&1
|
echo "destination port not found" >&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -2,7 +2,18 @@
|
|||||||
|
|
||||||
### https://blog.csdn.net/u012336567/article/details/74743168
|
### https://blog.csdn.net/u012336567/article/details/74743168
|
||||||
|
|
||||||
|
https://pve.proxmox.com/wiki/Pci_passthrough
|
||||||
|
|
||||||
|
https://www.server-world.info/en/note?os=CentOS_7&p=kvm&f=10
|
||||||
|
|
||||||
|
https://blog.51cto.com/sery/2161368?cid=716548
|
||||||
|
|
||||||
|
https://mathiashueber.com/windows-virtual-machine-gpu-passthrough-ubuntu/
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
|
|
||||||
|
# 使用lspci -nn列出所有PCI设备和他们的地址,记录下GPU ids为 [10de:11c6] & [10de:0e0b]
|
||||||
|
|
||||||
10de:1c03,10de:10f1
|
10de:1c03,10de:10f1
|
||||||
|
|
||||||
1002:67df,1002:aaf0
|
1002:67df,1002:aaf0
|
||||||
@ -44,7 +55,9 @@ nano /etc/modprobe.d/vfio.conf
|
|||||||
options vfio-pci ids=10de:1c03,10de:10f1
|
options vfio-pci ids=10de:1c03,10de:10f1
|
||||||
|
|
||||||
sudo nano /etc/initramfs-tools/modules
|
sudo nano /etc/initramfs-tools/modules
|
||||||
|
sudo vim /etc/modules
|
||||||
|
|
||||||
|
# 添加如下
|
||||||
vfio
|
vfio
|
||||||
vfio_iommu_type1
|
vfio_iommu_type1
|
||||||
vfio_pci
|
vfio_pci
|
||||||
@ -58,4 +71,13 @@ nano /etc/libvirt/qemu.conf
|
|||||||
nvram = ["/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd"]
|
nvram = ["/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd"]
|
||||||
|
|
||||||
find /sys/kernel/iommu_groups/ -type l
|
find /sys/kernel/iommu_groups/ -type l
|
||||||
|
|
||||||
|
dmesg | grep vfio-pci.ids
|
||||||
|
dmesg | grep IOMMU
|
||||||
|
sudo lsmod | grep vfio
|
||||||
|
|
||||||
|
# https://blog.csdn.net/hbuxiaofei/article/details/106566348
|
||||||
|
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
|
||||||
|
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||||
|
|
||||||
```
|
```
|
||||||
184
openstack/passthrough.xml
Normal file
184
openstack/passthrough.xml
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
<domain type='kvm' id='1'>
|
||||||
|
<name>win10</name>
|
||||||
|
<uuid>c9387dc7-a3dc-40bc-a041-91844d1fcc06</uuid>
|
||||||
|
<memory unit='KiB'>8290304</memory>
|
||||||
|
<currentMemory unit='KiB'>8290304</currentMemory>
|
||||||
|
<vcpu placement='static'>5</vcpu>
|
||||||
|
<resource>
|
||||||
|
<partition>/machine</partition>
|
||||||
|
</resource>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc-i440fx-bionic'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
<apic/>
|
||||||
|
<hyperv>
|
||||||
|
<relaxed state='on'/>
|
||||||
|
<vapic state='on'/>
|
||||||
|
<spinlocks state='on' retries='8191'/>
|
||||||
|
</hyperv>
|
||||||
|
<kvm>
|
||||||
|
<hidden state='on'/>
|
||||||
|
</kvm>
|
||||||
|
<vmport state='off'/>
|
||||||
|
</features>
|
||||||
|
<cpu mode='custom' match='exact' check='full'>
|
||||||
|
<model fallback='forbid'>Broadwell-noTSX-IBRS</model>
|
||||||
|
<feature policy='require' name='vme'/>
|
||||||
|
<feature policy='require' name='f16c'/>
|
||||||
|
<feature policy='require' name='rdrand'/>
|
||||||
|
<feature policy='require' name='hypervisor'/>
|
||||||
|
<feature policy='require' name='arat'/>
|
||||||
|
<feature policy='require' name='xsaveopt'/>
|
||||||
|
<feature policy='require' name='abm'/>
|
||||||
|
</cpu>
|
||||||
|
<clock offset='localtime'>
|
||||||
|
<timer name='rtc' tickpolicy='catchup'/>
|
||||||
|
<timer name='pit' tickpolicy='delay'/>
|
||||||
|
<timer name='hpet' present='no'/>
|
||||||
|
<timer name='hypervclock' present='yes'/>
|
||||||
|
</clock>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled='no'/>
|
||||||
|
<suspend-to-disk enabled='no'/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/kvm-spice</emulator>
|
||||||
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='qemu' type='qcow2'/>
|
||||||
|
<source file='/var/lib/libvirt/images/win10.qcow2'/>
|
||||||
|
<backingStore/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<alias name='ide0-0-0'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<disk type='file' device='cdrom'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source file='/home/optimusx/Downloads/cn_windows_10_enterprise_2016_ltsb_x64_dvd_9060409.iso'/>
|
||||||
|
<backingStore/>
|
||||||
|
<target dev='hdb' bus='ide'/>
|
||||||
|
<readonly/>
|
||||||
|
<alias name='ide0-0-1'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='usb' index='0' model='ich9-ehci1'>
|
||||||
|
<alias name='usb'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='usb' index='0' model='ich9-uhci1'>
|
||||||
|
<alias name='usb'/>
|
||||||
|
<master startport='0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='usb' index='0' model='ich9-uhci2'>
|
||||||
|
<alias name='usb'/>
|
||||||
|
<master startport='2'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='usb' index='0' model='ich9-uhci3'>
|
||||||
|
<alias name='usb'/>
|
||||||
|
<master startport='4'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='0' model='pci-root'>
|
||||||
|
<alias name='pci.0'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='ide' index='0'>
|
||||||
|
<alias name='ide'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='virtio-serial' index='0'>
|
||||||
|
<alias name='virtio-serial0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||||
|
</controller>
|
||||||
|
<interface type='network'>
|
||||||
|
<mac address='52:54:00:34:71:d3'/>
|
||||||
|
<source network='default' bridge='virbr0'/>
|
||||||
|
<target dev='vnet0'/>
|
||||||
|
<model type='rtl8139'/>
|
||||||
|
<alias name='net0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||||
|
</interface>
|
||||||
|
<serial type='pty'>
|
||||||
|
<source path='/dev/pts/1'/>
|
||||||
|
<target type='isa-serial' port='0'>
|
||||||
|
<model name='isa-serial'/>
|
||||||
|
</target>
|
||||||
|
<alias name='serial0'/>
|
||||||
|
</serial>
|
||||||
|
<console type='pty' tty='/dev/pts/1'>
|
||||||
|
<source path='/dev/pts/1'/>
|
||||||
|
<target type='serial' port='0'/>
|
||||||
|
<alias name='serial0'/>
|
||||||
|
</console>
|
||||||
|
<channel type='spicevmc'>
|
||||||
|
<target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
|
||||||
|
<alias name='channel0'/>
|
||||||
|
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||||
|
</channel>
|
||||||
|
<input type='tablet' bus='usb'>
|
||||||
|
<alias name='input0'/>
|
||||||
|
<address type='usb' bus='0' port='1'/>
|
||||||
|
</input>
|
||||||
|
<input type='mouse' bus='ps2'>
|
||||||
|
<alias name='input1'/>
|
||||||
|
</input>
|
||||||
|
<input type='keyboard' bus='ps2'>
|
||||||
|
<alias name='input2'/>
|
||||||
|
</input>
|
||||||
|
<graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
|
||||||
|
<listen type='address' address='127.0.0.1'/>
|
||||||
|
<image compression='off'/>
|
||||||
|
</graphics>
|
||||||
|
<sound model='ich6'>
|
||||||
|
<alias name='sound0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||||
|
</sound>
|
||||||
|
<video>
|
||||||
|
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
|
||||||
|
<alias name='video0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</video>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
<alias name='hostdev0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0' multifunction='on'/>
|
||||||
|
</hostdev>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
|
||||||
|
</source>
|
||||||
|
<alias name='hostdev1'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x1'/>
|
||||||
|
</hostdev>
|
||||||
|
<redirdev bus='usb' type='spicevmc'>
|
||||||
|
<alias name='redir0'/>
|
||||||
|
<address type='usb' bus='0' port='2'/>
|
||||||
|
</redirdev>
|
||||||
|
<redirdev bus='usb' type='spicevmc'>
|
||||||
|
<alias name='redir1'/>
|
||||||
|
<address type='usb' bus='0' port='3'/>
|
||||||
|
</redirdev>
|
||||||
|
<memballoon model='virtio'>
|
||||||
|
<alias name='balloon0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
|
||||||
|
</memballoon>
|
||||||
|
</devices>
|
||||||
|
<seclabel type='dynamic' model='apparmor' relabel='yes'>
|
||||||
|
<label>libvirt-c9387dc7-a3dc-40bc-a041-91844d1fcc06</label>
|
||||||
|
<imagelabel>libvirt-c9387dc7-a3dc-40bc-a041-91844d1fcc06</imagelabel>
|
||||||
|
</seclabel>
|
||||||
|
<seclabel type='dynamic' model='dac' relabel='yes'>
|
||||||
|
<label>+64055:+127</label>
|
||||||
|
<imagelabel>+64055:+127</imagelabel>
|
||||||
|
</seclabel>
|
||||||
|
</domain>
|
||||||
Loading…
x
Reference in New Issue
Block a user