Exercise 1 Course Information
Total Page:16
File Type:pdf, Size:1020Kb
STUDY IN ENGLISH STUDY IN ENGLISH Exercises 4 Oracle VirtualBox Network Virtualization Nebojša Bačanin Džakula, PhD [email protected] Faculty of Technical Sciences, Singidunum University Cloud Computing 2019/20 www.study.singidunum.ac.rs STUDY IN ENGLISH Oracle VirtualBox • Oracle VM VirtualBox is a free, open source, cross- platform application for creating, managing and running virtual machines (VMs). • Virtual machines are computers whose hardware components are emulated by the host computer. • It belongs to the Type-2 (hosted hypervisors). • Download link: https://www.vmware.com/products/workstation- pro.html STUDY IN ENGLISH Oracle VirtualBox • Oracle VirtualBox enables you to set up one or more virtual machines (VMs) on a single physical machine, and use them simultaneously, along with the actual machine. • Each virtual machine can execute its own operating system, including versions of Microsoft Windows, Linux, BSD, and MS-DOS. • We can install and run as many virtual machines as we like – the only practical limits are disk space and memory. STUDY IN ENGLISH Oracle VirtualBox • Download link: https://www.virtualbox.org/wiki/Downloads STUDY IN ENGLISH Oracle VirtualBox Network Virtualization • Oracle VM VirtualBox can virtualize the following types of networking hardware: • AMD PCNet PCI II (Am79C970A) • AMD PCNet FAST III (Am79C973), the default setting • Intel PRO/1000 MT Desktop (82540EM) • Intel PRO/1000 T Server (82543GC) • Intel PRO/1000 MT Server (82545EM) • Paravirtualized network adapter (virtio-net) STUDY IN ENGLISH Oracle VirtualBox Network Virtualization • The PCNet FAST III is the default because it is supported by nearly all operating systems, as well as by the GNU GRUB boot manager. As an exception, the Intel PRO/1000 family adapters are chosen for some guest operating system types that no longer ship with drivers for the PCNet card, such as Windows Vista. • The Intel PRO/1000 MT Desktop type works with Windows Vista and later versions. The T Server variant of the Intel PRO/1000 card is recognized by Windows XP guests without additional driver installation. The MT Server variant facilitates OVF imports from other platforms. • The Paravirtualized network adapter (virtio-net) is special. If you select this adapter, then Oracle VM VirtualBox does not virtualize common networking hardware that is supported by common guest operating systems. Instead, Oracle VM VirtualBox expects a special software interface for virtualized environments to be provided by the guest, thus avoiding the complexity of emulating networking hardware and improving network performance. Oracle VM VirtualBox provides support for the industry-standard virtio networking drivers, which are part of the open source KVM project. STUDY IN ENGLISH Oracle VirtualBox Network Virtualization • Each of the networking adapters can be separately configured to operate in one of the following modes: • Not attached. In this mode, Oracle VM VirtualBox reports to the guest that a network card is present, but that there is no connection. This is as if no Ethernet cable was plugged into the card. Using this mode, it is possible to "pull" the virtual Ethernet cable and disrupt the connection, which can be useful to inform a guest operating system that no network connection is available and enforce a reconfiguration. • Network Address Translation (NAT) • Bridged networking • Internal networking • Host-only networking • Generic networking STUDY IN ENGLISH Not Attached • A virtual network adapter is installed in a VM, but the network connection is missing, much like when you unplug the Ethernet network cable when using a physical network adapter. This mode can be useful for testing. • For example, you can enable this network mode for a short time to emulate unplugging the cable. When you disable the Not Attached mode by switching to another network mode, the network connection becomes available again. You can also check whether a DHCP client obtains the IP address correctly, whether the appropriate application can resume downloading after link interruption or packet loss, and so on. • Instead of using the Not Attached network mode, you can use any other network mode without ticking the Cable Connected checkbox. You can tick/untick the checkbox when a VM is in the running state (see the screenshot above). Don’t forget to hit OK to apply changes in the VM network configuration. STUDY IN ENGLISH Network Address Translation (NAT) • Network address translation (NAT) is the default mode for new vm's and works great in most situations when the Guest is a "client" type of vm. (i.e. most network connections are outbound). STUDY IN ENGLISH Network Address Translation (NAT) • When the guest OS boots, it typically uses DHCP to get an IP address. VirtualBox will field this DHCP request and tell the guest OS its assigned IP address and the gateway address for routing outbound connections. In this mode, every vm is assigned the same IP address (10.0.2.15) because each vm thinks they are on their own isolated network. • And when they send their traffic via the gateway (10.0.2.2) VirtualBox rewrites the packets to make them appear as though they originated from the Host, rather than the Guest (running inside the Host). STUDY IN ENGLISH Network Address Translation (NAT) • This means that the Guest will work even as the Host moves from network to network (e.g. laptop moving between locations), and from wireless to wired connections too. STUDY IN ENGLISH Network Address Translation (NAT) • NAT Networking characteristics: • Guests sit on own private LAN • VirtualBox acts as a DHCP Server • VirtualBox NAT engine translates addresses • Destination servers see traffic originating from VirtualBox host • No configuration needed on Host or Guest • Great when guests are clients • Not good for guests as servers STUDY IN ENGLISH Network Address Translation (NAT) STUDY IN ENGLISH Bridged Networking • Bridged Networking is used when you want your vm to be a full network citizen, i.e. to be an equal to your host machine on the network; in this mode, a virtual NIC is "bridged" to a physical NIC on your host. • The effect of this is that each VM has access to the physical network in the same way as your host. It can access any service on the network such as external DHCP services, name lookup services, and routing information just as the host does. STUDY IN ENGLISH Bridged Networking • The downside of this mode is that if you run many vm's you can quickly run out of IP addresses or your network administrator gets fed up with you asking for statically assigned IP addresses. • Secondly, if your host has multiple physical NICs (e.g. Wireless and Wired) you must reconfigure the bridge when your host jumps networks. • STUDY IN ENGLISH Bridged Networking • So what if you want to run servers in vm's but don't want to involve your network administrator? • Maybe one of the next 2 modes is for you...or maybe a combination of more options, like one NAT vNIC + 1 Host-only vNIC..... STUDY IN ENGLISH Bridged Networking • Bridged Networking characteristics: • VirtualBox bridges to Host Network • Good for clients or server guests • Consumes IP addresses • May involve configuration of guest • Best for production environments • STUDY IN ENGLISH Bridged Networking STUDY IN ENGLISH Internal Networking • When you configure one or more vm's to sit on an Internal network, VirtualBox ensures that all traffic on that network stays within the host and is only visible to vm's on that virtual network. STUDY IN ENGLISH Internal Networking • The internal network ( in this example "intnet" ) is a totally isolated network and so is very "quiet". • This is good for testing when you need a separate, clean network, and you can create sophisticated internal networks with vm's that provide their own services to the internal network. (e.g. Active Directory, DHCP, etc). • Note that not even the Host is a member of the internal network, but this mode allows vm's to function even when the Host is not connected to a network (e.g. on a plane). • STUDY IN ENGLISH Internal Networking • Note that in this mode, VirtualBox provides no "convenience" services such as DHCP, so your machines must be statically configured or one of the vm's needs to provide a DHCP/Name service. • Multiple internal networks are possible and you can configure vm's to have multiple NICs to sit across internal and other network modes and thereby provide routes if needed. • But all this sounds tricky. What if you want an Internal Network that the host participates on with VirtualBox providing IP addresses to the Guests? Ah, then for this, you might want to consider Host-only Networking... STUDY IN ENGLISH Internal Networking • Internal Networking characteristic: • Guests can see other guests on same internal network • Host cannot see internal network • Network configuration needed • Functions even when Host disconnected • Can be used in conjunction with Bridged • Good for multi-tier solutions • STUDY IN ENGLISH Internal Networking STUDY IN ENGLISH Host-only Networking • Host-only Networking is like Internal Networking in that you indicate which network the Guest sits on, in this case, "vboxnet0": • All vm's sitting on this "vboxnet0" network will see each other, and additionally, the host can see these vm's too. However, other external machines cannot see Guests on this network, hence the name "Host- only". STUDY IN ENGLISH Host-only Networking • Host-Only Networking characteristics: • VirtualBox creates a private internal network for guests and host • Host sees a new software NIC • VirtualBox provides a DHCP server • Guests cannot see outside world • Guests function even when host disconnected • Great for development STUDY IN ENGLISH Host-only Networking STUDY IN ENGLISH Port-Forwarding with NAT Networking • What if you cart around a mobile-demo or dev environment on, say, a laptop and you have one or more vm's that you need other machines to connect into? • And you are continually hopping onto different (customer?) networks.