VMware Workstation 5.0

Connecting from the client

How to emulate a network using VirtualBox
The hostname is ubuntu. Wonder if that is a first. Each terminal is now connected to a Linux shell on each virtual machine. The network topology you will create is shown in the figure below:. Change other virtual machine to Bridged. I doubt the VirtualBox infrastructure is the problem. But I recommend using a static IP address for the virtual machines.

If You Appreciate What We Do Here On TecMint, You Should Consider:


Any unassigned or unreserved TCP port numbers may be used on the host computer. I prefer to use TCP port numbers between between and which provides contiguous unassigned TCP port numbers 1. To see all assigned TCP port numbers, see http: On each virtual machine, click on Settings , then click on the Network tab in the settings window. Select the tab for Adapter 1. Expand the Advanced network panel and click on Port Fowarding.

Give the rule a name. Any name may be used. Leave the IP address fields blank. Repeat the process and set up NAT interfaces with port forwarding on each virtual machine. To make it easier to remember port numbers, I assigned TCP port numbers to PCs starting with port number and I assigned port numbers to routers starting with port number All the virtual machines used in this tutorial are clones of a base virtual machine. I created the base virtual machine, Ubuntu Server , while its first network adapter was connected to the NAT interface, which is the default configuration for VMs in VirtualBox.

Each clone VM you created inherits the same configuration from the base VM so each VM should already be have interface enp0s3 set up and running. You do not need to modify any configuration files on the virtual machines to enable them to connect to the NAT interface 2. As you can see in the figures below, you have a lot of virtual machines in the VirtualBox VM Manager.

VirtualBox allows you to group virtual machines together. Set up the virtual machines created for the network emulation scenario in a group so you can start them all together and so you do not mix them up with other VMs you may have defined in the VirtualBox GUI. Then right-click on the selected VMs and select Group from the menu.

Change the name of the group by double-clicking on the group name and typing a new name. You may also collapse the group to hide its contents by clicking on the small chevron icon to the left of the group name. When you select the group by clicking on the group name, you may apply VirtualBox commands like Start or Stop to the entire group.

This makes it easy to start your network emulation scenario quickly. In this example, select the group and then click on the green arrow to start the network emulation.

Use SSH to log into virtual machines after you start them in the network emulation scenario. It will take a few minutes for all the virtual machines to start. The -l option specifies the userid used to login to the node. In this case, when I installed the guest operating system on each node, I chose the userid brian so that is the userid I used in the SSH command. The -p option specified the host port number. The host port is a TCP port currently listening on the host computer that will forward traffic to port 22 on the associated virtual machine.

I use the host port numbers I assigned for the virtual machines in the table above. I use localhost as the IP address because I am running the command on the host computer. Open six terminal windows, one for each VM. Now that all the virtual machines are running, configure their network interfaces and routing protocols.

Each terminal is now connected to a Linux shell on each virtual machine. Configure the network interfaces on each machine. On the routers, you also need to install routing software and enable networking protocols. Using the network topology as a guide, make a table of IP addresses to be used to configure the ports on each virtual machine.

In this example, I used the table shown below:. See my post about how to build a network of Linux routers using quagga if you need explanations about how these commands work. On PC-1, change the hostname, add the interface configuration to the network interfaces file and set up a static route:. Then copy and paste the following commands into the terminal windows. We use the here documents feature of the bash shell to redirect the pasted block of input to the bash shell command line:.

On PC-2, change the hostname, add the interface configuration to the network interfaces file and set up a static route. Copy-and-paste the following commands into the PC-2 terminal window:. On PC-3, change the hostname, add the interface configuration to the network interfaces file and set up a static route. Copy-and-paste the following commands into the PC-1 terminal window:.

Copy-and-paste the following commands into the Router-1 terminal window:. Copy-and-paste the following commands into the Router-2 terminal window:. Copy-and-paste the following commands into the Router-3 terminal window:. If everything is working correctly, the virtual PCs and routers in the emulated network are should be able to communicate with every other virtual PC and router in the network.

You may now perform experiments or study the operation of network protocols. For example, you may use the ping command to test IP reachability between nodes and you may also look at the routing tables or use quagga vtysh commands on the routers to see OSPF protocol status.

For example, use traceroute to see that traffic passes through the network between pc3 and pc This tutorial worked through the building blocks used to build complex network emulation scenarios. As next steps, you may enable other network protocols in the network topology and study their operation or you may create more complex scenarios using the VirtualBox command line interface. VirtualBox network lab setup may be automated using popular open-source tools.

I showed how VirtualBox may be used to emulate networks that may be used to study the operation of network protocols and to test networking software. I provided step-by-step instructions for using the VirtualBox graphical user interface to build a network of guest virtual machines that can be managed from the host computer. Thanks Brian, this post is great to know about network emulation done without the hard work of actually doing it. Your hard work profits to many: I have 2 questions about virtualbox: Once a link is created between machines, and when the machines are running, can we erase the link and create another link?

Hi Vincent, Thanks for your comment. VirtualBox cannot remove a link when the virtual machines attached to it are still running. VirtualBox supports Linked Clones, which is a Copy on Write system but VirtualBox does not support the automatic creation of virtual machines when they are needed.

Each must be prepared in advance. Cheers Brian, no problem. The ssh port forward method you described worked to a tee. At the second setup window, click Installation Destination and click Done. Finally, click Begin Installation. Click root password and set a password. Wait until the installation is complete and click Reboot. You can boot into CentOS on both machines. To login, the username is root, and the password is what you set the password as.

Click the X button on both virtual machines. Power off both virtual machines. Open File Explorer on Windows. Hold Shift and Right Click white space on this window. Click Open Command Window Here. It will mimic our DHCP server. Go to Settings on both virtual machines in VirtualBox.

First, we go to Storage. Next, we go to Network. Click on Adapter 2. Once you have that configured, your virtual machine must be running in order for the remote connection to be made. You can do this in one of two ways:. If you only need to access the VM from a remote client, I would recommend starting the VM from the command line.

The command to do this is:. You are ready to connect via RDP. Install the application from the App Store and then start it up from the Launchpad. In the connection window Figure B , fill out the following information:. That's the minimum necessary to connect to your VM desktop. Close that window information is saved automatically and then, in the main Microsoft Remote Desktop client window Figure C , double-click on the newly created entry.

This will connect to the remote VM and boot the OS. Once the remote guest boots up, you'll be prompted to log into the desktop and you're good to work.

When you've completed working, you can shutdown the guest VM as you would normally.

Connecting Two Virtual Machines

The IP address thus assigned to the virtual machine is usually on a completely different network than the host. As more than one card of a virtual machine can be set up to use NAT, the first card is connected to the private network , the second card to the network and so on. Each virtual machine is connected to other virtual machines by VirtualBox internal networks. I added a network adapter on each guest VM and attached it to the VirtualBox NAT interface to connect each guest VM to the host computer and to . Hi, I am very noob in the tech knowledge. I am learning server 2k3. I am using win 7 on my laptop. I have two virtual machines with win 2k3 and win xp.