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
- Clone another VM
- Setting Network Configuration
Setting 2 VMs’ network config as above.
Note that, must check MAC address is different, promiscuous mode is Allow Alland the adapter is the same. -
Check ifconfig


-
Ping each other

:::
Test Communication between bridged VMs on Different Hosts
:::spoiler Detailed Process
- Setting Bridged Adapter of each VM
Note that, the adapter must be the same. -
Check ifconfig

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

- 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
- Setting to Host-Only Adapter
-
Check ifconfig It should be the same as your real machine



- 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
- Find another physical computer and connect your own network
- Set to NAT mode
-
Check your physical computer and VM’s ip


- Turn off VM and set port forwarding
- Open your web service
$ sudo service apache2 startThen test if the service is open or not in local host

- Start to let somebody else to query your service
OR…
You can edit the content of index.htmland 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
:::