Virtual Square Users, Programmers & Developers Guide Renzo Davoli, Michael Goldweber Editors Contributions By
Total Page:16
File Type:pdf, Size:1020Kb
Virtual Square Users, Programmers & Developers Guide Renzo Davoli, Michael Goldweber Editors Contributions by: Diego Billi, Federica Cenacchi, Renzo Davoli, Ludovico Gardenghi, Andrea Gasparini, Michael Goldweber The Virtual Square Team 2 Copyright c 2008 Renzo Davoli, Michael Golweber and the Virtual Square. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being the Introduction, with the Front-Cover Texts being the Title Page with the Logo (recto of this page) and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”. Introduction Virtual Square is a container of projects about virtuality. The word “virtual” has been overused and misused, everything related to computers and networks sounds virtual. Computer Science define abstractions and interfaces. These two key con- cepts are strictly related. An abstraction defines the semantics of operations while an interface is the syntax required to access the operations defined by the abstraction. Programs and human users use interfaces to ask for the actions defined by an abstraction. Virtuality means providing equivalent abstractions, providing the same in- terface, such that the users (programs or humans) can effectively use the virtual abstraction instead of the real one. For example, a file system is an abstraction providing an application pro- gramming interface (API) composed by several calls like open, read, close. A virtual file system is an abstraction providing the same interface, such that the programs using the file system can use the virtual file system too. At the same time a virtual file system can apply the same abstraction to different domains not necessarily related to store and retrieve data on magnetic disks. The main memory is an abstraction, too. The hardware, memory cells arrays and MMU, provides the programs with an interface based on two main operations load and store. A virtual memory provides the same interface while uses a mix of main and secondary memory to store data. Programs use virtual memory effectively instead of the main memory. An entire computer hardware, a “machine” is perceived by the operating system as an abstraction. The interface is composed by the processor instruc- tion set and by the set of bus addresses, registers and commands required to interoperate with peripheral controllers. Another abstraction, maybe a pro- gram, able to provide the same interface to the operating system is properly defined virtual machine. The same definition applies to virtual networks, virtual devices, virtual hard disks. We perceive the world, the reality, through our senses. Thus it is an ab- straction for us, and the interface is made of light, colors, sounds, etc. The definition of virtual reality is consistent with our definition, in fact in what is commonly named as “virtual reality” our senses gets connected to devices that are able to provide the same interface of light, colors, sounds. Virtuality becames in this way a powerful tool for interoperability, virtual entities can act as puzzle tiles or building blocks to provide programs with suitable interfaces and services. This is a Virtual Square, a virtual place where different abstractions can i ii interoperate. It is possible to read it also as a Virtual Squared, i.e. how to exploit existing virtualities to build up further virtual services (this is the meaning of Virtual Square logo, V2) Virtual Square is a set of different projects sharing the idea of exploit vir- tuality by unifying concepts and by creating tools for interoperability. Today Virtual Square is also an international laboratory on virtuality ran by a research and development team. It started in 2004 at the University of Bologna, Italy. The research of Virtual Square involves several aspects of virtualization. Virtual Distributed Ethernet is the V2 Virtual Networking project. VDE is a Virtual Ethernet, whose nodes can be distributed across the real Internet. The idea of VDE sums up VPN, tunnel, Virtual Machines interconnection, overlay networking, as all these different entities can be implemented by VDE. View-OS is the V2 project about operating systems. The main idea is to negate the global view assumption. An operating system should provide services to a process without forcing all the processes to have its own unique view of the execution environment. File Systems, Networking, Device Drivers, Users, System id, can be defined or redefined at process level. This revolutionary view on virtuality has led to a better understanding of the limits of current implementations of operating systems structure and im- plementation, networking stacks and interfaces, C library support. V2 extends the Linux kernel support for virtuality and inter-process communication, imple- ments the networking stack as a library and add the support of multiple stacks to the Berkeley Socket interface, provide self virtualization for processes and libraries by adding features to the C library. All these enhancements preserve backward compatibility with existing applications. The description of a live research project like V2 is like to take a snapshot of something which is rapidly evolving. Your V2 could be different from the one here explained, maybe older because the mantainer of the tools for your Linux distribution has been late in updating the software. Typically your V2 will have more features than the one here described, and maybe items here listed as future developments will be already included in the code at the time you read this book. The first version of this book took about three years, and several sections have been written several times for the natural evolution of the projects. We suggest to use this document to have a complete view of the project and an analysis of its ideas and tools and we ask the reader to refer to the wiki of the project http://wiki.virtualsquare.org for updates. Comments, errata corrige, suggestions, bugreport and bugfixes are wel- come. Researchers and developers can be reached on the IRC public forum irc.freenode.net#virtualsquare or using the mail addresses of the editors [email protected] and [email protected]. This book describes the entire project including consolidated concepts like vde, or umview and young and evolving ideas like ipn or kmview. For this rea- son, the reader will find some tools already included in major linux distributions while others must be downloaded as source code, compiled and installed. Renzo Davoli, Michael Goldweber iii Notation This book uses icons to describe the intended audience of each section. Icons appear as prefixes in the title and in the table of contents. no icon Description of general ideas about the project. ⋆ User guide: these sections are for users of virtual square tools. Programmer guide: these sections are for programmers who need to inter- face their programs to virtual square libraries or servers. Developer guide: these sections are for programmers aiming to develop modules or plugin for virtual square tools and libraries. Internals: these sections describe the design and implementation of vir- tual square libraries and tools. sections are for developers aiming to contribute to V2. Education resource: virtual square provide valuable tool for education. The sections tagged by provide ideas and suggestions about using V2 to teach computer science. Contents Introduction i Contents v List of Figures ix I The Big Picture 1 1 Virtualization and Virtual Machines 3 1.1 IntroductiontoVirtualMachines . 3 1.2 Virtuality, Emulation and Simulation . 4 1.3 Brief history of virtuality . 5 1.4 Classification ............................ 6 1.5 Emulators/Heterogeneousvirtualmachines . 8 1.6 Homogeneousvirtualmachines . 10 1.7 Operating System-Level Virtualization . 12 1.8 Processlevelvirtualmachine. 13 1.9 Process level partial virtualization . 15 1.10 Microkernelsystems .. .. .. .. .. .. .. .. .. .. 20 2 V 2: The Virtual Square Framework 21 2.1 IntroductiontoVirtualSquare . 21 2.2 V 2 goalsandguidelines ...................... 22 2.3 V 2 components ........................... 23 3 What’s new in Virtual Square 27 3.1 ⋆VDE:aswiss-knifeforvirtualnetworking . 27 3.2 msockets: Multi stack support for Berkeley Sockets . 28 3.3 IPv6 hybrid stacks for IPv4 backward compatibility . 30 3.4 Whataprocessviews ...................... 31 3.5 ⋆PartialVirtualMachines . 33 3.6 Microkernels and Monolithic kernels are not mutually exclusive 34 3.7 Inter Process Networking: the need for multicast IPC . 35 II Virtual Square Networking 37 4 VDE: Virtual Distributed Ethernet 39 4.1 ⋆VDEMainComponents. .. .. .. .. .. .. .. .. 40 v vi CONTENTS 4.2 ⋆VDEConnectivityTools. 41 4.3 ⋆VDE:ACloserLook....................... 43 4.4 ⋆VDEExamples.......................... 55 4.5 VDE API: The vdeplug Library ................ 58 4.6 ⋆VDEtelweb ............................ 59 4.7 PluginSupportforVDESwitches. 60 4.8 vde switch Internals....................... 65 4.9 VDEinEducation ........................ 69 5 LWIPv6 71 5.1 LWIPv6API ........................... 72 5.2 AnLWIPv6tutorial ....................... 72 5.3 LWIPv6Internals......................... 81 5.4 LWIPv6ineducation....................... 96 6 Inter Process Networking 99 6.1 IPNusage............................. 100 6.2 ⋆CompileandinstallIPN. 104 6.3 IPNusageexamples ....................... 105 6.4 ⋆kvde switch,aVDEswitchbasedonIPN . 108 6.5 IPNprotocolsubmodules