Basic steps to Network Communications | How to connect 2 VM machines as Local network in MAC M1 Chip
Pre Installations :
- UTM : You need to install UTM in your mac this works well in Mac arm hardware
- Ubuntu arm64 virtual machines : You will able to find ubuntu arm images from UTM gallery thats pretty easy to use.
Step 1 : You need to have 2 vms if you download one ubuntu machine you can clone that machine and rename it
Step 2 : Change the network setting to Bridged so it will able to connect to other vms
Step 3 : Start VMs seperately
Step 4 : You need to install sudo if it is not there
4.1. Log in as Root User:
If sudo
is not working, you’ll need to use the root
account directly to install it. Follow these steps to access the root account:
- Open a terminal.
- Use the following command to switch to the root user (no
sudo
required):
su -
- Enter the root password when prompted. If you don’t know the root password, you may need to reset it or gain access to the root account first.
4.2. Install sudo
:
Once logged in as the root user, you can install sudo
by following these steps:
Install sudo
:
apt update
apt install sudo
After installation, you should be able to use sudo
again.
Step 5 : You need to install network packages
5.1 : Install ifconfig
sudo apt update
sudo apt install net-tools
After install you can run ifconfig , This will display the network interfaces and their IP addresses.
5.2 Install ping for check connections
sudo apt update
sudo apt install iputils-ping
After the installation, verify that ping
is working by checking its version.
ping -V
Step 6 : Now you are ready to go 😈
6.1 : We need to first check the network interfaces
ip link show
This will list all available network interfaces on your system, whether they are up or down.
- Look for an interface that corresponds to your VM’s network adapter. It could be something like
enp0s3
,ens33
, oreth0
. - If you see an interface that looks right (e.g.,
ens33
orenp0s3
), use that name in yourifconfig
commands.
In my case it is enp0s1 youy can see it under 2 details set.
6.2 We need to assign IP addresses to both vms
# Vm1
sudo ifconfig enp0s1 192.168.1.10 netmask 255.255.255.0
# Vm2
sudo ifconfig enp0s1 192.168.1.20 netmask 255.255.255.0
Check for the connection : you can ping from one vm to other vm IP
#vm2
ping 192.168.1.10
If you recieve this kind of output then you have successfully connect both vms 😇
In the next blog lets try to connect 3 vms there are few considerations we need to look when we connect 3 vms because one vm should act as a router. Lets see how to do that soon…….