A&D of Network Security - Lab 3

A&D of Network Security - Lab 3

tags: Practicum of A&D of NS NTU

Background

Network setting type in virtual box

Ping two machine in internal mode

:::spoiler Detailed Process

  1. Clone another VM
  2. Setting Network Configuration Setting 2 VMs’ network config as above. Note that, must check MAC address is different, promiscuous mode is Allow All and the adapter is the same.
  3. Check ifconfig

  4. Ping each other

    :::

Test Communication between bridged VMs on Different Hosts

:::spoiler Detailed Process

  1. Setting Bridged Adapter of each VM Note that, the adapter must be the same.
  2. Check ifconfig

    It should be the same of sub-ip as your true machine

  3. Ping :::

Reconstruct ARP cache by iteratively PING all subnet IP addresses

Objective: scanning all the machine in the same LAN

Note

DO NOT EXECUTE IN DORM… YOU’LL BE BANNED…

Source Code

#!/bin/bash

# ping all ip addresses in the local network
for ip in 192.168.0.{1..254}; do
	# delete old arp records
	sudo arp -d $ip > /dev/null 2>&1
	# get new arp info by ping
	ping -c 5 $ip > /dev/null 2>&1 &
done

# wait for all ping processes to finish
wait

# show scan results (arp table)
arp -n | grep -v incomplete

Detailed Process

:::spoiler Detailed Process

  1. Setting to Host-Only Adapter
  2. Check ifconfig It should be the same as your real machine

  3. Setting the code
     $ sudo dos2unix arpscan.sh
     $ sudo chmod 777 arpscan.sh
     $ vim arpscan.sh
     # modify the sub-ip as the same as your real machine, i.e. 192.168.56.{1..254}
     $ sudo bash arpscan.sh
    

    :::

Testing Communication between VMs on Different Hosts using NAT

Objective: Find another physical computer and open web service on each PC then use port forwarding to connect the web service to each other.

:::spoiler Detailed Process

  1. Find another physical computer and connect your own network
  2. Set to NAT mode
  3. Check your physical computer and VM’s ip

  4. Turn off VM and set port forwarding
  5. Open your web service
     $ sudo service apache2 start
    

    Then test if the service is open or not in local host reference link

  6. Start to let somebody else to query your service OR… You can edit the content of index.html and the result is as below.
     $ cd /var/www/html
     $ sudo rm index.html
     $ sudo touch index.html
     $ sudo vim index.html
     # Just write `It works on VM1!!!` and saved it
    

    :::