I was at a monthly InfoSec meetup last week ready to start a CTF. I’d set up my Kali VM day before (inspiring me to write this amazing guide). I knew how to connect to two networks beforehand, but it just wasn’t working for me that night.
So, I’ve finally got it up and running. Let’s do it together!
First thing’s first. Let’s set up the network adapters. Open up VirtualBox, click the Kali VM, then click Settings.
My first adapter is my Host-only Adapter. This allows all the VMs to communicate on a separate network internally on my host machine.
Now, I want my Kali VM to be able to access the Internet as well. Rather than constantly switching between my host and VM to Google stuff, I’d rather just do it all in the one machine (which also simplifies copy and pasting). So, let’s set up an adapter with NAT. This essentially sets up the VM as a separate machine and gets its own IP on the network.
Simple, right? That’s what I thought last week. Then I booted into Kali and found I only had access to one network, and could only switch between them.
So I spent ages trying to mess around with VirtualBox settings. Got nowhere.
Alas, StackOverflow comes my rescue yet again. I just need to edit the /etc/network/interfaces file to set both adapters up on boot.
Let’s open it up.
1 |
[email protected]:~# vi /etc/network/interfaces |
Here’s what mine looked like before I tinkered with it.
1 2 3 4 5 6 7 8 |
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback |
I want both
eth0 and
eth1 (the two adapters we set up) to be activated on boot.
auto does that. Now I want to configure both to get an IP address. That’s what
iface
So here’s what it looks like after.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # Host-only auto eth0 iface eth0 inet dhcp # NAT auto eth1 iface eth1 inet dhcp |
Now let’s boot up and see if it worked:
Woo.
Note: For anyone who’s struggling with DNS issues, you’ll need to set your NAT adapter to be the last interface in /etc/network/interfaces.
Thanks for this. Sorted out the same problem I was having with Workstation.
Much thanks, this solved my problem i got 🙂