mirror of
				https://github.com/shokinn/.files.git
				synced 2025-11-04 12:38:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			12 lines
		
	
	
	
		
			702 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
	
		
			702 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
#
 | 
						|
# {{@@ header() @@}}
 | 
						|
#
 | 
						|
 | 
						|
HYPER_V_SWITCH_ADDRESS=$(powershell.exe 'Get-NetIPAddress -ifAlias "vEthernet (Default Switch)" -AddressFamily IPv4 | Select -ExpandProperty IPAddress')
 | 
						|
HYPER_V_SWITCH_ADDRESS="${HYPER_V_SWITCH_ADDRESS%.*}.0"
 | 
						|
HYPER_V_SWITCH_PREFIX_LENGTH=$(echo "$(powershell.exe 'Get-NetIPAddress -ifAlias "vEthernet (Default Switch)" -AddressFamily IPv4 | Select -ExpandProperty PrefixLength')" | tr -d '\r')
 | 
						|
WSL_SWITCH_ADDRESS=$( echo "$(powershell.exe 'Get-NetIPAddress -ifAlias "vEthernet (WSL)" -AddressFamily IPv4 | Select -ExpandProperty IPAddress')" | tr -d '\r')
 | 
						|
 | 
						|
sudo ip r add ${HYPER_V_SWITCH_ADDRESS}/${HYPER_V_SWITCH_PREFIX_LENGTH} via ${WSL_SWITCH_ADDRESS}
 |