Skip to content

Instantly share code, notes, and snippets.

@573
573 / readme.md
Last active December 11, 2022 05:35
cisco anyconnect vpn wsl2 resolv.conf issue again

TLDR; https://jamespotz.github.io/blog/how-to-fix-wsl2-and-cisco-vpn, but certain internal resources are still not available after doing this (in case u need them re-anyconnect), others are though. toggling the metric priority is key here as well.

This and followup posts (even an automation) probably work as well, haven't tested yet microsoft/WSL#5764 (comment)

Also this could work, not tested yet as I did not check the sources https://wheatevo.com/wsl-2-vpn-routing-fix/

The article on msdn doesn't seem to apply for my case (wsl2, cisco anyconnect vpn)

I have some articles tagged [wsl2, vpn, wsl2-issue] that seem to approximate an automatable fix (microsoft/WSL#1350 (comment) etc.), but one of them really provides a very fast fix serving as the very baseline of all automating: microsoft/WSL#5068 (comment)

@machuu
machuu / WSL2_VPN_Workaround_Instructions.md
Last active April 18, 2024 23:13
Workaround for WSL2 network broken on VPN

Overview

Internet connection and DNS routing are broken from WSL2 instances, when some VPNs are active.

The root cause seems to be that WSL2 and the VPN use the same IP address block, and the VPN routing clobbers WSL2's network routing.

This problem is tracked in multiple microsoft/WSL issues including, but not limited to:

@sivinnguyen
sivinnguyen / wsl2_200915_fix_dns_resolution.md
Last active April 12, 2024 07:30
Fix DNS resolution in WSL2

Error

$ sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure in name rerolution

$ host google.com
;; connection timed out; no servers could be reached
@miztiik
miztiik / .gitignore
Created February 13, 2020 23:17
Sample .gitignore file for AWS CDK Python projects
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active April 30, 2024 09:07
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@btotharye
btotharye / app.py
Last active May 9, 2021 17:09
CDK Python VPC with Flow Logs
#!/usr/bin/env python3
from aws_cdk import core
from cdk.cdk_stack import CdkStack
app = core.App()
# Params and stage info
alias ls='ls --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Add an "alert" alias for long running commands. Use like so:
@nfekete
nfekete / wsl-fix-resolvconf.sh
Created August 8, 2018 03:05
Fix resolv.conf in Windows Subsystem for Linux, when WSL doesn't correctly generate it.
#!/bin/bash
TMP=`mktemp`
trap ctrlC INT
removeTempFiles() {
rm -f $TMP
}
ctrlC() {
@shortjared
shortjared / list.txt
Last active April 28, 2024 07:20
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@juanarbol
juanarbol / chmodCheatSheet.md
Last active April 10, 2024 19:17
Chmod cheat sheet

Chmod codes cheat sheet

How to use chmod codes in UNIX:

  1. There are three types of permissions in files and folders in unix
    1. Read (r)
    2. Write (w)
    3. Execute (x)
  2. And, there is a classification of users called UGO (explained bellow):
  3. U ~> User (usually, you)