OS Lab Week 4: SSH

Introduction

In Operating Systems Lab Week 4, I created a new network within VirtualBox to allow for a network connection between the guest machine (VM) and the host machine. Then I installed SSH and configured linux for the usage of SSH. I used SSH to then connect to the command line interface (CLI) of the guest machine vie PuTTY over the virtual network.

After installing SSH, I verified that SSH is running by entering the command ‘sudo systemctl status ssh’

Calculate the host IP range

If you want to find the smallest and largest host IP address you must do the following steps:

  1. Get the network IP address and the subnet mask from the CIDR notation.
  2. Convert the network IP address and subnet mask to binary. e.g. 192.168.56.0 -> 11000000.10101000.00110110.00000000
  3. Calculate the network ID by using the AND operation on the Network IP and subnet mask.
  4. Calculate the wildcard mask by inverting the subnet mask.
  5. Calculate the broadcast ID by adding the wildcard mask to the network ID.
  6. If the broadcast ID is even the subtract 1, the broadcast ID must be an odd number.
  7. Next calculate the smallest host address by adding 1 to the network ID.
  8. Then calculate the largest host address by subtracting 1 from the broadcast ID.
  9. Afterwards you can convert the binary IP address back to 4 8-bit numbers.

Worked examples

Example 1:

Find smallest and largest addresses in 192.168.0.55/24
	Network IP 	192.168.0.55 	->	11000000.10101000.00000000.00110111
	Subnet mask	255.255.255.0	->	11111111.11111111.11111111.00000000
	
	Network ID:
	AND	11000000.10101000.00000000.00110111 # Network IP
		11111111.11111111.11111111.00000000 # Subnet mask
	=	11000000.10101000.00000000.00000000 -> 192.168.0.0 # Network ID
	
	Wildcard mask:
	NOT	11111111.11111111.11111111.00000000 # Subnet mask
	=	00000000.00000000.00000000.11111111 -> 0.0.0.255 # Wildcard mask
	
	Broadcast ID:
	ADD	11000000.10101000.00000000.00000000 # Network ID
		00000000.00000000.00000000.11111111 # Wildcard mask
	=	11000000.10101000.00000000.11111111 -> 192.168.255 # Broadcast ID
	# Broadcast ID is not even so we dont subtract 1
	
	Smallest address:
	ADD	11000000.10101000.00000000.00000000 # Network ID
		00000000.00000000.00000000.00000001 # 1
	=	11001000.10101000.00000000.00000001 -> 192.168.0.1 # Smallest address
	
	
	Largest address:
	SUB	11000000.10101000.00000000.11111111 # Broadcast ID
		00000000.00000000.00000000.00000001 # 1
	=	11001000.10101000.00000000.11111110 -> 192.168.0.254 # Largest address
	
	Smallest address: 192.168.0.1
	Largest address: 192.168.0.254

Example 2:

Find smallest and largest address in 10.3.15.211/8
	Network IP	10.3.15.211	->	00001010.00000011.00001111.11010011
	Subnet mask	255.0.0.0	->	11111111.00000000.00000000.00000000
	
	Network ID:
	AND	00001010.00000011.00001111.11010011 # Network IP
		11111111.00000000.00000000.00000000 # Subnet mask
	=	00001010.00000000.00000000.00000000 -> 10.0.0.0 # Network ID
		
	Wildcard mask:
	NOT	11111111.00000000.00000000.00000000 # Subnet mask
	=	00000000.11111111.11111111.11111111 -> 0.255.255.255 # Wildcard mask
	
	Broadcast ID:
	ADD	00001010.00000000.00000000.00000000 # Network ID
		00000000.11111111.11111111.11111111 # Wildcard mask
	=	00001010.11111111.11111111.11111111 -> 10.255.255.255 # Broadcast ID
	# Broadcast ID is not even so we dont subtract 1
	
	Smallest address:
	ADD	00001010.00000000.00000000.00000000 # Network ID
		00000000.00000000.00000000.00000001 # 1
	=	00001010.00000000.00000000.00000001 -> 10.0.0.1 # Smallest address
	
	Largest address:
	SUB	00001010.11111111.11111111.11111111 # Broadcast ID
		00000000.00000000.00000000.00000001 # 1
	=	00001010.11111111.11111111.1111110 -> 10.255.255.254 # Largest address
	
	Smallest address: 10.0.0.1
	Largest address: 10.255.255.254

What is the difference between a host-only adaptor mode and an internal network adaptor mode

The difference between a host-only and an internal network adaptor is the ability to connect to the host.

A virtual machine with their network adaptor configured for the Internal Network mode is only allowed to communicate with other VMs which their network adaptors are configured for the Internal Netowrk. The virtual machine cannot connect to the host machine or any other machines outside the host and it is useful for modelling real networks.

A virtual machine with their network adaptor configured for Host-Only mode allows the VM to connect to other VMs which are also configured for Host-Only and the host machine but no other machine outside the host.

Connecting to guest machine over SSH

After finishing the full configuration of SSH and the internal network, I opened the guest machine’s CLI from the host machine through PuTTY over a network connection.

Leave a comment

Design a site like this with WordPress.com
Get started