Skip to content

Instantly share code, notes, and snippets.

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

Keybase proof

I hereby claim:

  • I am markcaudill on github.
  • I am mcaudill (https://keybase.io/mcaudill) on keybase.
  • I have a public key whose fingerprint is 18CE 2C8A 296D 5D73 AE7E E794 2501 13B2 56B5 42E9

To claim this, I am signing this object:

@markcaudill
markcaudill / lic.sh
Last active September 30, 2022 18:35
#!/bin/bash
set -o pipefail
PREREQS=(curl fmt jq)
usage() {
cat <<USAGE
Usage: ${0##*/} [-h] [ID]
Generate a LICENSE.txt file.
@markcaudill
markcaudill / 55-bytes-of-css.md
Created September 29, 2022 12:30 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@markcaudill
markcaudill / centos8-sysprep.sh
Created November 23, 2021 15:42
An approximation of virt-sysprep
#!/bin/bash
systemctl stop rsyslog
# Cleanup (approximating the defaults of https://libguestfs.org/virt-sysprep.1.html#operations)
# Remove the crash data generated by ABRT
rm -rfv /var/spool/abrt/*
# Remove editor backup files from the guest
@markcaudill
markcaudill / zip_code_coordinates.csv
Last active March 31, 2020 15:39 — forked from erichurst/US Zip Codes from 2013 Government Data
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: https://www2.census.gov/geo/docs/maps-data/data/gazetteer
We can't make this file beautiful and searchable because it's too large.
ZIP,LAT,LNG
00601,18.180555,-66.749961
00602,18.361945,-67.175597
00603,18.455183,-67.119887
00606,18.158327,-66.932928
00610,18.294032,-67.127156
00612,18.402253,-66.711397
00616,18.420412,-66.671979
00617,18.447538,-66.557681
00622,17.991245,-67.153993
@markcaudill
markcaudill / app-track.sh
Created June 22, 2019 19:55
Linux App Usage Tracker
#!/bin/sh
DATABASE=${HOME}/.app-track.db
touch "${DATABASE}" && chmod 0600 "${DATABASE}"
active_window_id() {
xprop -root _NET_ACTIVE_WINDOW | rev | cut -d' ' -f1 | rev
}
window_pid_by_id() {
@markcaudill
markcaudill / README.md
Created November 8, 2017 15:15
letsencrypt certbot cloudflare zone pause and unpause

Description

This makes it easy to automate pausing your Cloudflare zone(s), renewing your letsencrypt certs, and then unpausing your zone(s).

Installation

  • Ensure python-cloudflare is installed either in system or virtualenv.
  • Make sure you chmod 0700 certbot-renew.sh before you add your credentials.
  • Replace your existing certbot renew cron job with something like @daily /path/to/certbot-renew.sh.
  • It's helpful to have MAILTO="youremail" in the top of your crontab to easily see the output whenever it runs.

Author

Keybase proof

I hereby claim:

  • I am markcaudill on github.
  • I am mcaudill (https://keybase.io/mcaudill) on keybase.
  • I have a public key whose fingerprint is 22DD 2ACE 6746 60A1 33A0 A523 2ED3 96FC E25E 7F77

To claim this, I am signing this object:

@markcaudill
markcaudill / gist:c161b4d30f7f7ffdabbe
Created June 15, 2015 11:44
BCM4352 on Fedora 22
# Install RPM Fusion
sudo dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm
sudo dnf install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-22.noarch.rpm
# The rest
sudo dnf install kernel-devel broadcom-wl akmod-wl akmods
sudo akmods
sudo reboot