3. Configure VirtualBox with the Topology

Figure 19. Interior Routing Network Topology

Interior Routing Network Topology

The top part of the figure shows the Layer 3 network topology diagram showing address interfaces (VLAN is used on most interfaces) and the switch they are plugged into. This is not a typical deployment of VLANs because the redundancy we achieve at the IP layer is undone by the single point-of-failure of Switch 2. The bottom part of the figure shows the Layer 1 physical topology diagram. You can use this diagram to appreciate how the network equipment would be physically connected in this lab.

In this section you will be using VirtualBox to create, configure and connect the devices in the network:

  1. You will define a virtual machine for each host and router in the network, connecting them appropriately to the switches, which will be created for you by Virtualbox. This defines the Physical layer topology (layer 1).

  2. After booting the devices in the network, you will configure the software inside them to build the Network layer toplology (layer 3).

Figure 19, “Interior Routing Network Topology” shows the topology at layer 3 (the Network layer: IP) and also at layer 1 (the Physical layer: the cables), to help you to appreciate how the devices would physically connect to each other.

Each of the switches will need to be created in our virtual environment, so they are given simple names Switch1, Switch2 and Switch3 so we can distinguish between them; better names might have been Core, AccessEast and AccessWest as one example of many.

Start up VirtualBox. We shall begin by adding the Router R1. As we can see from the network map R1 has three logical interfaces[80] but two physical interfaces. We need to say what physical interfaces (corresponding to ethernet cards on a real machine) we want each machine to have.

Create a machine, call it IntRoute_R1 or something suitable so you don’t get it confused with other machines in the lab and other machines you might create in a later lab. The routers are command-line only and don’t need much memory, but since they won’t have any swap, we don’t want to underestimate the amount of memory; 128 MB should be plenty. Because we are using a Live CD we don’t need a hard-disk, so don’t configure one. Have it boot only from CD/DVD-ROM, taking care to remove the floppy drive from the boot order.

Vyatta requires that the virtualised system has a CPU feature called Physical Address Extentions, so you will also require the Enable PAE/NX feature in the Processor section of the System tab.

In the Storage tab you will need to check Mount the CD/DVD Drive and use the ISO Image File. If the vyatta-livecd-virt_VC6.1-2010.10.16_i386.iso option is not present, click on the folder icon next to the drop-down box; click Add to register the ISO file with Vyatta so it now appears as a choice. Then you can click on Select to use the VC6.1 (Vyatta Community-edition version 6.1) ISO image.

For each router we will need to create a virtual floppy disk (another image file) to store our router configuration. To do this open a terminal window and type the following command to create a 1.44 MB (actually 2 MB, but close enough) file full of empty space. You could put these inside your home directory.

$ cd /Volumes/myvms/
$ for R in R1 R2 R3; do
> dd if=/dev/zero of=IntRoute_${R}_floppy.img bs=1m count=2
> done

Back in VirtualBox, add a floppy controller by clicking on the Add Controller icon (third button from the left under the Storage Tree) and selecting Add Floppy Controller. Then, on the new floppy controller, click the + icon. Click the Empty floppy and add the floppy you made, in much the same way as you did with the ISO file. This sequence is shown in Figure 20, “Adding a Floppy Controller and Disk to VirtualBox”. Remember that each machine will have a different floppy.

Figure 20. Adding a Floppy Controller and Disk to VirtualBox

Adding a Floppy Controller and Disk to VirtualBox

The sequence of steps for adding a floppy controller to a Virtualbox virtual machine, and assigning a floppy disk image to it. Note that you will only see the attributes shown after you click on the Empty floppy disk.

In the Network tab, we need to enable the particular virtual ethernet adaptors we need. R1 has two “physical” Ethernet adaptors: eth0 and eth1 (eth1 is split into two logical adaptors using VLAN). For all adaptors in this lab we want to use Attached to: Internal Network. Set the Network Name: field for R1’s Adaptor 1 (eth0) to the string IntRoute-Switch1. Enable R1’s Adaptor 2, and likewise connect it to IntRoute-Switch2; note that the first switch is now available in the drop-down box (we’ll use this later when configuring the other nodes in the network).

Don’t use the Intel PRO/1000 family of adaptors

For every adaptor used by the routers, particularly those connected to a VLAN trunk (ie. connected to the second switch), go into the Advanced adaptor properties, and set the Adaptor Type to either the Paravirtualised adaptor or the AMD PCNet Fast III.

This is because the Intel PRO/1000 family of adaptors will strip off the VLAN tags as they leave the machine, causing your routers not be able to communicate, which is highly annoying. There is no supported way inside Vyatta (or Linux in general) for changing this.

In the Ports tab, disable USB (routers don’t typically have USB ports) and also disable Enable absolute pointing device under the System tab; that option causes VirtualBox to use a virtual USB Tablet as a pointing device[81].

Back in in the Ports tab, enable the Serial port COM1 and set the Port Mode to Disconnected. Vyatta expects a COM1 (/dev/ttyS0 in Linux-speak) to be present so it can offer a serial-terminal, just like a real router. If this device is not present, it will occassionally complain, but it will still work. We shall use this later on in the next lab.

Now go on and configure all of the other routers and hosts. Remember that for the hosts C1 and C2 no floppy is needed and they will be booting from an Ubuntu Desktop Live CD. You can leave all other configurations according to their defaults, which should be reasonable if you selected Ubuntu Linux as the operating system type in the wizard. Take a screenshot of each of the configuration summaries shown by VirtualBox.

When you have configured virtual machines for R1, R2, R3, C1 and C2 you are ready to boot your routers and hosts. When powering on a network of machines, we need to consider the order of which machines are started. Clients will typically (though not in this particular lab) be configured to use various network services such as DHCP and DNS, so the network and the servers need to be available first. Therefore, start the routers first then the hosts when the routers have finished booting.

When the routers boot they might complain about the floppy disks, because we have essentially given them a floppy disk each with no filesystem on it, and it’s expecting to find a filesystem with configuration data on it. This is unlikely to be a problem for you initially, but you may still run into it if you reboot the router later.

Once you have them all running you may like to arrange them on your desktop into roughly the same shape as the topology; you may find that doing this helps you to trace how traffic moves through your network.

[80] Four if you count the loopback interface, but we don’t care about that at the moment.

[81] Which can be preferable because it means it doesn’t need to capture the mouse.