Go back learning how to virtualize again
A deep dive into configuring Internal Networks in Virtual Machines

learning how to virtualize again

November 24, 2024 (Updated: November 24, 2024)

In this post we’ll be looking at networking the virtual machines we made in the last post

Prerequisites

Software Needed


Network Configuration

Host-Only Adapter

NAT Adapter (for Internet Access)


Step 1: Configure the Host-Only Adapter

In VirtualBox:

  1. Open VirtualBox and go to File > Host Network Manager.
  2. Click Create to add a new host-only adapter.
  3. Set the adapter’s details:
    • IPv4 Address: 192.168.32.1
    • Subnet Mask: 255.255.255.0
  4. Ensure DHCP Server is disabled to manually assign IP addresses.
  5. Save the settings.

Step 2: Attach Virtual Machines to the Internal Network

  1. Open the settings for each virtual machine
  2. Go to the Network section.
  3. Set Adapter 1 to:
    • Attached to: Host-Only Adapter
    • Name: Example Adapter
  4. Add Adapter 2 : Attached to : NAT
  5. Save the settings

Step 3: Assign Static IP Addresses

General Network Details

Fedora

  1. Open the terminal and edit the network configuration file:
    bash
    
    sudo nano /etc/sysconfig/network-scripts/ifcfg-ens33
    
  2. Add or modify the following lines:
    bash
    
    BOOTPROTO=none
    IPADDR=192.168.32.10
    NETMASK=255.255.255.0
    GATEWAY=192.168.32.1
    DNS1=8.8.8.8
    
  3. Restart the network service:
    sudo systemctl restart NetworkManager
    

EndeavourOS

  1. Edit the network configuration:
    bash 
    
    sudo nano /etc/systemd/network/20-wired.network
    
  2. Add the following:
    bash
    
    [Match]
    Name=ens33
    
    [Network]
    Address=192.168.32.20/24
    Gateway=192.168.32.1
    DNS=8.8.8.8
    
  3. Restart the network service:
    bash
    
    sudo systemctl restart systemd-networkd
    

Ubuntu Desktop

  1. Edit the Netplan configuration file:
    bash
    
    sudo nano /etc/netplan/01-netcfg.yaml
    
  2. Add the following configuration:
    network:
      version: 2
      renderer: networkd
      ethernets:
        ens33:
          dhcp4: no
          addresses:
            - 192.168.32.30/24
          gateway4: 192.168.32.1
          nameservers:
            addresses: [8.8.8.8]
    
  3. Apply the configuration:
    bash
    
    sudo netplan apply
    

Ubuntu Live Server

  1. Edit the Netplan configuration file:
    bash
    
    sudo nano /etc/netplan/01-netcfg.yaml
    
  2. Add the following:
    network:
      version: 2
      renderer: networkd
      ethernets:
        ens33:
          dhcp4: no
          addresses:
            - 192.168.32.40/24
          gateway4: 192.168.32.1
          nameservers:
            addresses: [8.8.8.8]
    
  3. Apply the configuration:
    bash
    
    sudo netplan apply
    

Step 4: Test Connectivity

  1. Ping the Gateway: From each VM, test the connection to the gateway:

    bash
    
    ping 192.168.32.1
    
  2. Ping Between VMs: Test communication between the VMs:

    bash
    
    ping 192.168.32.20  # From Fedora to EndeavourOS
    ping 192.168.32.30  # From EndeavourOS to Ubuntu Desktop
    
    
  3. Test Internet Access: From each VM, check internet connectivity:

    bash
    
    ping google.com
    

Step 5: Troubleshooting Common Issues

  1. VMs cannot communicate with each other on the internal network
  1. VMs cannot reach the internet through the NAT adapter
  1. IP conflicts between VMs on the internal network

Related Posts

Contact Me Resume