Web Development Book (8) PDF
Document Details
Uploaded by VerifiableRetinalite849
Tags
Summary
This document provides an introduction to computer networks and the internet. It covers concepts like local area networks (LANs), wide area networks (WANs), and the protocols used for communication. The document also touches on topics like IP addresses, MAC addresses, protocols, and data transfer.
Full Transcript
WHAT IS THE INTERNET? Computer networks A NETWORK is a group of connected computers. For example, computers, phones, and other devices that your family owns are all part of your home network. Devices in the same network can easily communicate and share resources with each other. For e...
WHAT IS THE INTERNET? Computer networks A NETWORK is a group of connected computers. For example, computers, phones, and other devices that your family owns are all part of your home network. Devices in the same network can easily communicate and share resources with each other. For example, computers on the same network can share files, or a printer can be used by multiple devices connected to the same network. RRR LOCAL AREA Networks A Local Area Network (LAN) is a type of network which is made up of nearby computers. A LAN can have just a few devices (like in a home) or even hundreds of devices (like in a school). Big places like colleges can have multiple LANs. A Wide area network (WAN) is made up of connected LANs that are spread out over large distances, like across different parts of the country or even the world. WANs can connect thousands or even millions of devices. COMMUNICATING ON A LAN Devices in a network communicate with ETHERNET (with wires) or... WIRELESS (without wires, using radio waves) Ethernet was developed in the 1970s. It’s the PROTOCOL for PROTOCOL how devices communicate A standardized set of using wires to physically rules for formatting and processing data connect. LLL Wireless was developed in the late 1990s. It makes use of radio waves to send information through the air to connected devices. A B ETHERNET A protocol that devices use for communicating on a wired network C D WIRELESS A B A protocol that devices use for communicating on a network through C radio waves D RRR DID YOU KNOW? WLAN (Wireless LAN) and Wi-Fi are often confused but aren't the same? WLAN is a general term for any wireless network, while Wi-Fi is a specific type of WLAN. So, all Wi-Fi networks are WLANs, but not all WLANs are Wi-Fi! THE INTERNET At home, your The Internet is a world-wide phones, computers, and other devices system of connected computer are all part of your networks. It’s a giant network home network sharing a of smaller networks. connection to the internet. HOME NETWORK THE INTERNET Alexa play Never gonna give you up LLL SENDING DATA OVER THE INTERNET When you download something from the internet, like music to PACKETS your phone, the files are usually Small units of too large to send in one go. data that are sent Instead, the song gets split into in binary code through a network _______ PACKETS , which are sent separately and then pieced back together on your phone. Each packet has a destination address and a packet number, so the network knows where to send it and how to reassemble everything once it reaches its destination. You might wonder how packets can travel such long distances (even across oceans) to reach their destination in just a few milliseconds. This is made possible by FIBER- optic cables, which transmit data using light pulses at nearly the speed of light. If you're curious about how these cables are laid out and where they stretch across the globe, visit submarinecablemap.com for an interactive view of their routes. RRR An IP ADDRESS is used to guide IP (INTERNET packets to the correct network. PROTOCOL) IP addresses are unique Protocol for transferring data on identifiers for each network. the internet Every device gets its own IP address which may change. DHCP (Dynamic host configuration protocol) allows devices to automatically obtain an IP address and other network configuration settings. In smaller networks, DHCP usually runs on the router. ROUTER A router serves as a gateway, allowing devices within one or more local network(s) to communicate with each other and access the broader internet. A (modern) router also... chooses the quickest path for data to travel to its destination network provides built-in firewall protection, to keep the network safe from unauthorized access and some cyber threats LLL LOCAL IP ADDRESS ≠ PUBLIC IP ADDRESS A public IP address can be Internet accessed directly over the service provider internet and is assigned to A company that your network router by your provides access to the internet (e.g. AT&T) internet service provider (ISP). A private IP address is the address assigned to your device by the router within your internal network. It allows your device to communicate with other devices within the same network. Private IP addresses are not routable on the internet. PRIVATE / LOCAL public / external - assigned manually/automatically - assigned by ISP 85.180.12.34 192.168.178.2 192.168.178.1 192.168.178.3 Internet 192.168.178.4 RRR You can find your local IP address in your device settings or by running “ ipconfig ” in the command line. You can find your public IP address, by simply googling “What is my IP address?” Private ip address ranges Your private IP address exists within specific private IP address ranges reserved by the Internet Assigned Numbers Authority (IANA) and should never appear on the internet. Class Address Range A 10.0.0.0 — 10.255.255.255 B 172.16.0.0 — 172.31.255.255 C 192.168.0.0 — 192.168.255.255 These might not seem like wide ranges, but they don’t really need to be. Because these IP addresses are reserved for private network use only, they can be reused on different private networks all over the world without consequence or confusion. LLL NAT How does the router ensure that the correct response is sent back to the right device which initiated the request? I was the one who wanted to watch YouTube YouTube ? ? Network Address Translation (NAT) is a service used by routers to allow multiple devices on a local network to share a single public IP address. When a device sends a request, the router replaces the device's private IP address with its own public IP address and assigns a unique port number to track the connection. When a response comes back, the router uses the port number to identify which device in the local network should receive the data. RRR IP ADDRESS IP ADDRESS Thanks to the rapid growth of the internet and the connected devices, there are now two types of IP addresses: IPv4 and IPv6 LLL IPV4 An IPv4 address has the format x.x.x.x where x is called an octet and must be a decimal value between 0 and 255. Each octet consists of 8 bits, making the entire IPv4 address 32 bits in length. Examples: BIT 192.168.178.1 A bit (binary digit) is 1.1.1.1 the smallest unit of data and represents either 0 or 1. 1 byte = 8 bits IPV6 An IPv6 address has the format x:x:x:x:x:x:x where each x is a 16-bit hexadecimal block, separated by colons. Each block can have a value between 0000 and FFFF, making the entire IPv6 address 128 bits in length. Examples: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 fe80:0000:0000:0000:0202:b3ff:fe1e:8329 Hexadecimal is a base-16 numbering system that uses 16 symbols: the digits 0-9 and the letters A-F, where A stands for 10 and F stands for 15. This system is commonly used in computing because it represents large binary values more compactly. RRR What are the reasons for having two types of IP addresses? You can basically think of IPv6 as IPv4 on steroids: IPv6 was necessary because the pool of IPv4 addresses (~4.3 billion) became too small for the growing internet, offering nearly unlimited unique addresses. There is no need for NAT, as the addresses are designed to be globally unique, reducing the performance overhead Uses Stateless Address Autoconfiguration (SLAAC) instead of DHCP, enabling devices to automatically configure their own addresses and lowering network traffic. Integrates IPsec as a standard feature, along with privacy extensions and secure routing protocols. ipsec (Internet security protocol) A set of protocols for establishing secure connections over a network, used for key exchange, encryption, authentication and more. LLL Tracking the Trail You might have heard that if someone knows your public IP address, that they know your exact location. But this is just a common myth. In reality, IP lookups can give a rough estimate of your location. When you search for the location of an IP address, the result is usually tied to the region or city where your ISP operates, not your specific address. These lookups work by referencing the IP address blocks assigned to ISPs. TRY IT YOURSELF If you want to lookup an IP address, you can use a website like “whatismyip.com” RRR MAC ADDRESS Along with an IP address, every device on a network has a MAC (Media access control) address, which is intented to be a globally unique identifier made up of 16 digits and letters (48 bits), which identifies the manufacturer (OUI) and the specific device. It is assigned to each Network interface CARD (NIC) , the hardware component that connects a device to the network. Example: 70: 85: C2: CA: FE: 09 OUI (Organizationally Extended Identifier Unique Identifier) You can find your MAC address(es) in your device settings. There can be, and will be duplicates with MACs: 1. They do not need to be (globally) unique as it only must be unique on the local network to ensure data delivery 2. There exist more devices than there are addresses 3. MACs can be spoofed (falsified) LLL OSI MODEL Why do we need a MAC address and an IP address to communicate with other devices in the network? To better understand what we are dealing with, we will take a look at the OSI (OPEN SYSTEM INTERCONNECTION) model. The OSI provides a standard for different computer systems to be able to communicate with each other. It is based on the concept of splitting up a communication system into seven abstract layers, stacked upon. Handles communication protocols 7 and data manipulation for apps, APPLICATION LAYER e.g. web browsing (HTTP) Translates data to usable format 6 and is where data encryption and PRESENTATION LAYER compression occurs Maintains connections and is responsible for controlling ports SESSION LAYER 5 and sessions Handles End-to-end communication between the two devices via TCP TRANSPORT LAYER 4 and UDP (will be explained soon) Decides which physical path the NETWORK LAYER 3 data will take (= routing) Defines the format of data on the 2 network. Breaks down packets into DATA LINK LAYER smaller pieces called frames Transmits raw bit stream over the PHYSICAL LAYER 1 physical medium (e.g. cables) RRR MAC addresses and IP addresses operate on different layers. MAC addresses are used to identify machines within the same broadcast network on layer 2, while IP addresses identify devices across different networks on layer 3. A packet can sure get to the target device with an IP table instead of MAC table, but with dynamic IP, the packet may finally get to the wrong device (when the old device get offline and a new device takes the same IP), the new device cannot decide if the packet is to itself without the an identifier, that's when the MAC comes in. LLL THE ARP PROTOCOL The ADdress resolution protocol (ARP) is a Layer 2 protocol that helps devices on a local network find each other. While a device knows the destination’s IP address, it needs the target’s MAC address for direct communication. ARP links an IP address to its corresponding MAC address. ARP REQUEST Who has this IP? Tell me your MAC. Source IP: 192.168.0.88 Source MAC: F2:F2:F2:F2:F2:F2 Target IP: 192.168.0.1 (router) Target MAC: FF:FF:FF:FF:FF:FF (Broadcast address) I have this IP. ARP RESPONSE Here’s my MAC. Source IP: 192.168.0.1 (router) Source MAC: A2:A2:A2:A2:A2:A2 Target IP: 192.168.0.88 Target MAC: F2:F2:F2:F2:F2:F2 BROADCAST A broadcast sends data to all devices on a network segment. There is also Unicast (one-to-one), Multicast (one-to-many) and ANYCAST (one-to-nearest) RRR SENDING DATA Whether your data is transferred quickly and in full depends on which network protocols you use, UDP or TCP. They both do the same job but in different ways. TCP The TRANSMISSION CONTROL PROTOCOL (TCP) is connection- based, so it establishes a connection between the receiver and sender and maintains it while transferring data. It guarantees that the data arrives in the right order without any missing pieces. TCP is mostly used in Web browsing, Emails, File Transfers... A Three-way handshake is used to establish a reliable connection between two devices. It involves three steps: YOUR SERVER COMPUTER “I want to talk” SYN SYN - ACK “Ok, let’s talk” “We are ACK connected!” LLL 1. SYN : client sends a SYN (synchronize) message to the server to start the connection. 2. SYN-ACK: server responds with a SYN-ACK (synchronize- acknowledge) message. 3. ACK : client sends an ACK (acknowledge), confirming the connection is established. After the connection is initialized, data can be transmitted between the client and server. FOR EXAMPLE, when you load a website, the server sends the site’s data to you in small packets. If one packet gets lost (often due to a weak connection), your web browser will request that missing packet again. This process continues until all the packets are received, allowing the full site to load. RRR YOUR TCP SERVER COMPUTER Breaks site I NE into packets ED P ACK I NE ET 1 ED P ACK 1 I NE ET 2 ED P ACK ET 2 3 G IN E ND 3 S G 1 I NG D IN ND SE N SE 2 S T! 1 2 3 LO STIL 1 2 3 L NE ED P ACK ET 3 3 ING SEND 3 Puts site back together LLL UDP The USER DATAGRAM PROTOCOL (UDP) is connectionless, so it sends data without establishing a connection. It sends packets, without ensuring they arrive or are in the correct order. This may for example, result in a corrupted file. This speed makes UDP ideal for video streaming or online gaming, where quick delivery is prioritized over reliability. YOUR UDP SERVER COMPUTER I NE ED P ACK I NE ET 1 ED P ACK 1 I NE ET 2 ED P ACK ET 2 3 G IN ND 3 SE 1 N G I NG NDI ND SE SE 2 S T! 1 2 3 LO 1 2 ? Breaks data Puts data into packets together with packet loss RRR