My main dev environment is windows convenient WSL2, however the WSL2 instance is isolated from the host machines IP, leading to some issues when it comes to accessing ports WSL ports on my LAN. Specifically the issue I ran into was when building packer and automating my Ubuntu 20.04 install. After some research I found that restricting the subiquity port and port forwarding vis netsh successfully allows packers http server to be reached on my host machines LAN.
Code and Commands
First you need to edit your packer file to restrict the http ports to a single port so you can port forward.
I have included a sample .pkc.hcl file below, the static port configuration is achieved on code lines 30 and 31 by defining http_port_max and http_port_min
Next you will port forward the WLS2 port to your windows host machine with the below command in command prompt (as admin)
netsh interface portproxy add v4tov4 listenport=8336 listenaddress=0.0.0.0 connectport=8336 connectaddress=