IP Library Granted Patent US 12669987
Granted Patent B2
US 12669987 · App. 18/647,796 · Granted Jun 30, 2026

Intelligent port mapping method for WSL2 system

Inventors: Hengkai Lian (Guangzhou, CN); Changhua Zhang (Guangzhou, CN); Zhenghui Zhu (Guangzhou, CN); Dingjin Zhao (Guangzhou, CN)
Assignee: GUANGDONG BAOLUN ELECTRONICS CO., LTD.
G06F8/61H04L67/1097
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12669987
App. No.
18/647,796
Granted
Jun 30, 2026
Kind
B2
Abstract

An intelligent port mapping method for a WSL2 system, including: installing a WSL2 subsystem and a BAT script, setting the WSL2 subsystem and the BAT script as automatic starting, and initializing a computer; a WSL2HOST service monitoring whether the IP of the WSL2 subsystem has changed, and if yes, writing a new IP address into a hosts file, used for domain name-IP address mapping relation management, in a Windows 10 system; the BAT script reading file data in the hosts file every m seconds, analyzing, according to the read file data, whether the IP address recorded by a host where the Windows 10 system is located has changed; and the BAT script mapping, according to the new IP address, all ports required by a WSL subsystem service to complete port mapping.

Claims (9)

1 . An intelligent port mapping method for a WSL2 system, comprising the following steps:

step 1 : installing a WSL2 subsystem and a BAT script in a target Windows 10 system, setting the WSL2 subsystem and the BAT script as automatic starting, and

initializing a computer;

step 2 : When a WSL2HOST service determines that the IP of the WSL2 subsystem has changed, writing a new IP address into a host file, used for domain name-IP address mapping relation management, in the Windows 10 system and performing step 3 ;

step 3 : the BAT script reading file data in the hosts file every m seconds, analyzing, according to the read file data, whether the IP address recorded by a host where the Windows 10 system is located has changed; if yes, performing step 4 ; and if not, reading the file data in the hosts file after resting for n seconds;

step 4 : the BAT script mapping, according to the new IP address, all ports required by a WSL2 subsystem service to complete port mapping between the WSL2 subsystem and the Windows 10 system.

2 . The intelligent port mapping method for a WSL2 system according to claim 1 , wherein after completing step 4, performing step 3 again, and monitoring whether the IP address has changed for the next time to realize dynamic port mapping when the IP address has changed.

3 . The intelligent port mapping method for a WSL2 system according to claim 1 , wherein in step 3, analyzing an analytic record of a debian.wsl fixed host in the hosts file to judge whether the IP address has changed.

4 . The intelligent port mapping method for a WSL2 system according to claim 1 , wherein m=3, and n=10.