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.