From fcae1336d61a4b5b0e2fa976eb53a76aafa9e43d Mon Sep 17 00:00:00 2001 From: cloin Date: Fri, 17 Jun 2022 09:13:21 +0000 Subject: [PATCH] Begin reworking/reflowing some of the sections --- selected/http_to_phy.md | 122 ++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 79 deletions(-) diff --git a/selected/http_to_phy.md b/selected/http_to_phy.md index 56aec40..49405a1 100644 --- a/selected/http_to_phy.md +++ b/selected/http_to_phy.md @@ -1,21 +1,22 @@ -# So You Want to Make Internet Lasagna? +# Sending a Cat in 4 Easy Steps -## The Recipe +When you want to send a picture of a cat to your buddy, or get the latest weather, or watch a video, +your computer chunks up a bunch of information about what you're looking for, into a structured message, +usually referred to as a packet. -| Communication | Discovery | -| ------------- | --------- | -| HTTP | DNS | -| TCP | | -| IP | DHCP | -| Ethernet | ARP | +At a high level, typical packets are split into a few important sections like this: +``` +ETHERNET > IP > TCP > HTTP +``` +[NOTE(cloin): this is an awkward transition, is there a better way to phrase this/this section?] -
+## HTTP and You -## Starting from HTTP - -HTTP (Hypertext Transfer Protocol), is what browsers use to talk to web servers to send and receive web pages, -do basic transactions, like sending a form from your browser to the server, requesting some database -information for display, or updating your account settings. +Browsers use HTTP (Hypertext Transfer Protocol) to communicate with web servers to request and receive web pages, and perform +basic transactions, like updating your account, posting images, and getting the latest updates on the weather. +HTTP defines a process for packing messages to be sent back and forth over the network. +It provides context for the type of message being sent, like GET, PUT, POST, or DELETE, and the +format that data is sent in, like images, text or JSON. Good learning resources for HTTP: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview [NOTE(hayden): This link mentions proxies -- do those proxies use TCP to transfer the HTTP messages?] @@ -26,29 +27,33 @@ Good learning resources for HTTP: ## Diving into the meat and potatoes with TCP and IP -HTTP responses and requests are a sequence of bytes, chunked up and sent in packets, -often [NOTE(hayden): "often" -- should exceptions be mentioned?] through a protocol called TCP (Transmission Control Protocol). TCP provides a few -nice guarantees which make writing reliable network code a little easier. +HTTP responses and requests are a sequence of bytes, chunked up and sent in packets. + +Working backwards, we'll tackle TCP next. + +TCP is a protocol designed to aid in message delivery, built to help get your packets get from A -> B. +TCP provides a few nice guarantees which make writing reliable network code a little easier. When a message gets sent via TCP, it ensures that chunks get passed to the application in order. If packets get dropped along the way, or arrive out of order, TCP handles resending missed packets and buffering before the application gets the packet, until order can be restored. +TCP contains an important bit of information, called a port, that your operating system uses to send packets to the right program on your machine. If you listen on a port, like 80 (the typical port used for HTTP), +your OS will direct all traffic tagged with port 80, to you. Likewise, you can send to a specific port, and the destination will +use that to route it to the right program. + Good learning resources for TCP: -[NOTE(hayden): The first video here mentions ports -- as if they are already understood (and previous articles briefly mentioned them). Should ports have their own section befor this?] - https://www.youtube.com/watch?v=4IMc3CaMhyY - https://www.youtube.com/watch?v=F27PLin3TV0 -- https://www.youtube.com/watch?v=IP-rGJKSZ3s [NOTE(hayden): I think this link in particular needs further context (although I do understand why it is relevant, especially given the previous video)] +- https://www.youtube.com/watch?v=IP-rGJKSZ3s [NOTE(hayden): I think this link in particular needs further context (although I do understand why it is relevant, especially given the previous video) -- (cloin) check in on this at the meeting] <-- Link to expanded, less curated library of topical info --> <-- Branch into UDP, QUIC, TLS, etc. via link here --> -IP (Internet Protocol) sits directly below TCP, but often gets bundled together. IP is a -small header attached right above the protocol header [NOTE(hayden): Which protocol? TCP?], and contains important information, -like where the packet is coming from, and where the packet needs to go, so network hardware -along the way can route it from A->B to reach it's destination +IP (Internet Protocol) sits right before the TCP section, and contains important information for routing across larger networks, like where the packet is coming from (the source IP address), and where the packet needs to go (the destination IP address). +Routers use IP addresses to route the packet across the internet. Good learning resources for IP: -- https://www.youtube.com/watch?v=rPoalUa4m8E [NOTE(hayden): Should point to point links, 'frames', and MAC addresses be covered before this point?] +- https://www.youtube.com/watch?v=rPoalUa4m8E [NOTE(hayden): Should point to point links, 'frames', and MAC addresses be covered before this point? -- (cloin) probably needs to be swapped with another video, IP *shouldn't* need to cover those, those *should* live in the ethernet content] - https://www.youtube.com/watch?v=VWJ8GmYnjTs <-- Link to expanded, less curated library of topical info --> @@ -63,7 +68,20 @@ Some good outlets for exercises: - https://beej.us/guide/bgnet/html/ [NOTE(hayden): This seems like an excellent resource!] - https://github.com/shuveb/zerohttpd [NOTE(hayden): If we can provide a brief description of the different folders in this repo, that might be helpful] -## Taking the Real Plunge +## Using the DNS Phonebook + +The last really important bit you need to know is DNS. The job of DNS is to help you find IP addresses for domain names, +like "handmade.network". + +Good learning resources for DNS: +- https://wizardzines.com/zines/dns/ +- https://messwithdns.net/ +- https://www.cloudflare.com/learning/dns/what-is-dns/ + +<-- Link to expanded, less curated library of topical info --> +<-- Branch into DNS over HTTPS / DNS Lookup Security via link here --> + +## Bits at Rock Bottom Ok, so you've got some of the basics down, and you're ready for some serious spelunking? Let's talk Ethernet and PHY. @@ -71,60 +89,6 @@ Let's talk Ethernet and PHY.
-## Buttoning up with Discovery Protocols - -So, how does the computer get an IP address? How do we know what the router's IP is? -How do find the IP address of "https://handmade.network/" so we can send it a request? -Discovery protocols to the rescue! - -[NOTE(hayden): Do we need links for this section?] - -## Using the DNS Phonebook - -DNS sits at the top acting as a final, important, icing on the cake. The job of DNS is primarily to -provide lookup services for domain names. To resolve "https://handmade.network/" into an IP address -so we can send it an HTTP request, we send a lookup request to the DNS server, and it will do the requisite -forwarding until it either has an IP address to send back, or fails. - -Good learning resources for DNS: -- https://www.cloudflare.com/learning/dns/what-is-dns/ - -<-- Link to expanded, less curated library of topical info --> -<-- Branch into DNS over HTTPS / DNS Lookup Security via link here --> - - -## Finding the Mailman with DHCP - -DHCP sits near the middle, but is incredibly important. When you want to send a packet to a network -beyond your own, somebody has to deliver that packet. To find the packet post office, your computer -broadcasts a DHCP discover packet, and collects IP offers from all DHCP servers on the network. -At that point, typically it will fire off a request for the first IP it recieves, and get a -confirmation or denial for that request. DHCP acks typically also contain the IP address of the router, -the local DNS server, and more - -Good learning resources for DHCP: -- https://docs.microsoft.com/en-us/windows-server/networking/technologies/dhcp/dhcp-top - -<-- Link to expanded, less curated library of topical info --> -<-- Branch into PXE Booting via link here --> - -## Putting on the ARP Goggles - -At the bottom of the protocol stack, ARP (Address Resolution Protocol) is how your computer -reaches out and understands the local network it lives on. When an ethernet cable gets plugged into -your computer, it broadcasts an ARP packet, gathering responses to know how to address -messages directly to specific local machines. The initial ARP packet contains the MAC -address of the computer sending, and responses from all machines that want to be discovered -get fired back with their MAC addresses in tow. - -Good learning resources for ARP: -- https://www.youtube.com/watch?v=aamG4-tH_m8&list=PLowKtXNTBypH19whXTVoG3oKSuOcw_XeW&index=9 -- https://www.saminiir.com/lets-code-tcp-ip-stack-1-ethernet-arp/ - -<-- Link to expanded, less curated library of topical info --> -<-- Branch into TAP via link here --> - - ## Fun Tangents - Network Bridging