This page contains information for the lab on DNS and Jekyll, including answers to the Lab questions.

GitHub Pages

Results for this activity will vary. To determine if your setup works, you should be able to see a page with some content serving at your GitHub pages output URL, which will be formatted like USERNAME.github.io/REPO-NAME where USERNAME is your GitHub user name and REPO-NAME is the name of the GitHub repository that is publishing the site.

Jekyll

Again results will vary. But if you see a site something like this one, then you are on the right track. You may see notes or suggestions from the instructor, which will appear as pull requests in your GitHub repository.

DNS Questions

Question 1. Use the dig command to query umich.edu. What is the response and how would you explain it?

Command:

dig umich.edu

Output:


; <<>> DiG 9.10.6 <<>> umich.edu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62466
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 7

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;umich.edu.			IN	A

;; ANSWER SECTION:
umich.edu.		1800	IN	A	172.66.0.37
umich.edu.		1800	IN	A	162.159.140.37

;; AUTHORITY SECTION:
umich.edu.		172800	IN	NS	dns3.umich.org.
umich.edu.		172800	IN	NS	dns4.umich.org.
umich.edu.		172800	IN	NS	dns1.itd.umich.edu.
umich.edu.		172800	IN	NS	dns2.itd.umich.edu.

;; ADDITIONAL SECTION:
dns2.itd.umich.edu.	1800	IN	A	192.12.80.222
dns1.itd.umich.edu.	1800	IN	A	192.12.80.214
dns3.umich.org.		1800	IN	A	18.225.0.3
dns4.umich.org.		1800	IN	A	3.133.73.51
dns2.itd.umich.edu.	172800	IN	AAAA	2607:f018:fffd:53::12
dns1.itd.umich.edu.	172800	IN	AAAA	2607:f018:fffd:53::2

;; Query time: 47 msec
;; SERVER: 10.10.10.10#53(10.10.10.10)
;; WHEN: Mon Sep 16 14:11:06 EDT 2024
;; MSG SIZE  rcvd: 279

Explanation:

The report is the response created by the DIG tool (Domain Information Groper) that tells what the IP address for a given domain name is. In this case it also lists additional DNS records for the associated nameservers and both IPv6 and IPv4 information.

Question 2. Use the command for the above response, and pipe the output to a file named umich-dns-record.txt. Provide the text file.

dig umich.edu > umich-dns-record.txt

Question 3. Use the dig command to query umich.edu. What is the command to return only the “answer” section of the response?

dig +noall +answer umich.edu

Bonus

Question: Note that you can ask for multiple domain names. For example: dig +noall +answer si.umich.edu umich.edu wisc.edu education.wisc.edu. The response is a good use case for a tool like awk. If you use a pipe to route the data from dig to awk, can you produce an output of just the domain and the IP address?

  • The awk command is actually a sort of mini program language, particularly useful for querying and parsing text files with columns. If you want to learn more about it, you can look at the G-AWK manual at https://www.gnu.org/software/gawk/manual/gawk.html. It is very useful for parsing data in columns, which is a frequent pattern seen in the command line/text interface. Variables are named with dollar signs $1 and the output patterns are enclosed in curly braces {}. This should be very similar to the exmaple presented in the slack channel, but you will need to add in a comma for the output.
dig +noall +answer si.umich.edu umich.edu wisc.edu education.wisc.edu

Output:

si.umich.edu.		1800	IN	A	18.221.166.136
umich.edu.		1800	IN	A	172.66.0.37
umich.edu.		1800	IN	A	162.159.140.37
wisc.edu.		14009	IN	A	144.92.9.70
education.wisc.edu.	14009	IN	A	99.83.210.234
education.wisc.edu.	14009	IN	A	75.2.33.159

With awk:

dig +noall +answer si.umich.edu umich.edu wisc.edu education.wisc.edu | awk '{print $1","$5}'

Output:

si.umich.edu.,18.221.166.136
umich.edu.,162.159.140.37
umich.edu.,172.66.0.37
wisc.edu.,144.92.9.70
education.wisc.edu.,99.83.210.234
education.wisc.edu.,75.2.33.159

Resources