IP networks Introduction to laboratory Piotr Pacyna, Katarzyna Kosek-Szott, Szymon Szott Working environment Laboratory exercises are based on netkit (www.netkit.org), a virtualization system, which allows to start multiple linux-based hosts as processes in a linux operating system. Netkit uses virtual hosts, which are managed (created and operated) like other network applications, a feature known as the user-mode linux (UML Linux). In the lab, these hosts play the role of software-based routers or end hosts. They are interconnected in many different ways, depending on the particular laboratory scenario, so that the whole setup becomes a virtual network. Netkit is a very convenient emulation framework. It is particularily suitable for experimentation with network protocols and learning protocol interactions that take place between network elements. Students shall be using one physical host machine (see Figure 1). It is a high-performance PC equipped with RAM sufficient to host multiple virtual guest machines running concurrently. Piotr Pacyna, Katarzyna Kosek-Szott, Szymon Szott 1
Figure. 1. Netkit virtualization platform The manual for netkit are available at: http://wiki.netkit.org/man/man7/netkit.7.html User interface The following screenshot (Fig. 2) show the user interface. Windows In the left-hand side of the figure are consoles that offer access to virtual devices (routers and hosts). Window on the right-hand side is a console of a host PC, which serves as a virtualization platform. Figure 2. Graphical user interface Virtual machines can be configured with multiple virtual network interfaces. As such, they can emulate multiple physical network cards. When such a machine is equipped with routing software, it will act as a software-based router. Routing software is based on Quagga Piotr Pacyna, Katarzyna Kosek-Szott, Szymon Szott 2
(Zebra). Quagga is a routing demon. It implements RIP, OSPF and BGP, among others. In the lab, we will be using all these routing protocols. Benefits from using virualization in the lab The main reasons to use netkit-based virtualization for experiments are the following: Every student will act as a network administrator and will retain full control of the network. Some network scenarios employ as many as 11 routers. Every student can configure multiple devices at a time. Every device can be configured differently. The netkit framework allows to prepare the laboratory exercises in advance, as preconfigured network topologies. It allows students to concentrate on the essentials. Learning is more efficient then. Virtual environment allows unrestricted access to all elements of a configuration, which can be adjusted or altered. System-level networking software is used in the virtual environment. It emulates the network, so network characteristics (for ex ample protocol behavior) and interactions between elements are well reflected Command-line interface to routers is compatibile with command-line syntax in Cisco routers. The skills can later be used in managing Cisco routers. Netkit can be used to develop hybrid scenarios (mixed virtual-physical), i.e. to interconnect virtual network with a physical network infrastructure. Netkit can be installed and used at home to get more experience with routing protocols (see information on web page: www.netkit.org ). Preparation for the lab 1. While booting a PC in the lab remember to select netkit as your operating system. It is based on Ubuntu, with netkit software preinstalled. 2. Credentials are: login: student, password: student. When the system is first booted, you are logged in automatically. 3. If you want to start working with netkit right now, use the root account. Execute sudo i in order to switch to root account. 4. Right after logging into the root account, check that the following environment variables are set: NETKIT_HOME=/home/netkit/netkit MANPATH=/home/netkit/netkit/man PATH=/home/netkit/netkit/bin:/ If the variables are not set as shown above, go back to step 3. Piotr Pacyna, Katarzyna Kosek-Szott, Szymon Szott 3
6. User manuals and pre-configured netkit startup scripts are available at: http://www.kt.agh.edu.pl/~pacyna tab Lectures, --->IP Networks. 7. If the manual is accompanied with startup scripts, then the scripts need to be unpacked in a new directory on a local hard drive. The hard disk must be previously mounted, because the operating does not mount it automatically. In order to mount the drive, go to computer screen (Desktop) and select Places in the menu bar at the top of the Desktop and click hard disk label (for example TARGET, 157.9 GB Media). Warning: do not unpack startup scripts in your home directory or in ~/Desktop If an error message is shown, you have to mount the disk from command line : sudo mkdir /media/disk sudo mount -t ntfs-3g /dev/sda2 /media/disk -o force The disk is usually available at mount point: /media/disk. 8. Use lstart command line, to start the unpacked scripts. 9. Note that the file systems of virtual hosts are separate from the file system of the physical host, so there s no simple way to transfer files between virtual machines and the physical one other than, for example, scp. However, note the following. Inside every virtual machine there is a special directory named /hosthome. This directory points to your home directory on the host (typically, /home/<username>). Hence, anything you write into /hosthome will be made available on the host, and you can bring host files into your virtual machine as well. 10. If you plan to prepare a hybrid virtual-physical scenario, see the following: http://wiki.netkit.org/index.php/faq#frequently_asked_questions, Netkit Usage I would like to set up a lab with a virtual machine connected to the Internet. How can I do that? 11. Use lhalt or lcrash to stop virtual machines. Sample session student@student:~$ sudo mkdir /media/disk student@student:~$ sudo mount /dev/sda2 /media/disk student@student ipn:~$ cd /media/disk student@student:/media/disk$ mkdir temp student@student:/media/disk$ cd temp student@student:/media/disk/temp$ wget http://www.kt.agh.edu.pl/~pacyna/lectures/sieci_komputerowe/ laboratoria/rip/lab-static-routing.tar.zip student@student:/media/disk/temp$ unzip lab-staticrouting.tar.zip Piotr Pacyna, Katarzyna Kosek-Szott, Szymon Szott 4
student@student:/media/disk/temp$ tar xvf lab-staticrouting.tar student@student gipn:/media/disk/temp$ cd lab-staticrouting/ student@student:/media/disk/temp/lab-static-routing$ lstart Controlling netkit with built-in commands Use the following commands to control netkit. See manual page at netkit.org for detailed explanation of the following. lstart lclean lcrash lhalt linfo lrestart ltest vclean vconfig vstart vhalt vcrash vlist Piotr Pacyna, Katarzyna Kosek-Szott, Szymon Szott 5