Last active
September 29, 2023 16:37
-
-
Save rnascimento13/97ee87d059ff1ebe1e9945c61cda2297 to your computer and use it in GitHub Desktop.
windos network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---# WSL ip and gateway address | |
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\NatNetwork /v 1 /t REG_SZ /d "192.168.15.19/24" | |
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\NatGatewayIpAddress /v 1 /t REG_SZ /d "192.168.15.1" | |
------ | |
Run this on your windows host machine: | |
netsh interface ip add address "vEthernet (WSL)" 192.168.99.1 255.255.255.0 | |
And this on your wsl linux machine: | |
sudo ip addr add 192.168.99.2/24 broadcast 192.168.99.255 dev eth0 label eth0:1; | |
------ | |
sudo ip address add 192.168.15.5/24 brd + dev eth0 | |
New-NetFirewallRule -Name 'WSL' -DisplayName 'WSL' -InterfaceAlias 'vEthernet (WSL)' -Direction Inbound -Action Allow | |
New-NetIPAddress -InterfaceAlias 'vEthernet (WSL)' -IPAddress '192.168.15.5' -PrefixLength 24 | |
---# windows ip and port redirect | |
netsh interface portproxy add v4tov4 listenport=22 listenaddress=192.168.15.6 connectport=22 connectaddress=172.18.143.147 | |
#check | |
netsh interface portproxy show all | |
#delete | |
netsh interface portproxy delete v4tov4 listenport=22 listenaddress=192.168.15.6 protocol=tcp | |
---# windows static ip change | |
netsh interface ip set address "vEthernet (WSL)" static 192.168.15.26 255.255.255.0 192.168.15.1 | |
netsh interface ipv4 set address "vEthernet (WSL)" static 192.168.15.26 255.255.255.0 192.168.15.1 | |
netsh interface ipv4 set dns name="vEthernet (WSL)" static 8.8.8.8 | |
netsh interface ipv4 set address "vEthernet (WSL)" source=dhcp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment