|20-CS-6055-00X||Cyber Defense Overview||Fall 2017|
VirtualBox Guest-Host Communication
The default network configuration for a VirtualBox VM is a NAT adapter. This allows VMs to `see' machines beyond the host but not the host and other VMs. Since labs in this course will usually involve three or more machines that must have access to each others transmissions, a different network configuration needs to be used. VirtualBox solves the above problem with a `host-only' adapter.
Host-Only Adapter Definition
Drop the `File' menu and select `Preferences'. Select `Network'. A window such as the following appears, after the `Host-Only Networks' tab is selected:
Click the small square icon with a `+'. This creates a new host adapter called `vboxnet0'. Double click on `vboxnet0'. The default settings for the host adapter are shown as in the following window:
Click the 'DHCP Server' tab and enable the dhcp server. Input a range that does not overlap with the server's IP address. The first three bytes of the range are the same as the server's but the last byte might be 100 for the range start and 200 for the range end.
Host-Only Adapter Setup
I found that NAT interferes with Host-Only so click on `NAT' and select `Not Attached'. Then click on `Adapter 2' and enter the information below, if it is not there already:
Note the use of the `vboxnet0' adapter that was defined globally. Start the VM by clicking on the green arrow (see the first figure of the previous section).
Test the results
vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00 inet addr:192.168.56.1 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:305 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:52301 (52.3 KB)Open a shell in the guest machine (probably Kali) and execute `/sbin/ifconfig'. Note the name of the interface that will be used to connect with the host. It is probably `eth0' or `eth1'. Suppose it is `eth0'. Then execute:
`sudo /sbin/ifconfig eth0 192.168.56.150 netmask 255.255.255.0 up'
Execute `/sbin/ifconfig' again to find something like this:
eth0 Link encap:Ethernet HWaddr 08:00:27:91:74:9d inet addr:192.168.56.150 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe9a:749d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:37 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:7182 (7.0 KiB)From the host's shell execute:
and see this:
PING 192.168.56.150 (192.168.56.150) 56(84) bytes of data. 64 bytes from 192.168.56.150: icmp_seq=1 ttl=64 time=1.34 ms 64 bytes from 192.168.56.150: icmp_seq=2 ttl=64 time=0.763 ms 64 bytes from 192.168.56.150: icmp_seq=3 ttl=64 time=0.621 ms 64 bytes from 192.168.56.150: icmp_seq=4 ttl=64 time=0.842 ms 64 bytes from 192.168.56.150: icmp_seq=5 ttl=64 time=1.02 msStart a second VM and change the network adapter from `NAT' to `Host-Only' using `vboxnet0' (which is probably the only choice at this point anyway). Then open a shell in the second VM and execute:
To find the interface that will connect to the host and then, assuming it is `eth0', execute
`sudo /sbin/ifconfig eth0 down'
`sudo /sbin/ifconfig eth0 192.168.56.151 netmask 255.255.255.0 up'
Then from the host execute `ping 192.168.56.151' to see output similar to that above. From the first VM exeute:
and from the second VM execute
to check communications between the guests.