In this lab you will:
In this lab, we will have two computers setup on their own network (as docker containers). They share this network with your Windows 10 host computer. Access to the Internet is obtained through the host computer.
The server computer exposes two services (a web server and secure shell) to the host computer and workstation.
+-------------+
| workstation |----+
+-------------+ |
| +---------------+ ++++++++++++++
+---| host computer |-----| Internet |
| +---------------+ ++++++++++++++
+-------------+ |
| server |----+
+-------------+
ipconfig / ifconfig
For retrieving IP configuration of a deviceping
To test communications with another device on a network.nslookup
To resolve an IP Address to a DNS Namenmap
To test open TCP ports on a network endpointtracert
(traceroute) For tracing the entire path a packet traverses to reach and endpointnetstat
For viewing all active communications (inbound and outbound).ssh
For connecting to another computer over the networklynx
A command line web browserThis should be done before every lab! On the computer where your labs are located:
ist346-labs
PS > cd ist346-labs
PS ist346-labs> git pull origin master
lab-C
folder:PS ist346-labs> cd lab-C
PS ist346-labs\lab-C> docker-compose up -d
PS ist346-labs\lab-C> docker-compose ps
First let’s try some network commands from the PowerShell prompt, which is your Windows 10 host computer.
Every computer on the internet must have an IP address, but this is not usually how we go about finding services. For example you don’t need to know Facebook’s IP address to use it. We use the name facebook.com instead, but rest assured there’s an IP address behind the communication, so…
PS ist346-labs\lab-C> ipconfig
Ethernet0
as that is the primary interface for this computer. What is your IP address?You probably don’t call your friends using their phone number - you use a contact list and dial by name. DNS serves this purpose on the Internet - looking up names to IP addresses and vice-versa. Imagine a system where if you ask to dial someone not in your contact list it would look up the phone number for you in someone else’s list. That, in essence is how DNS works. There are several DNS servers on the internet each is the authority over one or more domains, like syr.edu or google.com.
nslookup
. Type:
PS ist346-labs\lab-C> nslookup ischool.syr.edu
ischool.syr.edu
. Make a note of the IP address as you will need it for the next part. (At the time this )PS ist346-labs\lab-C> nslookup 128.230.146.100
ischool.syr.edu
PS ist346-labs\lab-C> nslookup ischool.syr.edu 8.8.8.8
8.8.8.8
is the DNS server we wish to use to resolve the name for us. Non-authoratative answer
the DNS server is telling you that it does not contain the actual record for this name - it got it from another server.Looking up names and numbers is fine, but how to we know the computer we want to access is online? This is the purpose of the ping
utility. It will let you know if a host is ‘alive’.
PS ist346-labs\lab-C> ping -n 4 ischool.syr.edu
1.2.3.4
, which I’m certain is not around: PS ist346-labs\lab-C> ping -n 2 1.2.3.4
PS ist346-labs\lab-C> ping -n 2 www.apphammer.co
IMPORTANT: It should be noted that just because the computer responds, it does not imply the service running on the computer actually works. Ping only verifies network connectivity between you and the host in question. Also some network administrators block ping requests via a firewall so the host might actually function but not respond to ping requests.
The trace route tracert
utility shows the route over the Internet your data packets take from source to destination. For each router along the way (called a hop) it calculates the round-trip time (RTT) from source to that hop. In general the lower the number of hops and the lower the round trip time (RTT) the fast the communication between you and the host will be.
PS ist346-labs\lab-C> tracert ischool.syr.edu
ping
BTW).Let’s perform a longer tracert:
PS ist346-labs\lab-C> tracert www.apphammer.co
This output used 20 hops and required 61 milliseconds. Again, consistent with the ping
PS ist346-labs\lab-C> tracert -w 10 -h 8 1.2.3.4
As we said before just because a host responds to a ping it does not necessarily imply the service running on the host is available. For instance you might be able to ping a webserver but for some reason none of the web pages on that server load.
The applications which run on these servers communicate over a port. The port consists of a number between 0 and 65535 and a protocol of either TCP or UDP. Common services we use everyday such as HTTP are setup to run over the same port. This ensures consistency from and makes it easer for clients to consume the service.
A list of the well-known ports can be found here: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
PS ist346-labs\lab-C> docker-compose exec workstation bash
root@workstation:/#
root@workstation:/# ifconfig
ifconfig
not ipconfig
. Also the interface it called eth0
. Make a note of the IP Address of your workstation.The nmap
utility allows you to scan a host for open ports. Open ports will give you an indication of which services are available.
ischool.syr.edu
for open ports. Type:root@workstation:/# nmap ischool.syr.edu
80/tcp http
443/tcp https
lynx
utility. Type:
root@workstation:/# lynx ischool.syr.edu
lynx
is a text-only browser) q
to quit and press y
to confirm to return to the bash prompt.root@workstation:/# nmap server
22/ssh
and 80/http
root@workstation:/# lynx http://server:80
q
to quit and press y
to confirm to return to the bash prompt.:80
for the port. This is assumed by the lynx
application because 80
is the well-known port for the http
prococol.In this last section we will connect to the server from the workstation using ssh (secure shell) and verify the open ports locally.
root@workstation:/# ssh root@server
server
as user root
. You will be prompted to confirm you want to connect. Type yes
and press ENTER
. root
password on server
. This password is IST346
root@server:~#
root@server:~# ifconfig
root@server:~# nmap localhost
root@server:~# nmap workstation
netstat
is the better choice. It will show you listening connections, which processes are running the connections and which clients have connected to the port. Type:root@server:~# netstat -ap
*:http
and *:ssh
services running, as a client labC_workstation
connected to ssh
. Yes, that’s you!
You should see
connection to server closed`root@workstation:/#
prompt, type:root@workstation:/# exit
to return to PowerShellTo tear down this lab:
PS ist346-labs\lab-C> docker-compose down
michaelfudge.com
using the dns server 1.1.1.1
?tracert
to your destination in the designated number of hops?tracert
command?netstat
differ from nmap
?ssh
into the server elephant.com
as user dumbo
?google.com
?