WSL dual system port mapping, the latest tutorial on network penetration

Table of contents

1 enter wsl

1.1 Enter root mode

1.2 Just install something

2 Open Win's PowerShell

2.1 View the ip address of the virtual machine

2.2 Port mapping and forwarding

2.3 Whether the verification is successful

2.4 Delete mapped port command


1 enter wsl

The ubuntuLiunx operating system is used here

Open wsl and search.

1.1 Enter root mode

Order

su root

1.2 Just install something

For example, 1panel panel to test it.

install command

curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh

After installation, we check the port number

Order

 netstat -ntlp

You can see that the port number is 26790

2 Open Win's PowerShell

Then we go back to the windows system, which is our main system

Run Windows PowerShell as administrator

2.1 View the ip address of the virtual machine

Order

wsl -- ifconfig eth0

Note that the ip address of our virtual machine is behind inet. Mine is 172.26.211.161

2.2 Port mapping and forwarding

Then we do port forwarding

Order

 netsh interface portproxy add v4tov4 listenport=26790 listenaddress=127.0.0.1 connectport=26790 connectaddress=172.26.211.161

 Check whether the port is set successfully, you can find that the mapping has been successful

2.3 Whether the verification is successful

Access the specified port in the win browser

1Panelicon-default.png?t=N4N7http://localhost:26790/

 OK, you're done, so just map whatever port you need

2.4 Delete mapped port command

 netsh interface portproxy delete v4tov4 listenport=你的端口 listenaddress=127.0.0.1 

END.....

Guess you like

Origin blog.csdn.net/qq_53679247/article/details/130885858