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

My books review: "The retrospective handbook"

Overview: The retrospective handbook is a useful collection of tips for preparing and running retrospective for agile teams. The central point of facilitating a retrospective is the preparation. All the details - even the smallest details such as how much paper is available or what the colours of the using pens - play an important role in running a successful retrospective. In such preparation, the most important preparation is the relationship. It requires team members to have high trust with each other to address any problems in great details and find the most suitable solution for those problems. My impression: The tips for running remote retrospective would be really useful for anyone especially startups in my opinion. All the startups I have worked for so far have had some foreign teams either external or internal to save operating money. In addition, there are a lot of remote work to save office renting space and almost all of those startups followed the agile method.

My books review: Money for the rest of us

Overview: The "Money for the rest of us" book is a list of 10 questions serve as a guideline to invest. It is light book with not many pages and can be read during commute time. The book does not require audiences to have any special knowledge. My impression: The author, Mr. David, is very friendly and patient to answer my questions. The 10 questions are greatly explained by the author, and I think they provide a good starting point. However, I think anyone who wants to invest should build their own checklist and a general guideline for different situations. When a general guideline is in place, the decisions need to respect the guideline in order to make consistent decision. Consistency , in my opinion, is the most important in the long run as it provide information for constant feedback and improvements. Overall, I think this is a good book that helps improving my decision making process. - ninjahoahong

Scripting with Java

I think Java is quite verbose for scripting. However, it can also be fun. I wrote a very simple experiment of ls command. You should try it out. Download file ls and chmod +x ls then you can run ./ls . There are no flags/options supported.😆 - ninjahoahong