Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I am beginning to learn Metasploit and, to play safe, am practicing it out on a virtual machine.

The target machine, which is a virtual machine, is under NATing. How do I access it/ connect to it- from within the same network? outside the network?

From where do I get the IP address of that virtual machine?

share|improve this question
    
What tool are you using to virtualize the machine (VirtualBox, VmWare, other?) –  Jontas May 22 '12 at 10:31

4 Answers 4

up vote 4 down vote accepted

When I use VirtualBox I set the network to "Bridged adapter", that way I can get a ip from the DHCP server on the network. And once I have that I can us the tools that are built in the OS (ifconfig/ipconfig) to get the ip I am assigned right now.

And in order to connect to the Machine I either start the machine from VirtualBox directly so I get a "head" (get a virtual screen) or using headless with RDP enabled (so I can connect using some sort of RemoteDesktop client to connect to VirtualBox and get the Virtual monitor remotely).

Simpler instructions for VirtualBox: Open the VirtualBox Manager, select your virtual machine. Then choose settings for this machine, network and change the dropdown that says "NAT" to "bridged" a new dropdown will be activated where you have to select what network (card) it should bridge with. Once this is done, simply "Start" the virtual machine, log in to it and if it is linux/unix use "ip addr show" from a console, if it is windows start a "cmd" and use "ipconfig" (or check from the control panel)

share|improve this answer
    
Thanks Jontas. I am using VirutalBox, so i think your answer should suit me well. Although if you tell things in a more detailed/graphic way (layman language), it would be helpful - i am quite a newbie... –  pnp May 22 '12 at 10:55
    
Updated with a simple description of how to set up bridging on VirtualBox –  Jontas May 22 '12 at 12:11
    
Thanks a lot for the inputs...and thanks @Chris too –  pnp May 22 '12 at 12:30

Not really a security related question but here you go:

Depending on the configuration, you may find it hard to connect to your VM if it's configured as NAT. NAT insulates your VM from the outside world but it's a layer of complexity you probably don't want to deal with when learning.

If you're using something like Metasploitable it comes with so many services running that you really don't want to bother pinholing them all through the NAT configuration.

When configuring a VM that you may want to interface with, it's usually a better idea to configure it in "bridged" networking mode so that it can be available on your network.

If you're running DHCP on your network the VM will get the address from your DHCP server and you can connect to it from any host on your network. You can find the IP address of a Linux system by issuing the comment ip addr list.

share|improve this answer
    
Yes Chris I agree it is not really a security related question. But if I ask it elsewhere, I many not get an answer for the conext i am looking for. Thanks for the input, although most of it goes above my head. Could you tell things in somewhat layman language- i am quite a newbie. –  pnp May 22 '12 at 10:53

Set the connection to bridged.

Depending on the OS.. Type "ifconfig" in unix to get the IP Type "ipconfig" in windows to get the ip

You now have the IP to connect to :)

=====================

Or do it like in a proper penetration test and scan the network to find the box you are looking for.

nmap -sP 192.168.2.1/24

Replace the IP with the corresponding one for your subnet.

share|improve this answer
    
what does it exactly mean by setting the connection to bridged? –  pnp May 22 '12 at 10:58
    
bit.ly/MD1ZVZ –  h00j May 22 '12 at 10:59

I'd actually disagree with most here and advise you to go to host only mode. This means go to File > Preferences > Network and click on the add adapter button. This creates a virtual network interface on your computer.

At that point you can go to your vulnerable VM > settings > network > Host-only adapter. This means only your main PC which is running the VM or other virtual machines can interact with the VM. You still get separate IP addresses etc, but you should really never have deliberately vulnerable machines on your live network. It will be perfectly suitable for pen testing, and is infact the recommended setting for deliberately vulnerable VM's such as metasploitable.

Find your IP address the way you would for that style of machine, typically typing ipconfig in cmd for windows or ifconfig in terminal for a linux based system.

This protects you accidentally exposing it externally.

Edit: Dammit I didn't see this had been raised from ages ago for some reason.

share|improve this answer
    
but doesnt that limit me to doing a pen-testing of the VM only from my host ? And say if i want a small network of such machines, you cant expect one host to run several VMs, can you (unless i have some 32GB of RAM or something)... –  pnp Feb 27 '13 at 9:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.