Skip to main content

Configure virtualbox data center which uses ubuntu 20.04

In this blog, I will show how to configure network in ubuntu 20.04 to create a small data center with virtualbox to simulate cloud vps in local development environment. The overall procedure is to, first, creating a virtual machine with 2 bridge network adapters attached. Then, making configuration for the network adapters with netplan. After that, cloning 2 more virtual machines and adjust the ip addresses in the network configuration.

Create a virtual machine and configure its network

  • Create new virtual machine and attach bridge network adapter to Adapter 1 and Adapter 2. Let's put the name for the machine as red



  • Find out what are the name of the network interfaces using command ip a
  • Then modify the file with content similar to below. Copy the content below to /etc/netplan/00-installer-config.yaml, then modify the ethernet interfaces to match with your virtual machine's interfaces. After that, run netplan apply for the new configuration to take effect.
  • network:
      ethernets:
        enp0s3:
          dhcp4: false
          dhcp6: false
        enp0s8:
          dhcp4: false
          dhcp6: false
      bridges:
        br0:
          interfaces: [enp0s3]
          addresses: [192.168.1.100/24]
          gateway4: 192.168.1.1
          mtu: 1500
          nameservers:
            addresses: [1.1.1.1, 8.8.8.8]
          parameters:
            stp: true
            forward-delay: 4
          dhcp4: no
          dhcp6: no
    
        br1:
          interfaces: [enp0s8]
          addresses: [10.0.0.100/24]
          gateway4: 10.0.0.1
          mtu: 1500
          nameservers:
            addresses: [10.0.0.1]
          parameters:
            stp: true
            forward-delay: 4
          dhcp4: no
          dhcp6: no
      version: 2
    

    In this set up, the first interface is in the same network with the host machine and can communicate with the internet (public network). The second network is for communicating among the virtual machines only (private network).

Clone more machines and adjust the ip addresses

Now clone the red macine into blue and green machine. Then change the addresses from 192.168.1.100 and 10.0.0.100 to 192.168.1.101 and 10.0.0.101 and 192.168.1.102 and 10.0.0.102. After all, you can ping between virtual machines using either address and ping to address on the internet from the virtual machines. The below pictures show the steps to clone a machine. 

 





Now, I hope that you enjoy this little data center and can have fun experiment installing tools such as Kubernetes or Apache Spark cluster


- ninjahoahong

Comments

Popular posts from this blog

The first taste of Rust - A simple you tube downloader

Recently, I just learnt Rust and using it to write a simple youtube downloader with reference from node-ytdl . In this blog, I would like to share the code and how did I make it. You can find the full source code here . Install development environment I am using Windows 10 and scoop package manager. Therefore, I use the following commands. Run scoop install rustup-msvc to install rustup . Run setx "%path%;%USERPROFILE%\\scoop\\persist\\rustup\\.cargo\\bin" to add rustup to the path. Restart termial (git-bash in my case) and check the installation with rustup --version; rustc --version; cargo --version Export custom RUST_HOME : export RUSTUP_HOME=$HOME/scoop/persist/rustup/.cargo/bin/rustup Install a toolchain for rustup : rustup toolchain install stable-x86_64-pc-windows-msvc Setup project Run cargo new simple_rust_youtube_downloader --bin && cd simple_rust_youtube_downloader to create and navigate to the project. Add these dependencies to ...

Blogger Post Template

The easiest way to start using a template is that you visit your own typical blog and change to HTML tag and copy the blog to the Settings --> Post, comments, and sharing --> Post Template. Then remove the real text and replace it with the template text. For example, this blog's template is: Reference: https://support.google.com/blogger/answer/154172?visit_id=1-636349071961278260-2951406294&rd=1 - ninjahoahong

How does virtual reality (VR) work?

Today, I learned a basic of how VR works and want to share you my short summary: VR feel can be achieved by using head mounted displays to show different 2D pictures (different angles, depth) to each of a user' eyes to immerse the feeling of staying in a 3D world to the user. The immersion can be increased by increasing the field of view (typical field of view is 100 to 110 degree).  FPS requires at least 60fps for the user to feel okay. Different trackings such as head tracking, motion tracking, and eye tracking decide when to show which pictures provide more complete VR experience. After learning this basic, I am interested in making some experiments with VR application for Android phones and tablets. I will share those learning experience after the experiments. References: http://www.androidauthority.com/virtual-reality-work-702049/ https://www.wareable.com/vr/how-does-vr-work-explained