Preview of the following text... I plan to investigate 3Tier architecture and then install both an Nginx server (as a web server) and a Tomcat server (as a Web Application Server), and attempt to integrate them.
I. Overview
Let's explore the different network modes available in a virtual machine program: Host-only, NAT, and Bridge. We'll look at how to configure and modify these settings in VMware to establish network connections. Host-only allows communication only between the guest OS, while NAT typically allows communication with the host OS and the external network. Bridge allows communication with the external network independently of the host OS. Finally, let's install Tetris and try playing it with other people on a different network.
II. Host-only and NAT/Bridging
Before explaining "Host-only" and "Bridge," it would be helpful to review the previous post about NAT.
First, I would like to introduce a method for changing the network settings within the VMware virtual machine program. Specifically, Host-only, NAT, BridgeThis can be modified.

As shown in the photo above Virtual Network EditorOnce you enter,

The screen displays this. Here... Subnet IP addressYou can also change the settings to use the old addresses for classes A, B, and C, and you can also modify the settings for "Host-only" and "NAT." To change these settings, you need to click "Change Settings" as shown in the image and enter administrator mode. Once you're in administrator mode,

However, you can modify these settings to assign an IP address. NAT DHCP Server Configurationto change or replace Setting up a DHCP server for host-only networkingThe network configuration can be changed. "Host-only" refers to a virtual machine guest OS configuration within VMware, which allows communication only between the virtual machines and not with the external network. Typically, "NAT" (Network Address Translation) is configured to allow communication with the external network by assigning an IP address through the host OS. Of course, it is also possible to connect to the host OS. If you want to try "Host-only" first,

After changing the IP address settings for the host-only network and confirming that the changes are saved (you don't necessarily need to make any adjustments),

Now, within the guest operating system running on the virtual machine, go to Settings.

First, change the Network Adapter to "Host-only" mode, then click "OK," and finally, start the virtual machine.

By connecting to the virtual machine and using the 'ifconfig' command, you can see that the IP address assigned to the "Host-only" network, as mentioned earlier, is being used.

If you check your operating system's IP address, it will appear as shown above.

When I tried to use ping to check the connection status between the host OS and the guest OS in a host-only environment, I found that it was not possible to connect.

I understand that in a host-only environment, communication between the guest OS and the host OS is not possible. However, what would happen if I tried to ping between two guest OS in this scenario?

You can see that ping is working! This means that guest operating systems can connect to each other within a host-only network, but not with the host operating system itself.

However, if you send a ping to the same host OS IP address after changing the guest OS to NAT, you will see the following results.

You can clearly see how the packets are being transmitted successfully!
As mentioned earlier, the VMware Virtual Network Editor allows you to modify settings such as DHCP server configuration or manual IP address assignment. You can also make these changes within the guest operating system of the virtual machine, using the 'nmtui' tool in Linux. When you enter the command, a window appears.



By following this procedure, you can not only change the MAC address or IP address, but also the DNS server address.

Before explaining the concept of a bridge, the image above illustrates how Host-only and NAT can be understood simultaneously. A bridge utilizes the host OS's hardware, but it allows the host OS to communicate directly with the external network, receiving an IP address from the router without going through the host OS.
※ For the purpose of understanding, please assume that the guest OS running on the virtual machine has its own separate network card.

This time, go to the Settings and change the option to "Bridge," then boot up the virtual machine.

As you can see from above, the guest OS has been assigned the same network IP address as the host OS. Now, let's try the guest OS, which has been switched to a bridge, following the Tetris below!!
※ If you do not receive an IP address immediately, as shown in the image above. 'sudo dhclient -v' Let's try running the command.
Ⅲ. Tetris
I'd like to introduce Tetris, a game that can be enjoyed on Linux (including Ubuntu). When studying Linux and networking, you'll encounter many challenging aspects, and it can be helpful to take a break and play Tetris to relax.
Vitetris: A Tetris game for Linux, using text-based graphics.

Once you access the website and disembark at the designated stop, "Newest version" You can download the latest version of the Tetris source code.
Release 0.59.1 · vicgeralds/vitetris
Once you enter, you can connect to Git and download the Tetris source code version 0.59.1. You will see both zip and tar.gz versions available. If you are using Windows, you can directly download the files. "WinSCP"Through programs like this, you can send files to the virtual machine, configuring it to run as a Linux operating system. "wget" There is a method to copy the address link using a command and then download the file directly from Linux.
wget https://github.com/vicgeralds/vitetris/archive/refs/tags/v0.59.1.tar.gzGenerally, Linux is tar.gz Because the extension allows you to compress or decompress files, clicking "Copy Link Address" with the right mouse button on "Source code (tar.gz)" will allow you to obtain the address for downloading. By running the command within the directory where you want to download the file, the download will begin immediately.

You can copy the link address and enter it into the command as instructed above, which will initiate the download. Then, simply use the 'tar' command to extract the archive.

※ One good example of a package is Linux, where the file system structure isn't as clearly displayed as in Windows, making it difficult to navigate using the "ls" command. However, "tree"If you install the package using 'apt install tree' and then use it, it displays directories in a tree-like format, which is very helpful.
Now, I'll install one more package that you need. Since the files you downloaded are just source code, you'll need a library to compile and run them. This is similar to needing a Korean program to run a Korean file.

Therefore, the result is this. "Install the build-essential package"Once you've installed it, the preparation is truly complete. After installing and unzipping the directory,

With so many files, you'll likely find a configuration file. set up To adjust the Tetris game's source code to match my current system, run the "configure" script file.

If implemented createWhen a request to "make" appears, simply enter "make," and the system will automatically adjust the settings accordingly.

So, now all that's left is to actually start playing Tetris.

Looking at the picture, to start playing Tetris, you need to... './tetris'It is said that if you enter this, it will run. Let's try it, and here's what it shows!

Now, all I have to do is enjoy the game. But if I want to play with a friend who is on the same network?
'./tetris listen port number'If you enter the specified command and execute it,

With the server now open on port 9999, it is waiting for someone to connect and participate.

You can see the service operating in "LISTEN" mode! So, how can the other party access it?

Like this './tetris connect IP address:port number'Once you enter the information, you will see a message that says "PLAYER 2" and you will be able to access the game. Now you can start playing!
※ After modifying the network to allow communication with the outside world via Bridge, you can also use it for your favorite activities. 😃
Review
This time, I've written about the VMware network changes we covered in the previous class, as well as the fun Tetris game. After spending almost two days writing based on what I've learned so far, I've definitely encountered some confusing points, so I'll be referring to resources to clarify them... 🥲 I also thought about immediately summarizing and posting everything each day, but I plan to thoroughly organize and upload the 3-tier section first. If possible, I'll also try Docker.
Log in