I want to route all traffic from Windows to WSL2 (172.28.20.4), but I have little knowledge about networking.
I did try to add a route:
route add 0.0.0.0 mask 0.0.0.0 172.28.20.4
I also enabled IP forwarding in WSL2 and I ran this command sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
which produce :
Network destination Network mask Adr. gateway Adr. Metric interface 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.37 35 0.0.0.0 0.0.0.0 172.28.20.4 172.28.16.1 5001 127.0.0.0 255.0.0.0 On-link 127.0.0.1 331 127.0.0.1 255.255.255.255 On-link 127.0.0.1 331 127.255.255.255 255.255.255.255 On-link 127.0.0.1 331 172.28.16.0 255.255.240.0 On-link 172.28.16.1 5256 172.28.16.1 255.255.255.255 On-link 172.28.16.1 5256 172.28.31.255 255.255.255.255 On-link 172.28.16.1 5256 172.28.192.0 255.255.240.0 On-link 172.28.192.1 5256 172.28.192.1 255.255.255.255 On-link 172.28.192.1 5256 172.28.207.255 255.255.255.255 On-link 172.28.192.1 5256 192.168.1.0 255.255.255.0 On-link 192.168.1.37 291 192.168.1.37 255.255.255.255 On-link 192.168.1.37 291
The problem is that eth0 (172.28.20.4) is behind a NAT so if I remove0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.37 35
I wouldnt be able to access internet anymore.