Networking
CIS 1912
Logistics
�
What actually happens here?
https://medium.com/@kylelzk/networking-theory-understanding-tcp-ip-the-backbone-of-the-internet-c435f50d7a9a
https://medium.com/@kylelzk/networking-theory-understanding-tcp-ip-the-backbone-of-the-internet-c435f50d7a9a
Debugging Layers of Networking
Browser Demo
Identity & Routing
Network: IP
[source ip, destination ip, port]
A Note: IPv6
$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
4: enp7s0u1u4u4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 64:4b:f0:2b:3d:11 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.95/24 brd 192.168.1.255 scope global dynamic noprefixroute enp7s0u1u4u4
valid_lft 58529sec preferred_lft 58529sec
inet6 fe80::7005:8ca3:a56b:b442/64 scope link noprefixroute
valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:f5:42:75:f3 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
Loopback interface
Ethernet
Docker
Linux: ip addr show
Mac: ifconfig
Windows: ipconfig \all
Visualizing
192.168.1.0 - 192.168.1.255
(192.168.1.0/24)
192.168.1.50
192.168.1.100
Creating a pipe
Transport: TCP
$ ss -4lt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:47497 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:mysql 0.0.0.0:*
LISTEN 0 10 0.0.0.0:57621 0.0.0.0:*
LISTEN 0 1 127.0.0.1:12315 0.0.0.0:*
Visualizing
192.168.1.0 - 192.168.1.255
(192.168.1.0/24)
192.168.1.50
192.168.1.100
:80
192.168.1.50:80
Filling the pipe
Application: HTTP
HTTP Request Components
Methods
GET
PUT
POST
DELETE
URL
https://httpstat.us/200
Protocol�HTTP/HTTPS�Specifies whether or not to use TLS encryption
Host�Which domain name to request to�Port defaults to 80
Path�Which resource on the host to request
Headers
Headers pass metadata about the request.
Examples:
Body
Example Request
GET httpstat.us/200
$ curl -vv 'httpstat.us/200'
* Trying 172.67.148.117...
* TCP_NODELAY set
* Connected to httpstat.us (172.67.148.117) port 80 (#0)
> GET /200 HTTP/1.1
> Host: httpstat.us
> User-Agent: curl/7.58.0
> Accept: */*
Method
Headers
URL
HTTP Response Components
Status codes
2xx
4xx
3xx
5xx
Visualizing
192.168.1.0 - 192.168.1.255
(192.168.1.0/24)
192.168.1.50
192.168.1.100
:80
HTTP
TCP Connection
Example Response
GET httpstat.us/200
curl -vv https://cis1912.org
cURL Demo
What’s a CORS?
Cross-origin resource sharing (CORS) is a mechanism for�integrating applications. CORS defines a way for client web applications that are loaded in one domain to interact with resources in a different domain.
https://aws.amazon.com/what-is/cross-origin-resource-sharing
Using HTTP
Limits of HTTP
What if we need long lasting connections?
Websocket vs HTTP
Websockets
Postman
Demo
HTTP Server Demo
Before we Fin
Fin