Archive for January, 2023

Jan 31 2023

KVM add device

Add hostdev for VF in <devices>. In <source>/<address> use physical address for VF

<hostdev mode='subsystem' type='pci' managed='yes'>
     <source>        
         <address domain='0x0000' bus='0x5e' slot='0x0e' function='0x0'/>
    </source>      
    <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>  
</hostdev>
Jan 31 2023

KVM install VM with vnc server

Install from img file (with disk size 15G and bridge name inner)

virt-install \
--name=bull \
--vcpus=8 \
--memory=24576 \
--disk path=/var/lib/libvirt/images/bull.qcow2,size=15 \
--cdrom /var/lib/libvirt/iso/debian-11.6.0-amd64-netinst.iso \
--network bridge=inner,mac=52:54:00:40:4a:5e \
--boot hd,uefi \
--machine q35 \
--osinfo detect=on,require=off \
--graphics vnc,listen=<IP_HOST_TO_LISTEN_TO>,password=<SECRET>
Install from PXE
virt-install \
--name=rhpxe \
--vcpus=4 \
--memory=2048 \
--network bridge=br0,mac=52:54:00:0e:27:FF \
--pxe \
--disk none \
--boot uefi \
--osinfo detect=on,require=off \
--graphics vnc,listen=<IP_HOST_TO_LISTEN_TO>,password=<SECRET> 

Jan 31 2023

Mikrotik port forward / redirect

/ip firewall nat add chain=dstnat dst-port=1234 action=dst-nat protocol=tcp to-address=192.168.1.1 to-port=1234
Jan 27 2023

Delete old files

Find only executable
find

-executable -type f

Delete old files

find /path/to/dir/ ( ( -type f -daystart -mtime +8 ) -o -type d -empty ) -delete
Jan 7 2023

How to download all files (but not HTML) from a website using wget?

wget -A lst,meta,txt,txz,tgz,asc,md5 -m -p -E -k -K -np <URL>