Exercise 4: setup a Kali VM (VM2), configuring the Ubuntu 16.04 (VM1) as a router
The purpose of this exercise is to modify our VM environment to support a second VM, and to learn details of necessary network concepts to get the environment to work. New concepts or items include: 1)Kali; 2)using iperf3 and traceroute; 3)Intro to linux fw and NAT;
Submission: Copy and Paste results from traceroute and iperf3 (detailed at end of this page) - submit a single PDF file to handin.
The steps for this exercise: setup VM2 (Kali), setup the networking environment, test/validate
Setup VM2
Refer to the main VM setup page as some of the steps are described in more detail on that page.
download the Kali Linux 64 bit ISO (version 2016.2) and follow the procedures in the setup page
Specific for Kali:
Setup the network
Setup the following network, with Kali Linux (VM2) and Ubuntu 16.04 (VM1) serving as the router.
External Network---- Host OS ---- VM1 ------ VM2
The VM1 - Host OS network can be either bridge or NAT with port forwarding. You need to find a way to access your VM1 from the outside.
For the network connecting VM1 - VM2 - use an 'internal network' or 'Host only' network. The following uses the VirtualBox internal network.....
- In The VMM preferences, under Networks, I do not have any type of network showing (nothing to add or create for internal network)
- In VM1's Machine config, in Networks, adapter 1 is NAT, adapter 2 is internal network.
- In VM2's Machine config, in Networks, adapter 1 is internal network (only 1 network interface needed).
Next, follow the instructions on the setup page to setup the networks in Linux. When setting up Linux config on VM1, use static IP address such as 192.168.2.1, a subnet mask of 255.255.255.0. Do NOT set the GW address. Select Routes and then select the config box that says this host will use the resources on this network locally. On VM2,use a static address such as 192.168.2.100 and set the interface's GW to point to VM1's interface (192.168.2.1 in my example).
Issue the following to configure to forward packets AND to do NAT for packets over the 10.0.2.15 interface (make sure to use the right interface name....it is the interface that is used to access the outside world)
- sudo sysctl net.ipv4.conf.all.forwarding=1
- sudo iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 10.0.2.15
- Note: you can use this script to do this....
- sudo ./setupVMRouter.sh NAT eth0
- Note: you can also use this script to setup rate control between VM1 and VM2:
- sudo ./setupVMRouter.sh start eth0
Check connectivity from VM2, all of these should now work:
- ping 192.168.2.1.
- ping 8.8.8.8
- traceroute -I 8.8.8.8
Testing/validating :
- Issue a traceroute from VM2 and Google's DNS Name Server 8.8.8.8. (use either UDP or ICMP - whichever works better).
- Issue a traceroute from your Host OS to 8.8.8.8 (again, UDP or ICMP)
- Issue iperf3 between your VMs - use TCP and default parameters. It does not matter which VM is the client and which is the server.
Your actual results depend on where you are at....
#1
- traceroute -I 8.8.8.8 ; I see 16 hops, with only 3 willing to show its IP address.
traceroute to 8.8.8.8 (8.8.8.8), 64 hops max
1 192.168.2.1 0.203ms 0.193ms 0.190ms
2 10.0.2.2 0.328ms 0.275ms 0.216ms
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 8.8.8.8 33.364ms 34.374ms 31.883ms
#2
- From my windows machine:
- Tracing route to google-public-dns-a.google.com [8.8.8.8]
over a maximum of 30 hops:
- 1 28 ms 16 ms 14 ms 130.127.3.114
2 38 ms 13 ms 13 ms sox-atl.clemson.edu [130.127.3.6]
3 25 ms 15 ms 15 ms 130.127.3.17
4 41 ms 20 ms 13 ms 205-186-224-81.generic.sclightrail.net [205.186.224.81]
5 17 ms 18 ms 17 ms 64.57.21.214
6 32 ms 28 ms 28 ms et-10-0-0.1190.rtr.ashb.net.internet2.edu [64.57.21.213]
7 36 ms 39 ms 34 ms 162.252.69.133
8 41 ms 39 ms 29 ms 108.170.240.113
9 34 ms 39 ms 28 ms 216.239.48.101
10 38 ms 44 ms 41 ms 209.85.255.244
11 49 ms 49 ms 42 ms 74.125.37.69
12 * * * Request timed out.
13 60 ms 49 ms 44 ms google-public-dns-a.google.com [8.8.8.8]
- Trace complete.
#3
Perform iperf3 between VM2 and VM1
- At VM1: iperf3 -s -p 5001
- at VM2: iperf3 : TCP flow - result is about 2Gbps
- iperf3 -c 192.168.2.1 -p 5001 -i 1
- at VM2, iperf3: UDP flow :
result is about 2 Mbps
- iperf3 -c 192.168.2.1 -p 5001 -u -i 1 -b 2M
Last update: 3/22/2017