Problems with local networking on Kali Linux

7,160

I can access the Internet through the Iceweasel browser but ifconfig shows my IP address as 10.2.0.15 which is certainly not my IP address.

Yes, your IP address for the Kali Linux install in VirtualBox is indeed 10.2.0.15. VirtualBox has a virtual NAT server built-in to it’s software to allow for basic routing. Any basic VirtualBox install will be able to use DHCP to connect to use the host machine’s network via the NAT setup in VirtualBox.

But you say this:

I want to learn Metasploit but in order to build the payload I need an IP address.

What you are talking about is a different thing from the main IP address/interface. As explained before, any out-of-the-box install on VirtualBox will be able to use DHCP to connect to the VirtualBox NAT and get a network connection. But if you are looking for an IP address another machine/host can connect to outside of VirtualBox—such as connecting from the host machine to the Kali Linux setup you have—then what you need is a “host-only” adapter setup on another network adapter in VirtualBox in addition to your main network interface.

I have posted another answer with details on how I do this in VirtualBox for Mac OS X running an Ubuntu virtual machine, but the overall concept should be the same for your Kali Linux setup: You need to have your main NAT connected adapter setup as you already have but you also need a “host-only” adapter setup as well.

And then—as I explain in this other answer here—you could connect to your guest OS Kali Linux install from the host OS via the router address of 192.168.56.1.

Share:
7,160

Related videos on Youtube

Jeetesh
Author by

Jeetesh

Updated on September 18, 2022

Comments

  • Jeetesh
    Jeetesh over 1 year

    I installed Kali Linux on VirtualBox recently.

    I do not have an external adapter; only my internal adapter.

    The problem is when I set “VirtualBox -> Settings -> Network ->Adapter1 -> NAT” I can access the Internet through the Iceweasel browser but ifconfig shows my IP address as 10.2.0.15 which is certainly not my IP address.

    I tried to set Adapter 2 to Bridged Network but when I do that I cannot even access the Internet through my browser. I tried installing Compat wireless but that does not solve the problem.

    I want my IP address should be either the IP of my host computer or another seperate of the guest OS. I am stuck on this problem for months.

    I want to learn Metasploit but in order to build the payload I need an IP address. Hence my learning has halted.

    • Admin
      Admin over 8 years
    • Admin
      Admin over 8 years
      @CanadianLuke Ehhh, that’s about how VM Ware handles IP addresses and implies the only choice is NAT or bridged mode. The problem is in many cases, users can’t request another IP address from a router due to network configuration and such. So setting up a “host-only” adapter like my answer explains is a great way to make sure your host OS has only one IP but your guest OS on the VM can have multiple connections or inward and outward communication.
    • Admin
      Admin over 8 years
      From what I read, it's virtually (no pun intended) the same question, being asked with a different end objective, but still needing a very similar answer
  • Jeetesh
    Jeetesh over 8 years
    so for now should i set adapter1 to NAT and adapter2 to host only
  • Giacomo1968
    Giacomo1968 over 8 years
    @Jeetesh Exactly.
  • Jeetesh
    Jeetesh over 8 years
    so for metasploit payload my LHOST will be 192.168.56.1
  • Giacomo1968
    Giacomo1968 over 8 years
    @Jeetesh Yes, if you set it up the way I explain it in the other posts. But FYI, this site is not a chat forum. It is for real questions and real answers. So I cannot help you any further. Just review my other answers and understand you need to setup your second adapter to be “host-only” and you should be good.
  • Jeetesh
    Jeetesh over 8 years
    THANKS A LOT I was stuck on this for a long time..all the google searching was futile