Skip to content

Instantly share code, notes, and snippets.

View gdesatrigraha's full-sized avatar

Gde Mahardhikha Satrigraha gdesatrigraha

  • Spenmo
  • Indonesia
View GitHub Profile
@gdesatrigraha
gdesatrigraha / exposing home network through wireguard.md
Last active June 7, 2024 16:59
exposing home network through wireguard

exposing home network with wireguard

home network:

  • opnsense router
  • lan subnet: 192.168.101.0/24
  • wireguard subnet: 192.168.102/24

vps:

  • 1 public ip

steps

c2:d1:05:16:b0:b5

VFIO on Fedora 34

Reference: https://qubitrenegade.com/virtualization/kvm/vfio/2019/07/17/VFIO-Fedora-Notes.html
This method of VFIO supports identical GPU as described in the original reference.
This gist is only to fix some typo or error I encountered when applying the steps decribed in the original reference, while also adding my own customization.

Machine Spec:

CPU: AMD Ryzen 1700
RAM: 64GiB (20GiB will be dedicated to the Guest)

Installing Debian on btrfs subvolume

Install debian as usual:

  • EFI partition ~256M, boot, esp flags
  • ext2 boot partition ~512M
  • luks cyrpt volume
    • LVM pv
      • swap ~5G
      • btrfs

When the installation is finished, boot into SystemRescueCD.

ID 46f4:0001 QEMU QEMU USB HARDDRIVE
@gdesatrigraha
gdesatrigraha / redis-tcpkill.sh
Created October 21, 2020 07:52
installing tcpkill and blocking redis connection on centos 7
yum --enablerepo=extras install epel-release
yum -y install dsniff
tcpkill -i eth0 -9 port 6379
#!/bin/sh
# create ovs bridge named bridge0
nmcli conn add type ovs-bridge conn.interface bridge0 autoconnect yes
# add add a port to the bridge for the internal ovs interface (iface0)
nmcli conn add type ovs-port conn.interface port0 master bridge0 autoconnect yes
# add internal ovs interface to the create port0
nmcli conn add type ovs-interface conn.interface iface0 master port0 autoconnect yes ipv4.method auto
@gdesatrigraha
gdesatrigraha / iptables-enable-ip-masquerading.sh
Last active October 2, 2018 13:34
iptables enable ip masquerading
#!/bin/sh
iptables -t nat -A POSTROUTING -o <eth0 or whatever else> -j MASQUERADE
# to persist the rule, install iptables-persistent package
@gdesatrigraha
gdesatrigraha / linux-fix-monitor-resolution.md
Last active November 24, 2023 06:43
fixing monitor resolution on linux with nvidia GPU

Fix monitor resolution on linux with nvidia GPU because the monitor EDID information is unavailable.
This fix assume we are using multiple monitor setup with the same monitor, so we can grab the EDID information of the monitor, from the other monitor attached to another output port (D-SUB, DVI, HDMI, DisplayPort)

In my setup, I have 3 Dell S2415H attached to D-SUB, HDMI, and DVI port.
The monitor which was attached to the D-SUB port (VGA-0), doesn't has any EDID information available, thus I was unable to use the native 1920x1080 resolution.

Step to overcome the situation:

  • install nvidia driver
  • dump binary monitor EDID data using nvidia-settings:
  • run the nvidia-settings app
@gdesatrigraha
gdesatrigraha / linux-gpu-passthrough.md
Last active December 29, 2023 07:04
personal notes on trying gpu-passthrough with ubuntu 18.04

command: apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager ovmf qemu-utils hugepages

command: for iommu_group in $(find /sys/kernel/iommu_groups/ -maxdepth 1 -mindepth 1 -type d); do echo "IOMMU group $(basename "$iommu_group")"; for device in $(ls -1 "$iommu_group"/devices/); do echo -n $'\t'; lspci -nns "$device"; done; done outputs:

IOMMU group 17
	0a:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] [10de:1c03] (rev a1)
	0a:00.1 Audio device [0403]: NVIDIA Corporation GP106 High Definition Audio Controller [10de:10f1] (rev a1)
IOMMU group 16
	09:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK208 [GeForce GT 710B] [10de:128b] (rev a1)
@gdesatrigraha
gdesatrigraha / gist:701416a3e67feab36755
Last active August 29, 2015 14:08
ubuntu common setup
sudo apt-get update
sudo apt-get -y install --reinstall language-pack-en
sudo echo 'LC_ALL="en_GB.utf8"' >> /etc/environment
sudo apt-get -y install python-software-properties apt-file software-properties-common
#apt-file is useful to locate a file in apt, ex: apt-file search add-apt-repository
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer