YouTube2Text

I Bet Nobody Has Ever Explained the Networking Topics Like This Before — Transcript

by Cloud X Berry · 4,105 words · 730 segments · language en · Watch on YouTube

Full transcript

  1. 0:00I still remember how confusing
  2. 0:01networking felt when I first started
  3. 0:03working with distributed applications.
  4. 0:05You could have an application that was
  5. 0:07working perfectly. The database was
  6. 0:09running, the credentials were correct,
  7. 0:11and yet the application simply could not
  8. 0:14connect to it. The frustrating part was
  9. 0:16that the error message often did not
  10. 0:18tell you what was actually happening
  11. 0:20underneath.
  12. 0:21You were just staring at something like
  13. 0:22a connection timeout and wondering,
  14. 0:25"Okay, but where exactly did this
  15. 0:27request disappear?"
  16. 0:29That is really what makes networking
  17. 0:30difficult for developers.
  18. 0:32The thing that finally made networking
  19. 0:34click for me was realizing that I did
  20. 0:36not need to memorize 20 different
  21. 0:38definitions. I just needed to follow a
  22. 0:41request and understand why each piece of
  23. 0:43networking exists when I reach it.
  24. 0:46So, that is what we're going to do here.
  25. 0:48Let's say we're building a ride-sharing
  26. 0:50application called RideNow.
  27. 0:52A passenger opens the app, enters a
  28. 0:54destination, and taps request ride.
  29. 0:58Somewhere in the background, the system
  30. 1:00needs to find a nearby driver, send the
  31. 1:02request to that driver, and once the
  32. 1:04driver accepts, the passenger should be
  33. 1:06able to see the driver's location moving
  34. 1:08on the map.
  35. 1:09That sounds simple from the user's point
  36. 1:11of view. They tap a button, and a few
  37. 1:13seconds later they see a driver.
  38. 1:15But for that one experience to work, a
  39. 1:18lot has to happen across the network.
  40. 1:20So, let's follow that request from the
  41. 1:22passenger's phone all the way to the
  42. 1:24RideNow backend and understand why each
  43. 1:27networking concept is needed along the
  44. 1:29way.
  45. 1:30Number one, IP address. Let's start with
  46. 1:33a very basic question. When the
  47. 1:35passenger's phone wants to communicate
  48. 1:37with another machine, how does the
  49. 1:39network know where that machine is?
  50. 1:41Every device communicating over an IP
  51. 1:44network needs an IP address. You can
  52. 1:46think of it like a postal address. If I
  53. 1:49want to send something to your house, I
  54. 1:50need to know where your house is.
  55. 1:53In the same way, when the RideNow
  56. 1:55application wants to send data to
  57. 1:56another machine, the network needs an
  58. 1:58address that tells it where that machine
  59. 2:00can be reached.
  60. 2:02There are two versions of IP that you
  61. 2:04will come across most often, IPv4 and
  62. 2:07IPv6.
  63. 2:09IPv4 is the older and still extremely
  64. 2:11common version.
  65. 2:13It uses a 32-bit address space, which
  66. 2:15gives us roughly 4 billion possible
  67. 2:18addresses. That sounds like a huge
  68. 2:20number, but once you consider phones,
  69. 2:23laptops, servers, cloud resources, IoT
  70. 2:26devices, and everything else connected
  71. 2:28to the internet, we eventually started
  72. 2:30running out of IPv4 addresses.
  73. 2:33That is one of the main reasons IPv6 was
  74. 2:36introduced.
  75. 2:37IPv6 uses a much larger 128-bit address
  76. 2:41space, giving us an enormous number of
  77. 2:43possible addresses.
  78. 2:45In practical terms, IPv6 gives the
  79. 2:48internet a vastly larger pool of
  80. 2:50addresses than IPv4.
  81. 2:52You do not need to memorize the actual
  82. 2:54numbers here. The important difference
  83. 2:56is simply this.
  84. 2:57IPv4 has a much smaller address space,
  85. 3:00while IPv6 was designed with a
  86. 3:02dramatically larger address space to
  87. 3:05support the continued growth of
  88. 3:06connected devices.
  89. 3:08And IPv6 is not just about having more
  90. 3:10addresses. It also changes some aspects
  91. 3:13of how addressing and network
  92. 3:14configuration work.
  93. 3:16But from a developer's perspective, the
  94. 3:18most important thing to remember is that
  95. 3:20both IPv4 and IPv6 solve the same
  96. 3:24fundamental problem.
  97. 3:25They provide addressing so devices can
  98. 3:27communicate across an IP network.
  99. 3:30There is another important thing to
  100. 3:32understand about IP addresses.
  101. 3:34An IP address is not necessarily a
  102. 3:36permanent identity for a device.
  103. 3:39Your phone can have one address when it
  104. 3:41is connected to your home Wi-Fi and
  105. 3:43another when it switches to mobile data.
  106. 3:45A server can also have multiple
  107. 3:47addresses depending on how it is
  108. 3:49connected to a network.
  109. 3:51So, it is better to think of IP address
  110. 3:53as a location where a device can
  111. 3:55currently be reached rather than as the
  112. 3:57permanent identity of that device.
  113. 4:00Now, our passenger's phone has an IP
  114. 4:02address, but we need to understand
  115. 4:04something else.
  116. 4:05Is that address reachable from anywhere
  117. 4:07on the internet or is it only useful
  118. 4:09inside the passenger's local network?
  119. 4:12And that's where private and public IP
  120. 4:14addresses come in.
  121. 4:16When the passenger connects to their
  122. 4:17home Wi-Fi, the phone normally receives
  123. 4:20a private IP address.
  124. 4:22That address works inside the local
  125. 4:24network, but another device somewhere on
  126. 4:26the internet cannot simply use that
  127. 4:28address to connect directly to the
  128. 4:30phone.
  129. 4:31A public IP is different because it can
  130. 4:33be reached across the internet.
  131. 4:36This distinction becomes really
  132. 4:37important when we build Ride Now.
  133. 4:39We might have some parts of the system
  134. 4:41that need to receive traffic from the
  135. 4:43internet, while other parts, such as our
  136. 4:45databases, should only be reachable from
  137. 4:47inside our private environment. So, the
  138. 4:50passenger's phone is inside one network,
  139. 4:52while the Ride Now infrastructure is
  140. 4:54somewhere else.
  141. 4:56But, how does the phone actually find
  142. 4:58the Ride Now server?
  143. 4:59The passenger doesn't know its IP
  144. 5:01address, and they certainly shouldn't
  145. 5:02have to type one.
  146. 5:04They just open Ride Now using its name.
  147. 5:07And that's where DNS comes in.
  148. 5:09DNS, or Domain Name System, translates a
  149. 5:12host name into an IP address that the
  150. 5:14network can use.
  151. 5:16So, when Ride Now needs to connect to
  152. 5:18its back end, DNS helps the application
  153. 5:21discover where that back end can be
  154. 5:22reached.
  155. 5:23This lookup isn't necessarily performed
  156. 5:25from scratch every time.
  157. 5:27DNS responses can be cached, and those
  158. 5:30cached results have a lifetime
  159. 5:32controlled by something called TTL.
  160. 5:35A host name can also point to multiple
  161. 5:37IP addresses, which becomes useful when
  162. 5:39an application needs to handle traffic
  163. 5:41across multiple machines.
  164. 5:43So, DNS has helped our phone find the
  165. 5:45machine it needs to communicate with.
  166. 5:48But, knowing which machine we want isn't
  167. 5:50quite enough.
  168. 5:51That machine could be running several
  169. 5:53different services at the same time.
  170. 5:55Maybe there's a web application, a
  171. 5:57database, and some other service running
  172. 5:59there.
  173. 6:00So, how does the network know which
  174. 6:02application we're actually trying to
  175. 6:04reach?
  176. 6:05That's where ports come in.
  177. 6:07An IP address identifies the machine,
  178. 6:09while a port identifies the application
  179. 6:12or service we want to communicate with
  180. 6:14on that machine.
  181. 6:15A single server can run many different
  182. 6:17network services at the same time.
  183. 6:20They can all use the same machine
  184. 6:21because the network can distinguish
  185. 6:23between them using different ports.
  186. 6:25This is something developers run into
  187. 6:27quite often.
  188. 6:28You can have an application that is
  189. 6:30running perfectly, but another machine
  190. 6:32still cannot connect to it.
  191. 6:34One reason could be that the application
  192. 6:36is listening only on localhost instead
  193. 6:38of accepting connections from the
  194. 6:40network.
  195. 6:41So, there's an important difference
  196. 6:42between an application being up and an
  197. 6:45application actually being reachable
  198. 6:47over the network.
  199. 6:48Now, our request has a destination
  200. 6:50machine and a destination service.
  201. 6:53But, before the request can leave the
  202. 6:55passenger's local network, there's
  203. 6:56another piece of networking happening
  204. 6:58underneath all of this.
  205. 7:00Inside a local network, devices don't
  206. 7:02communicate using IP addresses alone.
  207. 7:05That's where MAC addresses come in.
  208. 7:08A MAC address is associated with a
  209. 7:09network interface and is mainly used for
  210. 7:12communication within the local network.
  211. 7:15So, when the passenger's phone sends
  212. 7:16data through Wi-Fi, the local network
  213. 7:19needs to know which network interface
  214. 7:21should receive that data.
  215. 7:23This is where it helps to separate IP
  216. 7:24addresses and MAC addresses in your
  217. 7:26head.
  218. 7:27An IP address is the logical address
  219. 7:29used for communication across networks.
  220. 7:32A MAC address is associated with the
  221. 7:34network interface and is used for
  222. 7:36communication on the local network.
  223. 7:39The phone knows the destination IP, but
  224. 7:41it may not know the MAC address
  225. 7:43associated with that destination yet.
  226. 7:45So, how does it find it?
  227. 7:47That's exactly where ARP comes in.
  228. 7:50ARP, or Address Resolution Protocol,
  229. 7:53helps a device discover the MAC address
  230. 7:55associated with an IP address on the
  231. 7:57local network. The phone can essentially
  232. 8:00ask the local network, "Who has this IP
  233. 8:02address?"
  234. 8:03The device that owns that address can
  235. 8:05respond with its MAC address, and the
  236. 8:07phone can then use that information to
  237. 8:09communicate across the local network.
  238. 8:12The result can also be cached, so the
  239. 8:14device doesn't have to ask the same
  240. 8:15question every time.
  241. 8:17You probably won't think about ARP when
  242. 8:19you're building a ride-now feature, but
  243. 8:21when you're debugging a lower-level
  244. 8:23networking problem, understanding the
  245. 8:25relationship between IP addresses and
  246. 8:27MAC addresses can be very useful.
  247. 8:30Now, the phone knows how to communicate
  248. 8:31on its local network, but ride now isn't
  249. 8:34sitting inside the passenger's house.
  250. 8:36The request has to travel across several
  251. 8:38different networks before it reaches the
  252. 8:40ride-now infrastructure,
  253. 8:42and that's where routing comes in.
  254. 8:45As the request travels across the
  255. 8:46network, routers look at the destination
  256. 8:49and decide where the traffic should go
  257. 8:50next. The passenger's phone doesn't need
  258. 8:53to know the complete path from their
  259. 8:54house to the ride-now infrastructure.
  260. 8:57Each router along the way makes a
  261. 8:59decision about the next step and
  262. 9:00forwards the traffic toward the
  263. 9:02destination.
  264. 9:03This is why the path between a client
  265. 9:05and a server can involve many different
  266. 9:07networks.
  267. 9:08It also explains why you can sometimes
  268. 9:10have a perfectly healthy application and
  269. 9:12still experience latency or packet loss
  270. 9:15somewhere between the client and the
  271. 9:16server.
  272. 9:17But now, we have another problem.
  273. 9:20Our passenger's phone is using a private
  274. 9:22IP address, but it needs to communicate
  275. 9:24with something outside that private
  276. 9:26network. So, how does that private
  277. 9:28address communicate with the public
  278. 9:30internet? That's where NAT comes in.
  279. 9:33NAT, or Network Address Translation,
  280. 9:36allows a private address to be
  281. 9:38translated into a public address when
  282. 9:40traffic leaves the private network. The
  283. 9:42home router keeps track of that
  284. 9:44connection, so that when the response
  285. 9:45comes back, it knows which device inside
  286. 9:48the private network should receive it.
  287. 9:50That's why multiple devices in your home
  288. 9:52can access the internet at the same time
  289. 9:55while sharing the same public
  290. 9:56connection. The same idea is also useful
  291. 9:59in cloud environments. You might have
  292. 10:01private servers that need outbound
  293. 10:03internet access for things like updates
  294. 10:05or external services, but you don't want
  295. 10:08those servers to be directly reachable
  296. 10:10from the internet.
  297. 10:11NAT allows that outbound communication
  298. 10:14without necessarily exposing those
  299. 10:15private machines to incoming
  300. 10:17connections.
  301. 10:18So, our request can now move between
  302. 10:21networks.
  303. 10:22But let's say Ride Now is becoming a
  304. 10:24serious production system. We don't want
  305. 10:26every machine in our environment sitting
  306. 10:28in one large network where everything
  307. 10:30can communicate with everything else.
  308. 10:33We need some boundaries. And that's
  309. 10:35where subnetting comes in. Subnetting
  310. 10:38allows us to divide a larger network
  311. 10:40into smaller network segments.
  312. 10:42For Ride Now, we might have one area for
  313. 10:44services that need to receive external
  314. 10:46traffic, another area for application
  315. 10:49services, and another area where
  316. 10:51databases and other sensitive systems
  317. 10:53are kept. The idea is not simply to
  318. 10:55organize things neatly. These boundaries
  319. 10:58also allow us to control how traffic
  320. 11:00moves between different parts of the
  321. 11:02system. For example, the database might
  322. 11:05only need to accept traffic from the
  323. 11:06application services. It doesn't need to
  324. 11:09be directly reachable from the public
  325. 11:11internet. So, subnetting gives us a way
  326. 11:13to create these network boundaries.
  327. 11:16But whenever a new machine joins one of
  328. 11:17these networks, it still needs to know
  329. 11:19something very basic. What IP address
  330. 11:23should it use? What is its gateway?
  331. 11:25Which DNS server should it use? We could
  332. 11:28configure all of that manually, but
  333. 11:30imagine doing that for hundreds or
  334. 11:32thousands of machines.
  335. 11:34That's where DHCP comes in.
  336. 11:37DHCP, or Dynamic Host Configuration
  337. 11:40Protocol, allows devices to receive
  338. 11:43their network configuration
  339. 11:44automatically.
  340. 11:45You've probably used DHCP without even
  341. 11:48realizing it. When you connect your
  342. 11:50phone or laptop to Wi-Fi, you don't
  343. 11:52manually enter all the network
  344. 11:54information. The network provides the
  345. 11:56configuration your device needs.
  346. 11:58The same basic idea can be used when
  347. 12:00machines join larger networks.
  348. 12:03DHCP can provide the device with an IP
  349. 12:06address, along with information such as
  350. 12:08the network configuration, gateway, and
  351. 12:10DNS server it should use. So, now our
  352. 12:13device has the information it needs to
  353. 12:15communicate on the network. But, simply
  354. 12:17being able to reach another machine
  355. 12:19isn't enough. When the passenger taps
  356. 12:21request ride, we need to make sure that
  357. 12:24the data arrives reliably and in the
  358. 12:26correct order. And that's where TCP
  359. 12:28comes in. TCP provides reliable, ordered
  360. 12:32communication between two endpoints.
  361. 12:35If some data is lost while traveling
  362. 12:36across the network, TCP can detect that
  363. 12:39and arrange for it to be transmitted
  364. 12:41again. It also handles things like flow
  365. 12:43control and congestion control, so that
  366. 12:45a sender doesn't overwhelm the receiver
  367. 12:48or the network.
  368. 12:49For something important like a ride now
  369. 12:51ride request, that reliability matters.
  370. 12:54We don't want the passenger to tap
  371. 12:56request ride, the request to lose some
  372. 12:58data along the way, and the system to
  373. 13:00simply continue as though everything was
  374. 13:02fine. TCP gives applications a reliable
  375. 13:05communication channel to work with. But,
  376. 13:07before TCP can start transferring
  377. 13:09application data, the two sides first
  378. 13:12need to establish a connection. And
  379. 13:14that's where the TCP three-way handshake
  380. 13:16comes in. When the passenger's phone
  381. 13:18wants to establish a TCP connection with
  382. 13:20the ride now server, the client starts
  383. 13:23the connection, the server responds, and
  384. 13:25the client confirms that it is ready to
  385. 13:27communicate. Once that process is
  386. 13:29complete, the connection is established
  387. 13:31and application data can start flowing.
  388. 13:34That initial setup does have some
  389. 13:36overhead, which is why applications
  390. 13:38often reuse existing connections instead
  391. 13:40of creating a completely new connection
  392. 13:42for every small request. For Ride Now,
  393. 13:45that can make a noticeable difference
  394. 13:47because the passenger might make many
  395. 13:49requests while using the application.
  396. 13:51So now we have a reliable connection
  397. 13:53between the passenger and Ride Now.
  398. 13:56But there's another problem. We're
  399. 13:57dealing with account information,
  400. 13:59location data, and potentially
  401. 14:01payment-related information. We don't
  402. 14:04want that information traveling across
  403. 14:05the network in a way that someone could
  404. 14:07simply read.
  405. 14:08That's why we need HTTPS and TLS.
  406. 14:12HTTPS gives us secure HTTP communication
  407. 14:16by using TLS.
  408. 14:18TLS provides encryption so that someone
  409. 14:20intercepting the traffic cannot simply
  410. 14:22read the data. It also provides
  411. 14:24integrity, which helps detect if the
  412. 14:26data has been modified, and
  413. 14:28authentication through certificates so
  414. 14:30the client can verify the server it is
  415. 14:32communicating with.
  416. 14:34So before Ride Now starts exchanging
  417. 14:36sensitive application data, the
  418. 14:38connection is secured. In a production
  419. 14:41environment, TLS doesn't necessarily
  420. 14:43have to be handled directly by the
  421. 14:45application itself. It can be terminated
  422. 14:47by infrastructure in front of the
  423. 14:49application, and depending on the
  424. 14:51architecture, traffic can then be
  425. 14:53encrypted again before it reaches
  426. 14:55internal services.
  427. 14:56The important thing is that HTTPS gives
  428. 14:59our application a secure way to
  429. 15:01communicate.
  430. 15:02Now that we have a secure connection,
  431. 15:04we're finally ready to talk about the
  432. 15:06actual application request.
  433. 15:08That's where HTTP comes in. The
  434. 15:11passenger taps request ride. The Ride
  435. 15:14Now application sends an HTTP request to
  436. 15:16the back end.
  437. 15:18That request contains information about
  438. 15:20what the passenger is asking for, along
  439. 15:22with headers and any required data. The
  440. 15:24back-end receives the request, validates
  441. 15:27the passenger, checks the ride details,
  442. 15:29looks for an available driver, and sends
  443. 15:32an HTTP response back. This request and
  444. 15:35response model is what developers work
  445. 15:37with every day when building APIs and
  446. 15:39web applications.
  447. 15:41At this point, our simple ride now
  448. 15:43application works. But let's say it
  449. 15:45becomes extremely popular. Now thousands
  450. 15:49or even millions of passengers are
  451. 15:50requesting rides at the same time. One
  452. 15:53application server obviously isn't going
  453. 15:55to be enough.
  454. 15:56We need a way to distribute those
  455. 15:58requests across multiple servers, and
  456. 16:01that's where a load balancer becomes
  457. 16:02useful. We can run multiple application
  458. 16:05servers and place a load balancer in
  459. 16:07front of them. Now the passenger's
  460. 16:09request doesn't need to know which
  461. 16:10particular server will handle it. The
  462. 16:13load balancer receives the traffic and
  463. 16:15chooses a healthy back-end server to
  464. 16:17process the request.
  465. 16:18This gives us scalability because we can
  466. 16:21add more servers as traffic increases.
  467. 16:23It also improves availability because if
  468. 16:26one server becomes unhealthy, the load
  469. 16:28balancer can stop sending traffic to it
  470. 16:30while the other servers continue
  471. 16:32handling requests.
  472. 16:33So, the load balancer gives us a
  473. 16:35controlled entry point into the
  474. 16:37application. But in a real production
  475. 16:39system, we often want that entry point
  476. 16:41to do more than simply choose a server.
  477. 16:44We might want to handle TLS, route
  478. 16:46different types of requests, cache
  479. 16:48certain responses, compress data, or
  480. 16:51hide the internal structure of our
  481. 16:53services.
  482. 16:54And that's where a reverse proxy comes
  483. 16:56in. A reverse proxy sits between the
  484. 16:59client and the back-end services and
  485. 17:01acts as an intermediary. For Ride Now,
  486. 17:04the passenger doesn't need to know
  487. 17:05whether a particular request eventually
  488. 17:07goes to the passenger service, driver
  489. 17:10service, trip service, or some other
  490. 17:12internal component.
  491. 17:14The reverse proxy can receive the
  492. 17:15request and decide where it should go.
  493. 17:18It can also handle things such as TLS
  494. 17:20termination, caching, compression,
  495. 17:23routing, and other concerns that we may
  496. 17:25not want every individual application
  497. 17:27service to handle.
  498. 17:29This is why you'll often see load
  499. 17:30balancers and reverse proxies used
  500. 17:32together in real architectures.
  501. 17:35Their responsibilities can overlap
  502. 17:36depending on the technologies and
  503. 17:38architecture being used.
  504. 17:40But now we have another important
  505. 17:42question.
  506. 17:43Just because we have a path to our
  507. 17:44services doesn't mean we should allow
  508. 17:46every kind of traffic to reach them.
  509. 17:49We need to control who can communicate
  510. 17:51with what. And that's where firewalls
  511. 17:53come in. A firewall controls which
  512. 17:56network traffic is allowed and which
  513. 17:58traffic should be blocked. For example,
  514. 18:00the passenger should be able to reach
  515. 18:02the public part of Ride Now, but they
  516. 18:04should not be able to connect directly
  517. 18:06to the database.
  518. 18:07The application services might be
  519. 18:09allowed to communicate with the database
  520. 18:11while connections coming directly from
  521. 18:12the public internet are blocked.
  522. 18:15In cloud environments, you can implement
  523. 18:17these kinds of controls through security
  524. 18:19groups and network access rules. And in
  525. 18:21container environments, you can also
  526. 18:23have policies controlling which
  527. 18:25workloads are allowed to communicate
  528. 18:26with each other.
  529. 18:27This is also important when you're
  530. 18:29debugging. If a connection is timing
  531. 18:31out, the problem might not be your
  532. 18:33application code at all. A network rule
  533. 18:35somewhere between the two systems could
  534. 18:37simply be dropping the traffic. So, when
  535. 18:40an application says, "I can't connect,"
  536. 18:43you shouldn't immediately assume the
  537. 18:44application itself is broken. There
  538. 18:46could be a network boundary preventing
  539. 18:48that connection.
  540. 18:50Now, let's continue our Ride Now story.
  541. 18:52The passenger has requested a ride, the
  542. 18:54driver has accepted it, and the
  543. 18:56passenger is watching the driver's
  544. 18:58location move on the map.
  545. 19:00At this point, we have a different
  546. 19:01problem. The passenger doesn't want to
  547. 19:03keep asking the server every few
  548. 19:05seconds, "Where is the driver now?"
  549. 19:08We want the server to be able to send an
  550. 19:09update whenever the driver's location
  551. 19:11changes. And that's where WebSockets
  552. 19:14become useful.
  553. 19:16A normal HTTP interaction is generally
  554. 19:18based around a request and a response.
  555. 19:21The client asks for something and the
  556. 19:23server sends a response.
  557. 19:25But in our ride-now example, we want
  558. 19:27something more interactive.
  559. 19:29Once the driver accepts the ride, the
  560. 19:31passenger wants to see the driver's
  561. 19:33location update continuously.
  562. 19:35If the phone had to keep sending
  563. 19:37requests asking for the latest location,
  564. 19:39we'd create a lot of unnecessary
  565. 19:41traffic, especially when there hasn't
  566. 19:43been much change.
  567. 19:44WebSockets provide a persistent two-way
  568. 19:47communication channel between the client
  569. 19:49and the server.
  570. 19:50Once that connection is established, the
  571. 19:52server can send updates to the passenger
  572. 19:54without waiting for another request. So,
  573. 19:57as the driver moves, ride-now can
  574. 19:59receive the new location and push that
  575. 20:01information through the WebSocket
  576. 20:03connection to the passenger's phone.
  577. 20:05That's a good example of why you should
  578. 20:06understand the problem before choosing
  579. 20:08the technology.
  580. 20:10We didn't choose WebSockets simply
  581. 20:12because they are popular. We need them
  582. 20:14because the server needs to continuously
  583. 20:16send updates to the client.
  584. 20:18But WebSockets still use a reliable
  585. 20:20communication model underneath. And not
  586. 20:23every type of network communication
  587. 20:24needs that level of reliability.
  588. 20:27Sometimes getting the latest information
  589. 20:29quickly matters more than making sure
  590. 20:31every single piece of data arrives. And
  591. 20:34that's where UDP comes in.
  592. 20:36UDP takes a very different approach from
  593. 20:38TCP. It does not provide the same
  594. 20:41guarantees around delivery and ordering,
  595. 20:43which means it has less overhead and can
  596. 20:46be useful when low latency matters more
  597. 20:48than guaranteed delivery.
  598. 20:50You'll see UDP used in areas such as
  599. 20:52gaming, real-time media, and some types
  600. 20:55of streaming communication.
  601. 20:57DNS can also use UDP for many queries
  602. 21:00because the messages are usually small
  603. 21:02and don't always require the overhead of
  604. 21:04establishing a full TCP connection.
  605. 21:07For our Ride Now example, the important
  606. 21:09thing is not to think of UDP as better
  607. 21:11than TCP. They solve different problems.
  608. 21:15For a ride request, reliable delivery is
  609. 21:17important, so TCP makes sense.
  610. 21:21For certain types of real-time
  611. 21:22communication, receiving the newest
  612. 21:24information quickly can matter more than
  613. 21:26retransmitting every piece of missing
  614. 21:28data.
  615. 21:29And by now, we've covered quite a few
  616. 21:31different parts of networking. We've
  617. 21:33talked about IP addresses, DNS, ports,
  618. 21:37MAC addresses, ARP, routing, NAT,
  619. 21:41subnets, DHCP, TCP, TLS, HTTP, load
  620. 21:47balancers, reverse proxies, firewalls,
  621. 21:50WebSockets, and UDP.
  622. 21:53So, how do we put all of these pieces
  623. 21:55into one mental model?
  624. 21:57That's where the OSI model helps. The
  625. 22:00OSI model gives us a conceptual way to
  626. 22:02divide networking into seven layers,
  627. 22:05starting from the physical network and
  628. 22:07moving all the way up to the application
  629. 22:08layer.
  630. 22:10You don't need to memorize those seven
  631. 22:11layers just so you can repeat them in an
  632. 22:13interview. The real value is that the
  633. 22:15model gives you a way to think about
  634. 22:17where a networking problem might be
  635. 22:19happening.
  636. 22:20Let's say Ride Now suddenly cannot
  637. 22:22connect to another service.
  638. 22:24Instead of simply saying the network is
  639. 22:26broken, we can start asking better
  640. 22:28questions.
  641. 22:30Is the local network working?
  642. 22:32Can we reach the destination network?
  643. 22:34Can the transport connection be
  644. 22:35established? Is the secure connection
  645. 22:38working?
  646. 22:39Is the application request actually
  647. 22:41reaching the service?
  648. 22:43That way, we can narrow down the problem
  649. 22:45instead of treating networking as one
  650. 22:47giant mystery. And that's the whole
  651. 22:49idea.
  652. 22:50So, let's quickly follow that Ride Now
  653. 22:52request one more time.
  654. 22:54The passenger's phone first gets its IP
  655. 22:56address, whether that's IPv4 or IPv6,
  656. 23:00and that address tells the network where
  657. 23:02the device can be reached. Because the
  658. 23:04phone is inside a private network, it
  659. 23:06has a private IP, while communication
  660. 23:09with the internet happens through a
  661. 23:10public IP.
  662. 23:12The phone then uses DNS to turn the Ride
  663. 23:14Now host name into the IP address of the
  664. 23:17service it needs to reach.
  665. 23:19Once it knows the destination machine,
  666. 23:21ports tell the network which application
  667. 23:23or service on that machine should
  668. 23:25receive the traffic.
  669. 23:26Inside the local network, MAC addresses
  670. 23:29are used to identify network interfaces,
  671. 23:31and ARP helps the phone discover the MAC
  672. 23:33address it needs.
  673. 23:35From there, routing takes the traffic
  674. 23:37from one network to another until it
  675. 23:39reaches the Ride Now environment. NAT
  676. 23:42allows that private address from the
  677. 23:43passenger's network to communicate
  678. 23:45through a public connection.
  679. 23:47Inside Ride Now, subnetting separates
  680. 23:50different parts of the infrastructure
  681. 23:51into controlled network segments, while
  682. 23:54DHCP can automatically provide machines
  683. 23:57with the network configuration they
  684. 23:58need.
  685. 23:59Once the destination is reachable, TCP
  686. 24:02gives us reliable and ordered
  687. 24:04communication, and the TCP three-way
  688. 24:06handshake establishes that connection
  689. 24:08before the application starts sending
  690. 24:10data.
  691. 24:11TLS then secures that communication,
  692. 24:14giving us HTTPS,
  693. 24:16and HTTP carries the actual Ride Now
  694. 24:19request, such as the passenger asking
  695. 24:21for a ride.
  696. 24:23As Ride Now grows, the request reaches a
  697. 24:25load balancer, which distributes traffic
  698. 24:27across healthy application servers.
  699. 24:30A reverse proxy can then handle things
  700. 24:32like routing, TLS termination, caching,
  701. 24:35and other responsibilities before the
  702. 24:37request reaches the appropriate back-end
  703. 24:39service.
  704. 24:40Along the way, firewalls make sure that
  705. 24:43only the traffic we actually want is
  706. 24:45allowed to reach those services. The
  707. 24:47driver accepts the ride, and now the
  708. 24:49passenger needs real-time location
  709. 24:51updates.
  710. 24:52WebSockets give us a persistent two-way
  711. 24:55connection, so the server can push those
  712. 24:57updates to the phone.
  713. 24:58And when we have situations where low
  714. 25:00latency matters more than guaranteed
  715. 25:02delivery, UDP gives us a lighter
  716. 25:04alternative to TCP.
  717. 25:07Finally, the OSI model gives us a way to
  718. 25:09put all of these pieces into perspective
  719. 25:11and troubleshoot them layer by layer
  720. 25:13when something goes wrong.
  721. 25:15So, that's networking. It isn't really
  722. 25:1820 unrelated concepts. It's one request
  723. 25:21traveling through a system with each
  724. 25:23concept solving a different problem
  725. 25:25along the way.
  726. 25:26And once you can follow that journey
  727. 25:28from the IP address on the phone all the
  728. 25:30way to the application and back again,
  729. 25:32networking becomes much easier to
  730. 25:34understand.

About this transcript

This page contains the full transcript of I Bet Nobody Has Ever Explained the Networking Topics Like This Before by Cloud X Berry, generated from the public captions YouTube serves with the video. The transcript has 4,105 words across 730 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.