I have Ubuntu 20.04 VM on Windows 11 host. The network is NAT
Windows 11 host IP = 192.168.10.25
VM IP = 10.0.2.25
ufw
is inactive
NAT ports forwarding rules on VirtualBox:
Rule #1: SSH
Protocol: TCP
Host IP: 0.0.0.0
Host Port: 22
Guest IP: 10.0.2.25
Guest Port: 22
-------------
Rule #2: HTTP
Protocol: TCP
Host IP: 0.0.0.0
Host Port: 80
Guest IP: 10.0.2.25
Guest Port: 8000
I have all ports open in the Windows 11 host firewall outbound and inbound rules.
From PC2 (a PC on the LAN), I am able to SSH to the VM with PuTTY using 192.168.10.25@22
Then I start the server on port 8000
on the VM, and it shows: Development server started on 127.0.0.1:8000
Then I go to the browser on 192.168.10.25
(no port because I forward 80
to 8000
), but I get "Site can't be reached".
Then I try to SSH from VSCode terminal and start the server again, and then VScode pops up a message saying "port 8000 forwarded automatically", and then I go to the browser on 127.0.0.1:8000
and it shows me the website.
How come it let's me see the website from PC2 which is separate from the host/VM and see it on its own loopback IP 127.0.0.1:8000
? And how to make it work from the correct IP?