Operating System Administration
Lab Module 5: Manual Setting up Networking Linux in VirtualBox
From Lab Module 4 we have a network of three VMs called RedHatA, Fedora39 and Mint213. They
are network with a NAT Network segment called OSANet with CIDR No. = 192.168.101.0/24. They
also obtained the IPAddress through DHCP.
In this Lab Module 5, we will assign manual IPAddress to all three VMs. We will be using the same
network address as above.
VirtualBox NAT Network preference:
Name: NetOSA
CIDR No: 192.168.202.0/24
We will set the manual IPAddress as follow
RedHatA - 192.168.202.10
RedHatB - 192.168.202.11
Fedora39 - 192.168.202.65
Mint213 - 192.168.202.66
Ubuntu2243 - 192.168.202.67
A. Individual Manual IPAddress setting using system network setting.
1. Open the Network Setting from Menu:
2. Click on the wheel button..
oracl
3. Select the IPv4 tab
4. Click Apply then on the return dialogbox disable then enable the network
5. Disable the network
6. Enable the network
7. Open terminal and type ip a to check the IPAddress of your machine
We have successfully update the configuration of our system IPAddress
B. Manual IPAddress setting using nmtui (on another VM)
One method of configuring the IPAddress of the system is to use the nmtui command.
Network Manager Text User Interface (nmtui) uses text based dialog boxes to get
parameters like IPAddress, Gateway and DNS from the user. We can also reset the
connection and also change the Hostname of the system. It run from the command line.
1. Open terminal and run sudo bash
2. Type nmtui
the network manager text user interface (nmtui) will start
3. Select Edit a connection
Move the cursor to IPv4 configuration Automatic and change to Manual then click show
Edit the values of Addresses, Gateway and DNS servers as shown above for the RedHatA
VM
Move on to the end of the dialog box and press OK
4. Activate a connection
Click Activate a connection
Deactivate and Activate (basically resetting the NIC)
Click Back
Select Quit ..OK to finish the setting
5. Open terminal and run ip a to check the ip of your machine
We have successfully configured our system IPAddress
C. Manual IPAddress setting using nmcli (on Ubuntu)
Network Manager Command Line Interface (nmcli) is a command that will provide users
with a lot of option to configure your system. This method doesn’t show any dialogboxes, so
we need to exercise and understand that the nmcli works by experiencing it. We will work
from terminal as root. The following show Ubuntu Network setting set to NOSNet NAT
Network
From the nmtui display it show that the profile name is Wired connection 1
1. Open terminal and sudo bash
2. Type the following:
#nmcli con mod Wired\ connection\ 1\ ip4 192.168.202.66/24 gw4 192.168.202.1
#nmcli con mod enp0s3 ipv4.method manual
#nmtui
(note: if we check on nmtui at this stage this is what is shown:
#nmcli con mod enp0s3 ipv4.dns 192.168.22.1
#nmcli con mod enp0s3 +ipv4.dns 8.8.8.8
#nmcli con down enp0s3
#nmcli con up enp0s3
#nmtui
#ip a
AS we type and configure using nmcli we can immediate check any changes in the system by
running nmtui. See complete nmcli commands below:
In the listing of the nmcli above, we need to set the IPAddress and Gateway of the
system before setting to manual. The after setting the dns and additional dns using the
‘+’ symbol we can then reset the NIC. The last two command we type we performed the
resetting.
3. Now type ip to confirm IPAddress configuration.
We have successfully configure the IPAddress of our system
D. Updating the /etc/hosts files on on system
To create/modify the /etc/hosts file you have to be root because only root can edit/modify
this file. You will not succeed if you try using sudo.
1. Open the terminal and sudo bash to become root
2. Use the vim text editor to modify the file
Type vi /etc/hosts and edit the following:
3. Save the file (click Esc; :wq the click Enter)
E. Test the communication between the VMs using ping
F. Using SSH to communicate
G. Setup Port Forwarding to enable ssh from Host (Windows) to Vms(EARTH, MARS, VENUS)
1. From the Menu in VirtualBox Manager Select File|Preference|Network
2. Select the NATNetwork (NetOSA) and click edit
3. Click PortForwarding button
4. Edit the table :
5. Now open three terminals in windows and
a. ssh -p 1210 student@127.0.0.1 in terminal 1
b. ssh -p 1265 student@127.0.0.1 in terminal 2
c. ssh -p 1266 student@127.0.0.1 in terminal 3