14 - Into to Networking

Class: CSCE-313


Notes:

3rd midterm on Friday 4/24 or Mon 4/27

Try to work out problems under Weekly-HW

What is a network?

Notes:

The network does the routing

Notes:

The Internet: a "nuts and bolts" view

...

Notes:

"Fun" Internet-connected devices

...

Notes:

The functionality of "networking"

....

Notes:

Routing

...

Packet forwarding

...

Notes:

Examples:

┌──(macc㉿kaliLab)-[~]
└─$ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.64.2  netmask 255.255.255.0  broadcast 192.168.64.255
        inet6 fd15:7568:1b93:9ef1:49a9:ac71:34f7:cb32  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::60cf:81ff:fe55:308d  prefixlen 64  scopeid 0x20<link>
        inet6 fd15:7568:1b93:9ef1:60cf:81ff:fe55:308d  prefixlen 64  scopeid 0x0<global>
        ether 62:cf:81:55:30:8d  txqueuelen 1000  (Ethernet)
        RX packets 129735  bytes 97878313 (93.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 111498  bytes 19126431 (18.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3450  bytes 13001871 (12.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3450  bytes 13001871 (12.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.10.14.2  netmask 255.255.254.0  destination 10.10.14.2
        inet6 fe80::8af5:89d2:6df1:a2d0  prefixlen 64  scopeid 0x20<link>
        inet6 dead:beef:2::1000  prefixlen 64  scopeid 0x0<global>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500(UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 2821 (2.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Protocol Layering

...

Notes:

The open system interconnection (OSI) model

...

Notes:

The TCP/IP Reference Model

...

Notes:

A client-server transaction

....

Notes:

What's a protocol?

...

Notes

Example of a client-server protocol:

curl

Example

┌──(macc㉿kaliLab)-[~]
└─$ curl -v https://www.google.com

Here is the request that was send:

* Connected to www.google.com (142.251.151.119) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://www.google.com/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: www.google.com]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: curl/8.15.0]
* [HTTP/2] [1] [accept: */*]
> GET / HTTP/2
> Host: www.google.com
> User-Agent: curl/8.15.0
> Accept: */*
>
* Request completely sent off

Response looks like:

< HTTP/2 200
< date: Mon, 06 Apr 2026 19:36:58 GMT
< expires: -1
< cache-control: private, max-age=0
< content-type: text/html; charset=ISO-8859-1
< content-security-policy-report-only:
...

IP datagram

...

Notes:

TCP header

...

Notes:

A programmer's view of the Internet

...

Notes:

Example:

> nslookup www.cs.tamu.edu
Server:         128.194.254.1
Address:        128.194.254.1#53

www.cs.tamu.edu canonical name = redirect.engr.tamu.edu.
redirect.engr.tamu.edu  canonical name = d3s3b8hbw2bor0.cloudfront.net.
Name:   d3s3b8hbw2bor0.cloudfront.net
Address: 3.169.221.28
Name:   d3s3b8hbw2bor0.cloudfront.net
Address: 3.169.221.94
Name:   d3s3b8hbw2bor0.cloudfront.net
Address: 3.169.221.95
Name:   d3s3b8hbw2bor0.cloudfront.net
Address: 3.169.221.22
> dig +short www.google.com
142.251.152.119
142.251.153.119
142.251.154.119
142.251.155.119
142.251.156.119
142.251.157.119
142.251.150.119
142.251.151.119

IP Addresses

...

Notes:

Byte order for shorts and ints

...

Notes:

Result:

Host BO: 4 3 2 1
Network BO: 1 2 3 4
inet_ntop: 1.2.3.4.

Dotted Decimal Notation

...

Notes:

Internet domain names

...

Notes:

Querying DNS

...

Notes:

Example:

> dig linux2.cse.tamu.edu

; <<>> DiG 9.10.6 <<>> linux2.cse.tamu.edu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53704
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1220
;; QUESTION SECTION:
;linux2.cse.tamu.edu.           IN      A

;; ANSWER SECTION:
linux2.cse.tamu.edu.    3600    IN      A       128.194.166.90

;; AUTHORITY SECTION:
cse.tamu.edu.           3600    IN      NS      csce-info-grid.net.tamu.edu.
cse.tamu.edu.           3600    IN      NS      wemr-info-dhcp.net.tamu.edu.
cse.tamu.edu.           3600    IN      NS      csce-info-dhcp.net.tamu.edu.

;; ADDITIONAL SECTION:
wemr-info-dhcp.net.tamu.edu. 3600 IN    A       128.194.211.237
csce-info-grid.net.tamu.edu. 3600 IN    A       165.91.16.132
csce-info-dhcp.net.tamu.edu. 3600 IN    A       128.194.169.147
csce-info-dhcp.net.tamu.edu. 3600 IN    A       165.91.16.135

;; Query time: 12 msec
;; SERVER: 128.194.254.1#53(128.194.254.1)
;; WHEN: Wed Apr 08 14:21:12 CDT 2026
;; MSG SIZE  rcvd: 227

getaddrinfo - name -> ip mapping

...

Notes:

Example:

// Get a list of addrinfo recors
memset (&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET;    // IPv4 only
hints.ai_socktype = SOCK_STREAM;    // Connections only
if ((rc = getaddrinfo(host, NULL, &hints, &lisp)) != 0) {
	fprintf(stderr, "getaddrinfo error")
	ecit(1);
}

// Walk your rc linked list

getaddrinfo

...

Example:

Domain Naming System

...

Notes:

sockaddr = socket address

...

Notes:


HW1 Q1 - Networking

Problem 1

Try all of these questions!


Anatomy of an internet connection

...

Notes: