Non-network professional developer's proprietary network terminology

As a programmer, it is impossible to avoid dealing with the Internet. Today, our mobile phones and computers are no exaggeration to say that without the network, they would be just "scrap iron," their utility greatly reduced. This article aims to help those who are not network professionals to grasp the most essential knowledge about the Internet in the shortest possible time. Let's start by understanding some of the professional terms we may know but don't fully comprehend. Internet The Internet is the largest network in the world today, often referred to as a "network of networks." It is a vast interconnected system of all networks. The composition of the Internet: - Edge part: Hosts - Core: A large number of networks and routers connecting these networks (not the same as home routers) Ethernet Ethernet is the most commonly used local area network (LAN) communication protocol. Ethernet frames are transmitted over the network. Since Ethernet allows only one computer to send data at a time, there must be a detection mechanism known as CSMA/CD (Carrier Sense Multiple Access with Collision Detection): - Multi-point access: Multiple computers are connected to a single bus. - Carrier monitoring: Each station constantly checks the channel, regardless of whether it is transmitting or not. - Collision detection: Listening while sending. OSI Model The Open Systems Interconnection Basic Reference Model defines how systems can communicate if they follow this standard. The OSI model consists of seven layers, while TCP/IP uses a four-layer architecture. For learning purposes, a five-layer model is often used: physical layer, data link layer, network layer, transport layer, and application layer. Protocol Architecture Physical Layer In the world of computers, everything is represented by 0s and 1s. Even the text you are reading is stored as combinations of 0s and 1s. However, these bits cannot be directly transmitted through physical media; they need to be converted into optical or electrical signals. Thus, the physical layer is responsible for converting bit streams (0101) into optical or electrical signals. Without the physical layer, there would be no Internet, no data sharing, because data couldn’t flow across the network. Data Link Layer At this layer, data is no longer transmitted as a bit stream but is divided into frames and then sent. MAC Address Also known as the hardware address, the MAC address is a 48-bit address embedded in the network card's ROM. It uniquely identifies a computer worldwide. Packet Switching Since data is divided into frames, and different links have different maximum frame lengths (MTUs), frames exceeding this MTU must be fragmented. For example, a truck can carry 5 tons of cargo, but if a road can only handle 2 tons, the cargo must be transported in three trips. Bridge A bridge operates at the data link layer, forwarding and filtering received frames based on the destination MAC address. Ethernet Switch An Ethernet switch is essentially a multi-interface bridge. Each interface connects directly to a host or another hub, making it easy to implement VLANs (Virtual Local Area Networks). Ethernet MAC Frame The format of an Ethernet MAC frame includes: - Destination address: 48-bit MAC address of the receiver. - Source address: 48-bit MAC address of the sender. - Type field: Indicates the upper-layer protocol, such as 0x0800 for IP datagrams. Network Layer If only the data link layer exists, data can only be transmitted on the same link and cannot cross links. With the network layer, data can be transmitted across different data links. IP Address An IP address, also known as a software address, is stored in a computer's memory. IPv4 addresses are 32 bits, while IPv6 addresses are 128 bits. IP Address vs. MAC Address IP addresses are used above the network layer, while MAC addresses are used below the data link layer. IP addresses are logical, while MAC addresses are physical. The source and destination addresses in an IP packet header remain unchanged during transmission, whereas those in a MAC frame change at each router. IP Address Classification IP address = {, } - Class A: 0.0.0.0 ~ 127.0.0.0 - Class B: 128.0.0.0 ~ 191.255.0.0 - Class C: 192.0.0.0 ~ 223.255.255.0 Subnetting After subnetting, the IP address structure becomes: IP address = {, , } For example, a company with a Class B IP address, 145.13.0.0, might use subnets like 145.13.3.0, 145.13.7.0, and 145.13.21.0. From the outside, it still appears as 145.13.0.0. When a router receives a message, it forwards it to the appropriate subnet. Subnet Mask A subnet mask typically consists of a string of 1s followed by a string of 0s. Regardless of whether a network is subnetted, the subnet mask and IP address are bitwise ANDed to determine the network address. Default Subnet Masks: - Class A: 255.0.0.0 - Class B: 255.255.0.0 - Class C: 255.255.255.0 Although subnetting provides flexibility, it reduces the total number of hosts that can be connected to a network. Supernetting IP address = {, } Using a network prefix allows for classless inter-domain routing (CIDR). For example, 128.14.35.7/20 means the first 20 bits are the network prefix, and the last 12 bits are the host number. CIDR forms a "CIDR address block" with consecutive IP addresses that share the same network prefix. Address Mask CIDR uses a 32-bit address mask, similar to a subnet mask. IP Datagram At the network layer, data is transmitted in the form of IP datagrams (IP packets). IP Datagram Format The first 20 bytes of the header are fixed, mandatory for all IP datagrams. The remaining 4 bytes are optional fields with variable length. Header Fields Analysis: - Version: IP version (IPv4 or IPv6) - Header Length: Records the length of the header, up to 15 32-bit words (60 bytes). - Service Type: Generally not used. - Total Length: Sum of the header and data length. Maximum is 65535 bytes. - Identification: Each time an IP datagram is generated, this counter is incremented. - Flags: 3 digits, with the lowest digit being MF (More Fragments), indicating if there are more fragments. - Fragment Offset: Indicates where the fragment starts from the user data field. - Time to Live (TTL): Maximum number of hops a datagram can pass through (255). - Protocol: Records which protocol carries the data. - Header Checksum: Checks only the header, not the data. - Source and Destination Addresses: Identifies the sender and receiver. IP Layer Forwarding Process Each router maintains a routing table containing the following information: destination network address and next hop address. When using subnet packet forwarding, the routing table must include the destination network address, subnet mask, and next hop address. Specific Host Route: Specifies a route to a specific destination address. Default Route: Used when the packet doesn't know which router to go to. It's suitable for networks with few external connections. Router Packet Forwarding Algorithm 1. Extract the destination IP address D from the datagram and get the destination network address N. 2. If N is directly connected to the router, deliver it directly. 3. If there is a specific host route for D, forward the datagram. 4. If there is a route to N, forward the datagram. 5. If there is a default route, forward the datagram. 6. Otherwise, report a forwarding error. Virtual Private Network (VPN) All routers on the Internet will not forward datagrams whose destination address is a private address. There are three types of private addresses: - 10.0.0.0 ~ 10.255.255.255 - 172.16.0.0 ~ 172.31.255.255 - 192.168.0.0 ~ 192.168.255.255 If a company has departments in Guangzhou and Shanghai, each with its own private network, how can they connect these two private networks? Renting a dedicated line from telecommunications is expensive. Instead, using the public Internet as a communication carrier is called a Virtual Private Network (VPN). Network Address Translation (NAT) Hosts within multiple private networks share the IP address of a NAT router. When hosts send and receive IP datagrams, they must first perform network address translation through the NAT router. How NAT Routers Work NAT can also use port numbers to convert network addresses and ports, known as NAPT (Network Address Port Translation). ARP Protocol ARP solves the mapping problem between an IP address and a MAC address on the same LAN, i.e., IP address → ARP → MAC address. Each host has an ARP cache with a mapping table from IP addresses to MAC addresses of hosts and routers on the LAN. Here’s how ARP works: ARP works by broadcasting on the local network. If the host is not found, it goes to the router, which helps forward the request on another network. If found, the ARP request is completed; otherwise, it returns to step 2. Transport Layer This layer is crucial because the data link and network layers do not guarantee reliable delivery. They only attempt to deliver the data. In contrast, the TCP protocol ensures reliable transmission. The main focus of this layer is two protocols: UDP and TCP. User Datagram Protocol (UDP) Main features of UDP: - No connection - Best-effort delivery - Message-based: Messages from the application layer are directly added to the IP layer with a UDP header, without merging or splitting. - No congestion control - Supports one-to-one, one-to-many, many-to-one, and many-to-many communication - Small header overhead, only 8 bytes UDP Header Source Port: Source port number. Use when expecting a reply. Destination Port: Destination port number. Must be used when delivering the message. Length: Length of the UDP datagram, minimum is 8 bytes. Checksum: Checks both the header and data part. Transmission Control Protocol (TCP) Main features of TCP: - Connection-oriented transport layer protocol - Each TCP connection has two endpoints, peer-to-peer - Provides reliable delivery - Full-duplex communication - Byte-oriented stream TCP Workflow TCP Connection The endpoint of a TCP connection is called a socket. Socket = (IP address: port number) Each TCP connection is uniquely determined by two endpoints at both ends of the communication. TCP Segment Header Source Port and Destination Port: Function similarly to UDP ports. Sequence Number: The sequence number of the first byte of the data in this segment. Acknowledgment Number: The expected sequence number of the next segment. Data Offset: Length of the TCP segment. Reserved: Currently 0. URG: If URG = 1, the urgent pointer field is valid. ACK: If ACK = 1, the acknowledgment number is valid. PSH: If PSH = 1, the receiver should not wait until the buffer is full. RST: If RST = 1, the TCP connection has an error. SYN: Used to synchronize the sequence number when establishing a connection. FIN: Indicates that the sender has finished sending data and wants to release the connection. Window: Tells the other party how much data the receiver can currently send. Checksum: Checks the header and data section. Urgent Pointer: Valid when URG = 1, indicates the end of the urgent data. Options: Up to 40 bytes, including the maximum segment size (MSS). Window A key concept in TCP, the window (send window and receive window) allows for efficient data transfer. Since the stop-and-wait protocol is inefficient, the concept of a window was introduced. The sender maintains a transmission window, allowing multiple packets to be sent continuously without waiting for confirmation. The receiver uses cumulative acknowledgment, sending an acknowledgment for the last packet that arrives in order. Timeout Retransmission If the sender does not receive an ACK after waiting for a period, a timeout retransmission is initiated. The waiting time is the retransmission timeout (RTO), slightly larger than the Round Trip Time (RTT). Flow Control Uses the sliding window and the timing of the segment to control the flow. Congestion Control The sender maintains a congestion window (cwnd), and the send window equals the congestion window. Slow Start: cwnd = 1, doubles after each transmission round. Congestion Avoidance: Increases slowly, +1 per transmission round. When cwnd < ssthresh, use slow start; when cwnd > ssthresh, use congestion avoidance. Fast Retransmission: If the sender receives three duplicate acknowledgments, it immediately retransmits the segment. Fast Recovery: After receiving three duplicate acknowledgments, set ssthresh to half of the current congestion window and set cwnd to ssthresh. TCP Three-Way Handshake TCP three-way handshake is a common interview topic. Why three handshakes instead of two? Imagine a lost connection request arrives at B after the connection is released. If it were a two-way handshake, B would think there is data coming, wasting resources. TCP Four-Way Wave Why four waves instead of two or three? Because TCP is full-duplex, both parties can act as senders. A sends FIN to B, waits for B's data, then sends FIN back. B sends ACK, and A sends ACK. A enters TIME-WAIT state, waiting for 2MSL before closing. Application Layer The most famous application layer protocol is HTTP, along with FTP and DNS. Domain Name System (DNS) DNS resolves domain names (e.g., www.example.com) into IP addresses. DNS Server Classification - Root Domain Name Server: Highest level - Top-level Domain Server: As named - Authoritative Domain Name Server: Responsible for a zone - Local Domain Name Server: Host sends DNS query requests to it. DNS Query Host queries the local domain name server recursively. The local domain name server usually queries iteratively. Recursive Query: B asks A, A asks C, C asks D, etc., until someone knows. Iterative Query: B asks A, A tells B to ask C, C tells B to ask D, etc. DNS Query Example A host with the domain name x.tom.com wants to find the IP address of y.jerry.com. It first recursively queries the local domain name server dns.tom.com. The server uses an iterative query, asking the root name server, then the top-level domain server, and finally the authoritative domain name server, which provides the IP address. PS: This query uses UDP, and each domain name server uses a cache to improve efficiency. URL URL format: ://:/, with port and path sometimes omitted. HTTP Protocol HTTP is transaction-oriented, meaning it transmits data as a whole, either all received or none. HTTP is connectionless and stateless, with each request being a new one. HTTP/1.0 disadvantages: No persistent connection, requiring a new TCP connection for each request. HTTP/1.1: Uses persistent connections, keeping the TCP connection open for a while. Two working modes of HTTP/1.1: Non-pipelined and pipelined. Pipelined mode allows multiple requests to be sent simultaneously, improving efficiency. HTTP GET and POST GET is used for retrieving data, while POST is used for sending data. GET requests appear in URLs, so they should never be used for sensitive data. POST requests are slightly more secure as they are in the request header. Note: POST data is also in plain text, so it is not completely safe. Cookie The World Wide Web uses cookies to track users, storing session information between the HTTP server and the user. How Cookies Work 1. The user visits a website, and the server generates a unique identifier for the user, storing it in a backend database. 2. The server adds a "Set-Cookie" header to the HTTP response, containing the identifier. 3. The browser saves the cookie. 4. Every subsequent HTTP request includes the cookie, allowing the website to recognize the user and maintain their session. Cookies are convenient but can pose privacy risks. Users can choose to enable or disable them. Session Unlike cookies, sessions are stored on the server. When the server receives a cookie, it finds the corresponding session based on the SessionID. If not found, a new SessionID is generated and returned to the user. In summary, cookies and sessions serve similar purposes but differ in storage location. HTTPS Based on the HTTP protocol, HTTPS adds an SSL/TLS encryption layer between HTTP and TCP, solving issues like impersonation, tampering, and eavesdropping.

Swing Radiator

Swing Radiator,Power Transformer Swing Radiator,Swing Type Radiator,Distribution Transformer Swing Radiator

Shenyang Tiantong Electricity Co., Ltd. , https://www.ttradiator.com

Posted on