ITIC:Networks and protocols - Exercises

From Juneday education
Jump to: navigation, search

Networking

Find out your IP address

Find out what IP address your computer has. Work in groups or pairs. Your friends' IP addresses, do they look similar? How?

Find out your DNS settings

Find out what DNS your computer is using. How was that configured? (Guess if you don't know)

What is the IP number of wiki.juneday.se ? How did you find out? What happens if you point your browser to http://THE_IP_NUMBER_HERE ? (Use the IP number you just found out). Why? (Guess if you don't know)

Ports

Use a search engine to figure out what services typically is behind port 631. What is the protocol commonly used for this service called and what does the abbreviation stand for?

Point your browser (in a new tab) to http://wiki.juneday.se:80 . What do you think :80 means? Why do you think it's not necessary to add :80 to that URL?

Protocols

HTTP

The following is the full HTTP request to a web server:

GET /index.html HTTP/1.0
Host: 24-timmars.myndigheten.se

What do you think it means? Why do you think the Host header is needed? Hint: If it's not present, we'd get a different response from the same server.

The following is the complete response from the same web server using the above HTTP request:

200 OK
Connection: close
Date: Fri, 28 Jun 2019 09:32:36 GMT
Via: 1.1 varnish (Varnish/6.2)
Accept-Ranges: bytes
Age: 0
Server: Apache
Vary: Accept-Encoding
Content-Length: 588
Content-Type: text/html; charset=UTF-8
Client-Date: Fri, 28 Jun 2019 09:32:37 GMT
Client-Peer: 2a02:2350:5:103:3680:0:15ef:87f2:80
Client-Response-Num: 1
Title: 24-TIMMARSMYNDIGHETEN
X-Powered-By: PHP/7.2.19
X-Varnish: 249170128

<html>
<head><title>24-TIMMARSMYNDIGHETEN</title></head>

<body bgcolor="#D9D9D9" leftmargin="0" topmargin="150">
<center>
<table><tr><td>
<img src="24h.gif">
</td><td width="20"></td><td>
<font face="verdana, arial, helvetica" size="1"><b>
24-timmarsmyndighetens webbplats �r st�ngd f�r tillf�llet.<br>
V�ra ordinarie �ppettider �r vardagar 08.00 - 18.00</b><br><br>

Box 2280, 103 17 Stockholm<br>
Norra Riddarholmshamnen 1<br>
Telefon 08-454 46 00<br>
<a href="http://www.statskontoret.se">www.statskontoret.se</a></font>
</td></tr></table>
</center>
</body>
</html>

What part do you think is the HTTP headers? What part is the data? What file format do you think the data is in?

Why do you think there are some weird characters as part of the response? (Guess if you don't know).

Hint: Look at the headers. If they say one thing, and the text file on the server doesn't match this "thing", then the file transferred will be interpreted wrongly.

Data formats

XML

Translate the following Json data to XML:

{
  "teachers": [
    {
      "name": "Henrik"
    },
    {
      "name": "Rikard"
    }
  ]
}

Json

Translate the following XML data to Json:

<?xml version="1.0" encoding="UTF-8"?>
<students school="GU">
  <student>
    <name>Anna</name>
    <grade>VG</grade>
  </student>
  <student>
    <name>Bengt</name>
    <grade>U</grade>
  </student>
</students>

CSV

Create a csv file with the same data as one of the above examples. Remember that the first row should be column names, and the following rows should be data in the same order as the columns.

Open the file in a spreadsheet application.

Links

Where to go next

The next page is Network_tools_and_commands.

« PreviousBook TOCNext »