[Other] computer network-top down Method Learning notes

Source: Internet
Author: User
Tags domain name server anycast file transfer protocol

Computer Network and Internet

Nobody No why, it just works!
by Qijd

I. History of development
    1. Packet switching 1961-1972
    2. Private Network and network interconnection
      Start generating protocols such as TCP UDP
    3. The proliferation of Networks 1980-1990
    4. Internet Explosion the 2890s
      Web applications appear
Ii. Basic Composition
    • Core-edge-resourse
    • Resource subnets and communication subnets constitute computer network

    • Internet service provider ISP (Internetserviceprovider) access to the Internet

    • -End systems, packet switches, and other Internet components to receive and transmit information via protocol

1 Wired transmission
    • Twisted pair Wire
    • Fiber
    • Coaxial cable
2 topological structure
    • Total Linetype
    • Ring type
    • Star type
3 ClassificationMode of transmission
    • PPP-to-point
    • Broadcast broadcast
Geographical scope
    • LAN LAN Ethernet, etc.
    • Wan Wan across cities, countries
    • Man City Area Network
4 Performance Indicators
    • /bit per second i.e./bps
    • Bandwidth BANDWIDCH
    • Time Delay delay
      • Transmission delay transmission router pushes all bytes to the link for the time required
      • Processing delay Process Check packet header, decide how long it will take to group to where to go (after processing, enter the queue delay)
      • Propagation delay propagation the time required to upload a router from a to B router on the link

Latency wideband Product = = Link capacity

5 Exchange Mode
    • Circuit Switch circuit switching: Exclusive bandwidth has an independent setup, connection process
    • Packet Switch packet switching: Shared bandwidth

Where the Internet is using packet switching

third, network architecture 1 Protocol
    • Grammar syntax
    • Semantic symanties
    • Timing Timings

Custom protocol by ISOC (Internet Society)

2 Hierarchical Protocols

Layer Model Hierarchy Models

    • TCP/IP Reference Model
      Application Layer Application application and Application layer protocol persistence grouping called messages
      Transport Layer Transmation end-to-end management groupings are called message segments segment
      Network-layer Internet addressing, transporting datagrams from one host to another host grouping is called a datagram Dataram
      Data link Layer datalink move grouping from one node to another node grouping is called a frame.
      Physical layer physical data conversion signals to move bit data in the frame one by one to the next node.

    • OSI/RM Reference Model
      Application Layer
      The presentation layer interprets the meaning of the interchange data
      Session layer provides data exchange delimitation and synchronization
      Transport Layer
      Network layer
      Link Layer
      Physical Layer

Each layer of protocol provides services on a layer-up protocol
He has the advantage of structured conceptualization. Modularity makes system component updates easier

3 TCP/IP protocol family

Tcp:transmation Control Protocol
Udp:user Datagram Protocol
Ip:internet Protocol
Dns:domain Name Server
Arp:address resulation Protocol

4 Connection-oriented
    • TCP reliable connection-oriented ensures delivery and flow control
    • IP UDP unreliable non-oriented connection
Application Layer First, HTTP (hypertext transmission Protocol)
    • How it works: Client programs and service programs Exchange HTTP messages. HTTP defines the way that Web clients and Web server requests and pages are routed.
    • Default Port 80
    • is a stateless protocol that does not save any customer information
    • Interactive process: The HTTP client establishes a TCP link to the server, the browser and the server process accesses TCP through a nested subinterface, the client sends an HTTP request to the interface, and accepts the response; The server receives the request and responds to the client through the interface.
    • Message format:
1 Request Message
GET  /page.html  HTTP/1.1 //方法字段、URL字段、HTTP版本字段HOST:  bjfu.edu.cn  //指明主机Connection: close //是否开启持续连接User-agent: Mozilla/5.0 //用户代理,即浏览器类型Accept-language: cn

The first line is called the request line, the successor line is called the header row

2 Response Message
HTTP/1.1 200 OK //协议版本字段、状态码和相应信息Connection: close //是否开启持续连接Date: Fri, 01 July 2016 21:10:04 GMT //报文产生发送时间Server: Apache/2.2.3 (CentOS)  //服务器类型Last-Modified: Fri, 01 July 2016 21:10:04 GMT //对象创建或修改最后时间Content-Length: 6821 //实体对象长度Content-Type: text/html

One initial line, six header rows

Second, FTP (File Transfer Protocol)
    • Two TCP transmits a control link port 21, a data link port 20
    • Client establishes an FTP session, FTP and the client initiates a connection on port 21, the FTP server receives a file Transfer command, transmits the file on the data connection, and then closes the link.
    • Port mode active when data is required to be transferred, the server sends a data connection request to the customer
    • PASV mode passive when required to transfer data, the customer sends a data connection request to the server
Third, SMTP (simple Mail Transfer Protocol)/pop3 (Post Office Protocol var3) 1 SMTP
    • How it works: The user agent sends the message to the mail server, and SMTP on the mail server creates a TCP connection to the SMTP server running on the target mail server after the discovery of the message, and two SMTP sends and receives the message via TCP.
    • SMTP is primarily a push protocol
    • Port 25
    • Messages include: From to Subject
2 POP3
    • How it works: Pull messages from your mail server down to your local PC
    • POP3 is a pull protocol
    • Port 110
Base64 encoding

Base64 is one of the most common encoding methods for transmitting 8Bit bytes of code on the network

Quoted-printable encoding

Quoted-printable is also one of the most commonly used encoding methods in MIME messages. Like Base64, it also encodes the input string or data into a printable string of ASCII code.

iv. DNS (Domain Name System)
    • Port 53
    • How it works: the application needs to convert the hostname to an IP address, and then call the DNS client and indicate the host name. After DNS is received, a DNS query message is sent to the network. The end user host accepts a DNS reply message.
    • Recursive queries or iterative queries
1 Query and reply message format same
标识符2   标志2问题数2   回答RR数2权威RR数2 附加RR数2问题    //包含正在查询的信息,名字与类型(A、MX等)回答    //答复IP地址权威附加信息

The first 12 bytes are the header area (2 for 2byte)
Identifier unique flag query, used to match
Sign 0 for query, 1 for answer
Authoritative 1 represents authoritative DNS server
The number of additions means that you want recursion (query) or recursion available (reply)

2 Other Concepts

FQDN: Full Name Host name + whole path
Pqdn: Official domain Name

Transport Layer First, the Transport layer introduction
    • Sockets are the transport Layer or link layer, etc., which are provided to the Application layer API
    • Multi-channel decomposition: The host receives the transport beginning segment and needs to be directed to the appropriate socket to be handed to the required process. The process of delivering message segment data to the correct socket is called multi-channel decomposition
    • Multiplexing: Collecting data blocks from different sockets and encapsulating header information (for ease of decomposition), passed to the network layer called multiplexing
Second, UDP 1 Message Formats
source port(2B)   |  destination port(2B)total length(2B)  |  check sum(2B)报文段(<=535B)
2 Inverse Code summation calculation
    • The sender sums all (3) 16bit words in the message segment, and the final result is reversed code operation. The addition overflow bit is placed to the lowest bit to be returned to the volume. This becomes the checksum.

    • The receiver sums the four 16bit words (still rewinding), and if not all 1, there is a mistake.

    • Pseudo-Header:
      32-bit Source IP address, 32-bit destination IP address, 8-bit padding alignment, 8-bit protocol, 16-bit UDP length. Through the pseudo-header of the IP address verification, UDP can confirm that the datagram is sent to the local IP address, through the pseudo-header Protocol field verification, UDP can confirm that IP is not to be passed to UDP and should be passed to other high-level datagram to UDP.

Iii. Reliable Agreement
    • Check check code: through the verification code to determine the contents of the packet error error directly discarded;
    • ACK Response: (ARQ protocol) produced a lost packet loss or error packet, through the two sides ack (or NAK) the information sent by the other party to confirm the resolution; no response is received;
    • Numbering number mechanism: used to solve the case that the ACK cannot be located to the specific package;
    • Timer timer (stop-wait protocol): When a packet drops or a wrong packet occurs, both sides are waiting for an ACK response, resulting in a deadlock deadlock. Then through the timer timely retransmission to solve, and no lost packets are re-transmitted duplicate heavy packet, through the numbering mechanism to distinguish;

In order to improve efficiency, the following packet sending methods are produced:

    • Cumulative Confirmation: (GBN protocol) when the packet is sent, send N to indicate the receipt of the ordinal N and the previous group, do not accept any unnecessary groupings;
    • Gobackton: When a timeout occurs, the sender sends all packets that have been sent but are acknowledged;
    • Sliding window: In order to prevent the grouping is overwritten, if the ordinal field is the length N bit, the window grouping size is smaller than 2^n-1

When the window is large, use the selective re-spread to increase efficiency

    • Select retransmission: (RS) The receiver accepts all the out-of-order groupings, receives who confirms who, the sender chooses retransmission according to the time-out;
    • Sliding window: In this case, in order to prevent the inability to determine whether the new grouping or retransmission, window grouping is less than equal to half of the ordinal field

    • Flow control: The sender maintains a "receive window" variable, letting the other person know how much cache space they have available.

Iv. TCP 1 Message Formats
     2 byte                     2 byteSource Port No.           Destination Port No.Sequence No.//序号Acknowledge No.//确认号THL  Resert U A P R S F   Advertised Window Size//接收窗口Check Sum                 Urgent Pointer//紧急指针

THL: Header Length
Check sum: Binary Inverse Code summation (UDP)
R:reset Reset
S:synchronous Synchronization
F:final End

2 shaking hands and waving

Three-time handshake:

C -----SYN----> SC <--SYN ACK--- S  //C establishC -----ACK----> S  //S establish

Four times wave:

C -----FIN----> S  //C FIN-WAIT IC <----ACK----- S  //C FIN-WAIT II  C <----FIN----- S  //C TIME-WAIT S CLOSE-WAITC -----ACK----> S  //C Closed    S LISTEN
3 Timeout Timer

Estimatedrtt: Average round trip time α recommended 0.125
Devrtt: Deviation round Trip time Beta recommendation 0.25

    • Estimatedrtt = (1-α) * Estimatedrtt +α* Samplertt
    • Devrtt = (1-β) * Devrtt +β* | Samplertt-estimatedrtt|
    • Timeout interval = Estimatedrtt + 4 * Devrtt
4 Congestion Control
    • Slow start: Slow start, rarely at first, MSS/RTT (transmit volume/delay) exponential growth (1,2,4,8), loss of packet restart slow;
    • Congestion avoidance: Slow linear growth when exponential growth reaches the threshold;
    • Fast retransmission: Three redundant ACK received, fast retransmission, no longer waiting for timer timeout to trigger retransmission, and then into congestion avoidance
5 SWS (Silly window syndrome) Confused windowing syndrome

In the case of a window flow control, both parties send a tabloid text (less than MSS).

    • Send end: Send the MSS length message or at least half of the receiver's notification window; using the Nagle algorithm, the first message segment is sent first, and then the accumulation is known to satisfy the length.
    • Receiver: The receiver does not advertise a window smaller than MSS, or it reaches half the size of the receiver's cache (this is no matter mss).
6 Other features
    • Keepalive:server End for KeepAlive
    • Persistent: After being rejected by "window size Reason", insist to re-send
    • Time wait: Waiting before the end, waiting for a possible late message
    • Mss:max Segment Size Maximum header data length 536~1460b
    • Gbn+rs: On the basis of the GBN, receive the disorder group, but do not confirm, only need to group the ACK, the sender go to n retransmission all groups
Network layer

Used for forwarding and routing, sending datagrams from one host to another host.

First, IPv4 1 Traditional classification
A 0*******.********.********.********   2^7个net-id  2^24个host-idB 10******.********.********.********   2^14个net-id  2^16个host-idC 110*****.********.********.********   2^21个net-id  2^8个host-idD 1110****.********.********.********   Multicast Address组播地址E 11110***.********.********.********   Reserve for Future保留
    • Host-id all 0 represents the network number, all 1 is broadcast address broadcast addresses
    • Net-id reserved for all 0 reserves
2 Private Address

Addresses that cannot be used on public networks

A 10.0.0.0 ~ 10.255.255.255      10/8B 172.16.0.0 ~ 172.31.255.255    172.16/12C 192.168.0.0 ~ 192.168.255.255  192.168/16

When connected to a public network, it is converted to a public address via NAT (Network address translation)

    • NAT: Public Private One by one correspondence (typically used to hide internal structures)
    • PAT: Re-use the IP by changing the port number; The disadvantage is that each time you have to disassemble the tcp,checksum, and then look at the port number
3 Mask and CIDR (classless Inter Domain routing classless routing between domains)
    • Definition: Continuous 1 with a continuous 0 composition mask, the number of 1 represents Net-id length, 0 number represents Host-id length. Ip&&mask = = Net-id Network number
    • Subnetting: (Cird) in the case of guaranteed Net-id, from Host-id to borrow a few bit as Submit-id, and then through a different mask to get different subnets
    • VLSM: Variable eldest subnet mask to meet different needs
4 Message Formats
4bit  |  4bit  |       8bit        |             16bitver   |   THL  |  Type of Service  |              ITL         Identification            | |D|M| Fregment offset(13bit)     TTL       |   Protocol Type   |          Check Sum                     Source IP Address                     Destination IP Address

THL: First ministerial degree, to confirm where the datagram starts
TOS: not currently used
ITL: Total datagram length
Ttl:time to live, data reported over a router, reduced by 1
ProtocolType: Upper service Agreement 6-tcp 17-UDP
CheckSum: Only check the header does not verify the data, 2 binary inverse code summation

D: Non-divided for 1 mark
M: 1 indicates a subsequent Shard
Identification: Identification number
Fregment Offset: Offset

Sharding:
    • The maximum amount of data a link frame can carry is called the maximum data unit in the MTU frame, so the IP packet segment needs to be transferred
    • Identification is the same when an IP segment is divided into multiple
    • Offset to be computed by (Byte/8), which identifies the inserted data starting from the original (Byte/8)
    • Because of the previous one, the Shard byte is generally a multiple of 8
5 ICMP (Internet Control Message Protocol)
    • This protocol is used in ping
    • 8 byte header

      type | code | checksum(2byte)        op(4byte)        data
second, the route 1 Routing Table composition
    • Network number
    • Subnet mask
    • The next hop record is directly connected to the route, and when you want to reach the location of the network number, the IP of the corresponding router that goes
2 RIP (Routing information Protocol)
    • Routing update information between neighbors through RIP response messages "Rumour rumors", about 30 seconds at a time
    • RIP-UDP (port520)-ip-ethernet
    • Measure is distance vector
    • Anti-ring mechanism: When a neighbor 180 seconds does not respond, think the neighbor is dead, immediately trigger the update full network broadcast
    • As (autonomous system) internal algorithm
3 OSPF (Open shortest Path Protocol)
    • Through the mutual flooding between routers, to simulate a full network diagram, through the Dijkstra to calculate the shortest
    • Ospf-ip (port89)
    • Measure is bandwidth
    • Every time a router has a state change, it broadcasts the entire network, and periodically broadcasts its own state, even if it does not change.
    • As internal algorithm
    • LS (link state) type

Flooding: Requires the source node to send a grouped copy to all neighbors
Controlled flooding: Each node maintains a list of received, duplicated, forwarded short addresses, and broadcast groupings, which are judged when a copy is received

4 BGP (Broder Gateway Protocol)
    • Bgp-tcp-ip
    • As algorithm between
5 As-as
    • Maybe the future will play a role in the IPv6 era.
    • LS type
Third, IPv6 1 IP Address
    • Unicast unicast
      • Globally aggregatable unicast Address 2:: ~ 3FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
      • Link-local link local FF80::
      • Site-local site Local FFC0::
    • Multicast multicast
      • FF02::1 all node machines in the link
      • All routers in the Ff02::2 link
    • Anycast anycast

Length 128bit, top 64 Net-id, rear 64-bit Host-id
With "::" To do 0 compression, a string of IPv6 can not be two times compression
Localback (localhost):: 1

2 Message Formats
每行32bitvar | traffic class |    flow label     pay load        |next header| hop connect limiy                  SrcIP                  Dest IP

Next Header: Upper layer protocol
Hop Conncet Limit:ttl the same

3 PIM Multicast
    • Dense mode: When users are dense, direct flood push, add a certain prune pruning, graft grafting
    • Sparse mode: When the user is sparse, locate the RP (Convergence Point) for a separate pull
4 other relevant agreementsICMPv6
    • RS (port133) Routing request
    • RA (port134) route response
    • NS (port135) Neighbor request ARP to replace IPV4, look for MAC address
    • NA (port136) Neighbor response
DHCPv6
    • Routers are used to assign IPV6 addresses
Mpls
    • Press a label behind the frame to write the destination address directly, to achieve the purpose of fast forwarding (you do not have to open the IP header to see dest IP)
Network interface Layer first, the concept
    • Link: A physical line from a node to an adjacent node, where there are no other Exchange nodes.
    • Data Link: Hardware and software that adds a protocol to control data transfer on a physical line
1 Data Link layer
    • Equipment:
      • switch, each port is a separate collision domain (conflict zone). All two-tier devices (switch) are inside a boardcast domain (broadcast domains), and routers (three-tier devices) are isolated from broadcast domains
      • Bridge, similar to a switch, but only two ports are connected to two separate collision Domain
    • Function: Frame package, frame check and synchronization
    • Switch initial table if the target Mac cannot be found, then full port forwarding; switch can self-learing, learn from source mac-address
2 Physical Layer
    • Device: Hub (hub, processing only 01-bit sequence), connected by hub in one collision domain
    • Twisted pair, Fiber optic
    • Function: Converts a digital or analog data into a digital or analog signal, the data is the message entity, the signal is transmitted in the link
    • Four characteristics of the physical layer:
      • Mechanical properties: Specifies the shape and size of the connector used for the interface, number of leads and arrangement, fixation and locking device, etc.
      • Electrical Characteristics: Indicates the range of voltages that appear on each line of the interface cable.
      • Feature: Indicates the meaning of the voltage at a certain level that appears on a line.
      • Process characteristics: Indicates the sequence of occurrences of various possible events for different functions.
II. Multi-channel access Protocol 1 PPP (Point-to-point Protocol)
    • For synchronous but receiver and single sender
    • Transparent transfer: Any bit character can be transmitted correctly, by transferring the character (? )

2 CSMA Carrier-listening multi-access with collision detection
    • Random Access Protocol belonging to multi-access Protocol "channel partition, random access, rotation protocol"
    • Carrier monitoring: LBT (listen before talk); Stop talking (wait for 51.2μs before sending in Ethernet) if this node is talking to other nodes at the same time
    • Binary index back: When the frame undergoes a collision, randomly selects a K value from [1~2^n-1], and the node waits for K * 512bit time.
    • Ethernet Contention period (conflict window): Ethernet end-to-end round-trip time 2t, typically 51.2μs
third, cyclic redundancy check
    • Principle: Sender receiver contract A generation polynomial g, long r+1 bytes; The sender sends a data long D+CRC code long r data to the receiver, and ensures that the DR Connection can be divisible by G-Mode 2 (XOR). The receiver determines whether the division is divisible, and the division is correct.
    • Example: g=1001 d=101110 d XOR G = 011
      i.e. R = 011 Final Send 101110 011 change receiver
Four, Ethernet frame structure
Dest MAC(6B)| Src MAC(6B)|ProtocolType|  Data   |CRC(4B)

MAC address World-only, used to point to the next node on the link
When broadcasting frames, the Dest Mac is all F

    • MTU: Longest length byte in frame = 1460 + (IP) + (TCP)
    • Ethernet Rate: 10Mbps
    • Frame time between Ethernet: 9.6μs = 96 bit time
v. ARP (Address Revolution Protocol)

Address Resolution protocol that resolves the MAC address corresponding to the destination IP address. The ARP protocol is encapsulated directly in the frame

硬件类型2B 协议类型2B 硬件长度1B 协议长度1B OperationCode2B SrcMac6B SrcIP4B DestMac6B DestIP4B

Hardware Type: Ethernet
Destmac: Full 0 placeholder When asked, normal fill when answering

vi. model of LAN 1 topological structure
    • Star-shaped structure: easy to manage; large mainframe
    • Total linear structure: High Line utilization, and only two switches at the same time
    • Ring-shaped structure: good real-time, failure of nodes cause paralysis
2 technology to determine LAN characteristics
    1. The transmission medium used to transfer data.
    2. The topology used to connect various devices.
    3. The media access control method (MAC) used to share resources.
3 IEEE802 Local Area network architecture model

For LAN shared media, so divided into two sub-tiers

    • LLC: Responsible for providing services to its upper layers
    • MAC: Data frame encapsulation/uninstallation, frame addressing and recognition, frame receiving and sending, link management, frame error control, etc.
vii. Data encoding format
    • Analog signal encoding for digital data: FSK/ASK/PSK "modulation mode of wideband data"
    • Digital signal encoding for digital data: Manchester Coding
    • Digital signal encoding for analog data: PCM

[Other] computer network-top down Method Learning notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.