Skip to content

Instantly share code, notes, and snippets.

View johnathanmay's full-sized avatar

Johnathan May johnathanmay

View GitHub Profile

How To Create Stable Private Network On Hyper-V

If you find yourself stuck in a situation where you have to use Hyper-V and you hate how it doesn't come with the ability to keep the same static IP range for your private VLAN after a reboot, this gist might be for you. It shows the powershell commands to create a new private VLAN, configure it to NAT all outbound traffic, and assign the interface a static IP that doesn't change when your computer reboots. It also shows how to create and configure a very simple VM running dnsmasq that will always start at boot and handle all your DHCP needs on the private interface.

The example below uses the 172.26.48.0/22 subnet. Please be sure to update the code as needed to reflect whatever subnet you want to use.

Create Private Network

New-VMSwitch -SwitchName "internal-172.26.48.0-22" -SwitchType Internal -Verbose

Common Powershell Commands

PowerShell Basics

#list powershell version and installed modules 
Get-Host | Select-Object Version
$PSVersionTable.PSVersion
Get-InstalledModule

Uncommon Linux Commands

This is a collection of linux commands that have been helpful to me but mostly not used often enough to just remember them off the top of my head. Some are definitely better documented than others...

Active Directory / SSSD / Samba

# various methods to join and remove from AD based on OS version and AD settings
kinit admin@CORP.DOMAIN.COM
net ads join -v -k -U admin@CORP.DOMAIN.COM createcomputer="/ORG/Servers/LinuxServers"
@johnathanmay
johnathanmay / logitech-mx-master-3-extras-for-linux-with-logiops.md
Last active April 5, 2024 10:01
How to install and configure PixlOne's logid to program Logitech MX Master 3 buttons on Linux.

Logitech MX Master 3 Extras for Linux With logiops

The Logitech Options program isn't available for Linux, but by a nice guy on GitHub (PixlOne) created an open source project that lets you obtain some of that functionality. It's called logiops. It works in conjunction with the Solaar project as well, which I find especially handy since that shows your available battery life in the system tray and lets you pair/unpair devices with the Logitech Unifying Receiver.

Here are some additional pages with info that I used to generate this documentation: