Page 1 of 1
Network "NAT" mode and connect to the VM.
Posted: 8. Sep 2020, 20:45
by hack3rcon
Hello,
I installed a Linux VM on VirtualBox and the network setting is "NAT". I defined port forwarding and can connect to my VM via the Putty, but I want to scan my VM from Windows via Nmap. Is it possible via "NAT" ?
When I used "127.0.0.1" as target in the Nmap then it scan my host OS and not guest OS.
Thank you.
Re: Network "NAT" mode and connect to the VM.
Posted: 8. Sep 2020, 22:46
by scottgus1
If you can 'Nmap' one PC from another PC then
if you can Nmap through a router then
open ports in NAT required by Nmap
Nmap-scan other PC via 127.0.0.1:portnumber
end if
end if
Virtualbox Networks: In Pictures: NAT
Re: Network "NAT" mode and connect to the VM.
Posted: 9. Sep 2020, 11:52
by hack3rcon
scottgus1 wrote:If you can 'Nmap' one PC from another PC then
if you can Nmap through a router then
open ports in NAT required by Nmap
Nmap-scan other PC via 127.0.0.1:portnumber
end if
end if
Virtualbox Networks: In Pictures: NAT
I did it too but Nmap can't see my VM:

- VB-1.PNG (33.55 KiB) Viewed 1590 times
I can ping the VM:

- VB-2.PNG (12.59 KiB) Viewed 1590 times
But Nmap can scan the VM:

- VB-3.PNG (5.84 KiB) Viewed 1590 times
What the problem?
Re: Network "NAT" mode and connect to the VM.
Posted: 9. Sep 2020, 13:57
by scottgus1
First, if you are using plain NAT, the 'Pictures' tutorial will have informed you that you do not need to put host IP address or guest IP address in a NAT port forward. Added but unnecessary information may cause trouble.
If you can ping either way over a Virtualbox network, then the network is working and other programs' settings are interfering.
You are essentially trying to Nmap a computer behind a router from another computer on the internet, and you have control over the router.
Virtualbox is only providing the router and the target computer. Ask on a Nmap forum how to Nmap a computer behind a router. Apply the same methods to the NAT port forwarding and guest OS.
Re: Network "NAT" mode and connect to the VM.
Posted: 9. Sep 2020, 14:25
by hack3rcon
Thus, in this situation, the only option is using "Host-only Adapter" ?
Re: Network "NAT" mode and connect to the VM.
Posted: 9. Sep 2020, 14:40
by scottgus1
Host-Only is a private channel between host and connected guests. There is no 'router' or port forwarding in Host-Only. No internet either. Anything one can do over a regular network one could do with Host-Only.
Re: Network "NAT" mode and connect to the VM.
Posted: 9. Sep 2020, 15:50
by fth0
hack3rcon wrote:But Nmap can scan the VM: [...]
No, it cannot. (Re-)read the content of the picture you posted.
hack3rcon wrote:What the problem?
That you don't seem to know how to use NMAP.
Try
nmap -p 5060 127.0.0.1.