How Do You Configure Two Linux Guest Servers Running on Oracle VirtualBox to Have Network Connectivity with Each Other?

Problem scenario:  On a Windows host you have Oracle VirtualBox.  You want to establish TCP/IP connectivity with the two guest CentOS Linux virtual servers.  When you try to ping one from the other, you get "destination host unreachable."  The servers have Internet connectivity.  How do you get them to communicate with each other via a networking protocol?

Solution
On each guest server, do the following:

1.  Using the GUI of the Oracle VirtualBox guest server, go to Devices -> Network Settings.  

  a.  Changed the drop down for "Attached to:" to be "Internal Network."
  b.  Make sure "Promiscuous Mode" is set to "Allow VMs" or "Allow all"
  c.  Click "OK."

2.  Back up this file on both guest servers:  /etc/sysconfig/network-scripts/ifcfg-enp0s3

3.  Modify /etc/sysconfig/network-scripts/ifcfg-enp0s3

  a) Make sure the "BOOTPROTO=" stanza is "BOOTPROTO=static"
  b) This is just an example to get the two Linux guests to work.  Other IP addresses may work.  

    For one guest, use the following entries underneath "BOOTPROTO=static":

    IPADDR=10.0.2.15
    NETMASK=255.255.255.0
    GATEWAY=10.0.2.2

    For the other guest, use the following entries underneath "BOOTPROTO=static":

    IPADDR=10.0.2.17
    NETMASK=255.255.255.0
    GATEWAY=10.0.2.2

4.  After you modify the file, issue this from the command line:  service network restart
5.  Now one guest should be able to ping or ssh to the other via the 10.0.2.1x IP address configured above.

Leave a comment

Your email address will not be published. Required fields are marked *