Create A Network For Guests And Host Machine.docx

  • Uploaded by: info info
  • 0
  • 0
  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Create A Network For Guests And Host Machine.docx as PDF for free.

More details

  • Words: 782
  • Pages: 8
Create a Network For Guests and Host Machine

At the Virtualbox manager interface below, start by creating a network on which the host and guests will operate. Go to File –> Preferences or hit Ctrl + G :

Virtualbox Preferences Window

From the following interface, there are two options; choose Host-only Networks by clicking on it. Then use the + sign on the right to add a new host-only network.

Set Guest Network

Below is a screen shot showing a new host-only network has been created called vboxnet0.

Virtualbox Preferences Window

If you want, you can remove it by using the - button in the middle and to view the network details/settings, click on the edit button. You can as well change the values as per your preferences, such as the network address, network mask, etc. Note: The IPv4 address in the interface below is the IP address of your host machine.

Host Network Details

In the next interface, you can configure the DHCP server that is if you want the guest machines to use a dynamic IP address (make sure it is enabled before using it). But I recommend using a static IP addressfor the virtual machines. Now click OK on all network settings interfaces below to save the changes.

Set Guest Static IP aAddress

Configure Virtual Machine Network Settings Note: You can follow the steps below for every virtual machine that you want to add on the network to communicate with the host machine. Back at the virtual box manager interface, select your guest virtual machine such as Ubuntu 16.10server or CentOS 7 and click on the Settings menu.

Configure VM Settings

Configure Adapter to Connect Virtual Machine to Host Choose the Network option from the interface above. Afterwards, configure first network card (Adapter 1) with the following settings:

Check the option: “Enable Network Adapter” to turn it on. In the field Attached to: select Host-only Adapter Then select the Name of the network: vboxnet0 As in the screen shot below and click OK to save the settings:

Enable Network Adapter for Guest VM

Configure Adapter to Connect Virtual Machine to Internet Then add a second network card (Adapter 2) to connect virtual machine to the Internet via the host. Use the settings below: Check the option: “Enable Network Adapter” to activate it. In the field Attached to: select NAT

Enable Network Adapter for VM

Setup Static IP Address for Guest Virtual Machine At this stage, power on the guest virtual machine, login and configure static IP address. Run the command below to show all the interfaces on the guest machine and allocated IP addresses: $ ip add

Configure Static IP Address for VM

From the screen shot above, you can see that there are three interfaces enabled on the virtual machine: lo – loopback interface enp0s3 (Adapter 1) – for host-only communication which is using the DHCP as set in one of the previous steps and later configured with a static IP address. enp0s8 (Adapter 2) – for connection to the Internet. It will use DHCP by default.

On Debian/Ubuntu/Linux Mint Important: Here, I used Ubuntu 16.10 Server: IP address: 192.168.56.5. Open the file /etc/network/interfaces using your favorite editor with super user privileges: $ sudo vi /etc/network/interfaces

Use the following settings for the interface enp0s3 (use your preferred values here): auto enp0s3 iface enp0s3 inet static address 192.168.56.5 network 192.168.56.0 netmask 255.255.255.0 gateway 192.168.56.1 dns-nameservers 8.8.8.8

Save the file and exit.

192.168.56.1

Then restart network services like so:

$ sudo systemctl restart networking

Alternatively, reboot the system and closely, check if the interface is using the new ip addresses: $ ip add

On RHEL/CentOS/Fedora Important: For this section, I used CentOS 7: IP address: 192.168.56.10. Begin by opening the file for enp0s3 – host-only network interface; /etc/sysconfig/network-scripts/ifcfg-enp0s3 using your favorite editor with super user privileges: $ sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Create/modify the following settings (use your preferred values here):

BOOTPROTO=static ONBOOT=yes IPADDR=192.168.56.10 NETWORK=192.168.56.0 NETMASK=255.255.255.0 GATEWAY=192.168.56.1 DNS=8.8.8.8 192.168.56.1 NM_CONTROLLED=no #use this file not network manager to manage interface

Save the file and exit. Then restart network service as follows (you can as well reboot): $ sudo systemctl restart network.service

Check if the interface is using the new IP addresses as follows: $ ip add

Manage Virtual Machines From Host Using SSH On the host machine, use SSH to manage your virtual machines. In the following example, am accessing the CentOS 7 (192.168.56.10)server using SSH: $ ssh [email protected] $ who

Connect Guest VM using SSH

That’s it! In this post, we described a straightforward method of setting up a network between a guest virtual machines and the host. Do share your thoughts about this tutorial using the feedback section below. SHARE +

Related Documents

Host
May 2020 18
Welcome Guests!
June 2020 9
Host
November 2019 24
Become A Host Family
April 2020 5

More Documents from "HostFamily2009"