精华内容
下载资源
问答
  • NAT (Network Address Translator) 是一种用于将局域网中的私有地址转换成全局 IP 地址的技术。 NAT英文全称是“Network Address Translation”,中文意思是“网络地址转换”,它是一个IETF(Internet Engineering ...

    NAT

    1.1 简介

    NAT (Network Address Translator) 是一种用于将局域网中的私有地址转换成全局 IP 地址的技术。

    NAT英文全称是“Network Address Translation”,中文意思是“网络地址转换”,它是一个IETF(Internet Engineering Task Force, Internet工程任务组)标准,允许一个整体机构以一个公用IP(Internet Protocol)地址出现在Internet上。顾名思义,它是一种把内部私有网络地址(IP地址)翻译成合法网络IP地址的技术。

    如下图所示。因此我们可以认为,NAT在一定程度上,能够有效的解决公网地址不足的问题。

    clip_image002

    简单地说,NAT就是在局域网内部网络中使用内部地址,而当内部节点要与外部网络进行通讯时,就在网关(可以理解为出口,打个比方就像院子的门一样)处,将内部地址替换成公用地址,从而在外部公网(internet)上正常使用,<

    展开全文
  • TCP/IP协议族 总结

    千次阅读 2018-07-21 11:56:43
    几点注意: 1. 这篇文章是我复习KTH课程... Forouzan, TCP/IP Protocol Suite, 3nd Edition, 2005, McGraw-Hill, ISBN 0-07-296772-2 2. 全文篇幅比较长,建议利用目录查找需要的内容 3. 由于课程是英...

    几点注意:

    1. 这篇文章是我复习KTH课程Internetworking时的学习笔记。主要的参考资料为课本与课件。

        课本:Behrouz A. Forouzan, TCP/IP Protocol Suite, 3nd Edition, 2005, McGraw-Hill, ISBN 0-07-296772-2

    2. 全文篇幅比较长,建议利用目录查找需要的内容

    3. 由于课程是英文授课,所以许多地方中英混合出现,写的比较粗糙

    4. 有可能会出现图片打不开的情况,翻墙会解决这个问题

    5. 我在github上上传了pdf版,有需要可以下载

    目录

    Lecture 2 Link Layer

    1. Basic introduction

    2. Collision in Ethernet:

    3. Ethernet (有线) address & MAC address

    4. Collision in Wireless LAN (Problem 1. Hidden station problem)

    5. 数据链路层还分MAC和LLC子层

    Review of Lecture 2

    Lecture 3 Network layer fundamentals - Basic forwarding IP addressing

    1.In general

    2. Forwarding

    4. Allocate address

    Lecture 4 IP

    1. IPv4&IPv6 packet

    2. IPv4&IPv6 Fragmentation

    3. IPv4 header vs IPv6 header

    Lecture 5 IP, ARP, more IP and ICMP  

    1. ARP

    2. IP options (extension header)

    3. ICMP

    Lecture 6&7 Routing

    1.In general

    2. Bellman-Ford Algorithm

    3. Real network中的问题和解决

    4. Dijkstra's shortest path algorithm

    6. Routing Protocols

    Lecture 8&9 Transport Layer-UDP, TCP and beyond

    1.In general

    2. UDP

    3. TCP

    Lecture 10 &11 Application Layer

    1.In general

    2.Creating network applications  

    3.Web and HTTP  

    4. Remote login--Telnet & SSH

    5. Email

    Lecture 12 DNS

    Summary

    Lecture 13 IP Configuration 分IP地址

    1. BOOTP—Bootstrap Protocol  

    2. DHCP—Dynamic Host Configuration  

    3. Host Configuration—SLAAC--Stateless Autoconfiguration

    4. IPv6 Autoconfiguration—Plug and Play

    5. Stateful and Stateless Autoconfiguration

    Lecture 14 IP Security

    1. Overview

    2. Encapsulation Formats

    3. IPsec and IPv6

    4. IKE

    Lecture 15 IP Gateways

    1. Firewall

    2. NAT-Network Address Translation

    总图


    Lecture 2 Link Layer

    1. Basic introduction

    Data Link Layer has responsibility transferring datagram between adjacent nodes over a link. (Data link layer packet is a frame, encapsulates datagram into frame.)

    Link addressing: MAC address

     

    2. Collision in Ethernet:

    Capture.PNG

    CSMA: Listen before sending. Half-duplex link. But it cannot avoid all collision because there is propagation delay of each frame.

    CSMA/CD: Listen while sending. If collision is detected, abort transmission and retry.

    Capture.PNG

    No collision (nowadays used):

    Bridge learns location of MAC addresses by inspecting (检查) source address field in incoming frames.

     

    3. Ethernet (有线) address & MAC address

    The both are 48-bit number used to uniquely identify each computer in a network. The address is usually written in hexadecimal form.

    The Ehernet address is the most common form of MAC address.

    Capture.PNG

     

    4. Collision in Wireless LAN (Problem 1. Hidden station problem)

    Capture.PNG

    To avoid collision (Now we cannot use CDMA/CD), we use CDMA/CA:

    Capture.PNGCapture.PNG

    Problem 2 (RTS and CTS cannot solve this problem this time.)

    Capture.PNG

    C have to wait to send data to D until A finish sending data to B.

     

    5. 数据链路层还分MAC和LLC子层

    Capture.PNG

    MAC连接LLC子层和下级物理层。从LLC子层接受数据,附加上MAC地址和控制信息后再校验一下放到物理层去。

    其中最重要的概念是MAC address。

     

    Review of Lecture 2

    Capture.PNG
     


    Lecture 3 Network layer fundamentals - Basic forwarding IP addressing

    1.In general

    End-to-end delivery of packets independent of the underlying link layer technologies.

    Connectionless (只规定destination, 不规定具体路线): Packets may arrive in different paths, and may not receive in order.

    IP: Implemented using unicast addresses shared between several hosts.

    Direct Dilivery

    Indirect Dilivery

    Capture.PNG

    Host to host or router to host

    Capture.PNG

    Host to router or router to router

    – Destination and sender connected to the same physical network

    • Last delivery is direct

    – Destination address and local interface have same network address (use netmask)

    – From host to router or from router to router

    – Destination address and forwarding table:

    forwarding

    2. Forwarding

    The last one is using nowadays.

    No.1

    Capture.PNG

    No.2

    Capture2.PNG

    No.3


    3. IPv4 Addressing

    (IPv6 address is 128 bit long.)

     

    Capture2.PNG

    Capture3.PNG

    – Address & Mask = NetID (network address)

    – Address & !Mask = HostID (host address)

    – Address | !Mask = Directed broadcast address

    (limited broadcast address是都set to 1,255.255.255.255)

     

    4. Allocate address

    Capture.PNG

    Address range 是从 network address 到 broadcast address 的.

    Capture.PNG

     

    File_001.png

    Reading instruction:

    Ch 5,12.2,26



    Lecture 4 IP

    1. IPv4&IPv6 packet

    Capture.PNG

    Packet contains source and destination addresses.

    IPv6 没有 header length field (因为长度(不包括extension header)是固定的).

     

    2. IPv4&IPv6 Fragmentation

    MTU是数据链路层的限制,但是fragmentation发生在网络层

    注意UDPheader只有8 bytes长

    Capture2.PNG

    Capture2.PNG

    Flags:

    – RF (Reserved Fragment) – for future use (set to 0)

    – DF (Dont Fragment).

    • Set to 1 if datagram should not be fragmented.

    • If set and fragmentation needed, datagram will be discarded and an error message will be returned to the sender

    – MF (More Fragments)

    • Set to 1 for all fragments, except the last.

    Capture.PNG

    IPv6只能在source,不能再中间的router上面做fragmentation

     

    3. IPv4 header vs IPv6 header

     

    IPv4

    IPv6

    header length

    20-60 bytes

    40 bytes

    header length field

    没有 (header length fixed)

    name of down-counter

    lifetime of every datagram

    (可以自行设置, Default initial value: 64)

    TTL (8 bit)

    每经过router, -1. =0时丢弃

    Every router holding a datagram for more than 1 second should decrement the TTL by the number of seconds

    Hop Limit (8 bit)

     

    connectionless

    connection-oriented

    Because of the adding of flow label (textbook P830)

     

    Capture.PNG

    IP Network layer functions  

    IPv4实现方法

    IPv6实现方法

    Logical addressing

    Locating hosts

    Routing

    Path determination

    Forwarding

    Move Packet from input to output of the routers

    Fragmentation

    Adaption to lower layer

    Multiplexing/demultiplexing

    (多路复用和解复用)

    Many transport layer protocols

    Error detection + avoidance

    checksum

    -

    QoS (Quality of Service)

    ToS (Type of Service): 8 bit

    ^{\[1]}Traffic Class: 8 bit

    Flow Label: 20 bit

    [1] The flow label field allows labeling packets belonging to a particular flow for which the sender requests the same handling. A flow is identified by the source address, destination address, and a nonzero flow label, and packets belonging to a flow should be treated the same way by a router (rfc6437)

    The first 6 bits of the traffic class field hold the DiffServ Code Points (DSCP), which can be used for classifying packets in order to implement priorities. The last 2 bits are used for ECN, and serve for signaling congestion in the network. (rfc3260)

    Reading instruction:

    Ch 6,7,27


    Lecture 5 IP, ARP, more IP and ICMP  

    1. ARP^{\[2]}

    已知IP address,想得到MAC address:ARP (Address Resolution Protocol)  

    已知Name(域名,比如kth.se),想得到IP address: DNS

    捕获.PNG

    注意这个过程在高速缓存cache中存储了,所以第二次传输datagram的时候不需要再进行APR request (broadcast) 和APR reply (unicast)。

    [2] Address Resolution的方式包括:

    (用于IPv4的Address Resolution Protocol – ARP,这一部分中介绍)

    (用于IPv6的Neighbor Discovery Protocol – ICMPv6,单独在3. ICMP中介绍)

    代理ARP:

    捕获.PNG

    捕获.PNG

     

    2. IP options (extension header)

     

    IPv4

    IPv6

    Purpose

    Control, testing and debugging of the network functionality

    Length

    IPv4: Max 40 bytes^{\[3]}

    (Max header length is 60 bytes in IPv4)

    IPv6: No limitations^{\[4]}

    Option Format

    Capture.PNG

    Capture.PNG

    Option Type

    End of option

    Hop-by-hop options (Pad1&PadN&jumbao payload)

    用于当source需要把信息传递给datagram经过的所有routers时. eg,.if the length of the datagram is more than the usual 65535 bytes.

    Capture.PNG

    Capture2.PNG

    Capture3.PNG

    No operation

    Routing

    Loose source route^{\[5]}

    Fragment

    Timestamp

    Authentication Header

    Record route

    Encapsulating Security Payload

    Strict source route

    Destination options

    对比

    Capture.PNG

    (IPv4的fragmentation在fixed header里面实现)

    [3] The header of the IP datagram is made of two parts: a fixed part and a variable part. The fixed part is 20 bytes long and was discussed in the previous section. The variable part comprises(包括) the options, which can be a maximum of 40 bytes.

    [4] The length of the base header is fixed at 40 bytes. However, to give more functionality to the IP datagram, the base header can be followed by up to six extension headers

    [5] 对其中的Source Route进行说明:预先指定数据报在因特网中传送时的路由,分为strick和loose两种

    – Strict Source routing (SSRR)

    • The path is exactly as specified-只能访问sender规定的路由。访问其他路由时,该路由会丢弃datagram然后发送error message

    – Loose Source Routing (LSRR)

    • The path includes the specified addresses-必须访问sender规定的路由,其他路由也可以访问

    Source route: when it comes handy

    • Troubleshooting

    – Figure out from point "A" why machines “B" and “C" cannot communicate

    • Mapping the network

    – Used with traceroute in order to find all the routes between two points on the network

    • Performance

    – Force an alternate link to avoid congesting the correct routes w/o changing the forwarding tables (management)

    – Create independent paths for MDC or FEC

    • Hacking

    – Can send packets to a host via a trusted third party

    • Normally disabled in routers…

    3. ICMP

    (不属于TCP也不属于UDP)

    Capture.PNG

    笔记本 (2).png

    Reading instruction:

    Ch 7-9, 27, 28  

     


    Lecture 6&7 Routing

    1.In general

    捕获.PNG

    •Problem

    –Find best path from router to host

    •Typically based on shortest path algorithms (from graph theory)

    • Bellman-Ford algorithm

    – Used by Distance-Vector protocols (RIP, IGRP, BGP)

    • Dijkstra's algorithm

    –Used by Link-State protocols (OSPF,popular among organizations, IS-IS,p.a. operators)

    Capture.PNG

    Capture2.PNG

     

    2. Bellman-Ford Algorithm

    Capture.PNG

    Distance-vector = (destination, metric, next-hop) [metric表示的是cost的度量]

    Path-vector = (destination, path, next-hop)

     

    3. Real network中的问题和解决

    笔记本 (2).png

    笔记本 (3.png

    笔记本 (4.png

     

    4. Dijkstra's shortest path algorithm

    例子:

    Capture.PNG

    Capture2.PNG

     

    Capture.PNG

     

    6. Routing Protocols

    Capture.PNG

    1)RIP

    •Metric: hop count (1: directly connected, 16: infinity)

    •Supports networks with diameter 小于等于15

    •Timeout timer (Purge清除 routes that are not refreshed)

    •Messages carried in UDP datagrams

    –Broadcast (RIP-1)

    –IP Multicast (RIP-2): 224.0.0.9

    –IPv6 Multicast (RIPng): FF02::9

    2) Open Shortest Path First protocol (OSPF) 相对RIP更适合用于大一点的网络

    与RIP和BGP不同的是,OSPF协议不使用TCP或者UDP协议而是承载在IP协议之上

    • Metric: arbitrary (Often related to link speed (inverse proportional))

    • Scaling achieved through hierarchy

    - Every network segment has 1 designated router (+1 backup) – DR, BDR (每条线上1DR)

    - AS split into areas – use Dijkstra for an area

    • Messages carried directly on top of IP

    - IP Multicast: 224.0.0.5

    - IPv6 Multicast: FF02::5

    • OSPF protocol components

    (1) Hello protocol

    - Detection of neighboring routers

    - Election of designated router (and backup)  adjacency

    (2) Exchange protocol

    - Exchange link-state between adjacent routers

    (3) Reliable flooding

    - When links change/age: send update to adjacent routers and flood recursively

    (4) Shortest path calculation

    - Compute shortest path tree to all destinations using Dijkstra’s algorithm

    Capture.PNGimportant example^{[6]}

    [6] LSA: link state advertisement

     

    Capture.PNG

    3) Inter-domain

    AS(Aotonomous Systems)的概念: A set of routers. 每个AS都有AS number

    Capture.PNG

    AS7是AS3的customer,have to pay to AS3

    4) Border Gateway Protocol (BGP) v4

    Path-vector routing protocol (和之前的两个Link-state, Distance-vector都不一样)

     •Path vector consists of AS:s, not IP addresses

      –Hides internal structure in the domains

      –Loop detection only on AS-numbers!

      –Example: <dst: 10.1.10/24, path: AS1:AS3:AS5, nexthop: 10.2.3.4>

    •Used between domains (AS:s)

     • Views the Internet as a collection of AS:s

    •Supports the destination-based forwarding paradigm

     –Other relations are not expressed: sources, tos, link load

    •Uses TCP for data transmission between BGP peers

    •Tags destinations with path attributes (attribute,属性,定语)

     •Describe different properties of the destination (e.g., preferences)

     •Can express and enforce policy decisions at AS level

    Capture2.PNG

    Capture.PNG

    Reading instruction:

    Chapter 11: Unicast routing protocols

    11.6 OSPF: Skip detailed packet descriptions

    11.8 BGP: Skip detailed packet descriptions  

     


    Lecture 8&9 Transport Layer-UDP, TCP and beyond

    1.In general

    Purpose: Logical process-to-process communication

    和IP Layer的对比:

     

    IP

    UDP

    TCP

    connectionless

    (只规定destination)

    connectionless

    connection-oriented

    (规定具体路线)

    unreliable

    unreliable

    reliable

    message- oriented

    (Deliver the whole packet together, 传或不传)

    message- oriented

    byte-stream oriented

    (the unit of transmission is byte, and in order)

      

    full-duplex

     

    2. UDP

    △UDP data delivery based on: receiver port number and receiver IP address.

    △UDP checksum: IPv4可以有,IPv6必须有(IPv6在IP层没有checksum)

    △psedo-header:to double check

    △Maximum UDP Segment Size

    • Theoretical limit

    – IPv4: 65,507 bytes of payload

    • 65,535 bytes (IPv4) - 20 bytes IP header - 8 bytes of UDP header

    – IPv6: 65,527 bytes of payload

    • 65535 bytes payload – 8 bytes UDP header  

     

    3. TCP

    △TCP service model

    1) Connection-oriented – a virtual circuit^{[7]}

    2) Between exactly two end-points – Broadcast and multicast不能用TCP (use UDP)

    3) Full duplex

    4) Reliable and in-order – Delivery is not guaranteed but reception is known

    5) Byte stream service

    – A stream of 8-bit bytes is transmitted over the TCP connection

    – No record markers inserted by TCP  

    [7] 虚拟电路(英语:Virtual circuit,缩写为 VC),又称为虚电路、虚连接或虚通道,在分组交换的电脑网路上,交换资料的传输方式之一。它是一种预接式(connection-oriented),或线路交换式(circuit-switched)的资料传输方法,在两个终端系统(End system)间,建立一条连线,来进行资料交换。

    △TCP service function

    1) Multiplexing/Demultiplexing  ^{[8]}

    • TCP connection identification (UDP不需要sender的IP address和port number)

    – Sender IP address and port number

    – Receiver IP address and port number  

    2) Segmentation - Byte stream to segment translation ^{[9]}

    Try to send as big segments as possible (MSS) :

    • The largest chunk of data TCP will send to the other side

    – Can be announced in the options field of the TCP header during connection establishment

    • If not announced, a default value is assumed

    – 576 bytes host MTU requirement in IPv4 : 536 bytes

    – 1280 bytes MTU requirement in IPV6: 1220 bytes

    • Large MSS means

    – Less overhead^{[10]} (headers)

    – Less segments to take care of (will see later)

      • Until fragmentation occurs (Path MTU discovery)

    – Potentially more delay  

    3) Error control -  Reliable transmission over unreliable channel  

    – Noise → Bit error → Packet corruption → Packet drop

    – Congestion → Packet drop  

    [8]  Whenever an entity accepts items from more than one source, it is referred to as multiplexing (many to one); whenever an entity delivers items to more than one source, it is referred to as demultiplexing (one to many).

    [9] The IP layer, as a service provider for TCP, needs to send data in packets, not as a stream of bytes. At the transport layer, TCP groups a number of bytes together into a packet called a segment.TCP adds a header to each segment (for control purposes) and delivers the segment to the IP layer for transmission. The segments are encapsulated in an IP datagram and transmitted.

    Note that segments are not necessarily all the same size.

    [10] The typical TCP header is 20 bytes, and the typical IPv4 header is also 20 bytes, so in this case overhead is TCP + IP =40 bytes

    三种flavor:

    ①Stop-and-wait  ^{[11]}

    Both the sender and the receiver use a sliding window of size 1. 只有两个序号.

    捕获.PNG

    捕获.PNG

    序号指的是sequence no,确认号指的是ACK no。

    [11] A flow-control method in which each data unit must be acknowledged before the next one can be sent.  

    捕获.PNG

    捕获2.PNG

    捕获.PNG

    这种方法的缺点是利用率太低(尤其是带宽时延积较大时)。

    ②Go-Back-N  

    在收到ACK之前能够发送多个segment,但接收方只能缓存一个分组。发送方为发送出去的segment保存副本知道ACK送达。

    2^m即只能取0~2^m-1范围内的值。

    捕获.PNG

    滑动发送窗口^{[12]}--窗口的最大值为2^m-1

    捕获3.PNG

    [12] The send window is an abstract concept defining an imaginary box of maximum size = 2^m-1 with three variables: S_f(第一个待确认的) , S_n(下一个要发送的) , and S_{size}(窗口大小)

    捕获.PNG

    捕获2.PNG

    捕获-1.PNG捕获0.PNG

    捕获.PNG

    上图的例子m=3(计数器).

    捕获.PNG

    捕获.PNG

    ③Selective Repeat-N  

    捕获.PNG捕获2.PNG

    捕获.PNG

    捕获.PNG

     

    捕获.PNG

    ④三种flavor总结

     

     

    发送窗口(最大值)

    接收窗口(最大值)

    序号

    计时器(timer)

    Stop-and-wait

    1

    1

    0~1

     

    Go-Back-N  

    2m-1

    1

    0~2m-1

    所有待确认的segment共用一个计时器

    Selective Repeat-N  

    2m-1

    2m-1

    0~2m-1

    每个待确认的segment各一个单独的计时器

    △Retransmission Time-Out (RTO)– Time to wait for the ACK of a segment

    (不是一个fixed number)  

    捕获.PNG

    △Karn’s Algorithm  

    捕获.PNG

    4) Flow control -- Adapt to the receiver’s capabilities  

    • Ensure that receiver does not get overwhelmed with data sent by the sender

    • TCP uses a sliding window protocol

    捕获.PNG

    △Delayed acknowledges  ^{[13]}

    Advantages:

    1. ACK traffic is reduced  

    2. Increased chance that data can be piggy-backed(一方发送sequence时,packet内同时包含了对另一方的ACK) on the ACK

    △Persistence Timer  

    捕获.PNG

    △Silly Window Syndrome  的解决办法

    捕获.PNG

    发送方慢:

    捕获2.PNG

    捕获3.PNG

    捕获.PNG

    接收方慢:

    捕获.PNG  

    △Bandwidth-Delay Product

    • The ”capacity” of the ”pipe”

    capacity(bits) = bandwidth(bits/sec) x RTT(sec)

    • The receiver advertised window should be higher  

    △TCP Bulk Data Flow  

    捕获.PNG捕获2.PNG

    5) Connection Management--Establishment/tear down  

    △TCP connection establishment

     捕获.PNG

    △Keepalive Timer--Avoid TCP connections to exist forever  

    捕获.PNG

    △TCP connection teardown

    捕获.PNG


     

    △Time-Wait Timer--Connection termination  

    捕获.PNG^{[14]}

    [14] FIN是一种TCP的flag, which means sender has finished sending data  

    汇总:TCP的各种计时器

    捕获.PNG

    6) Congestion control-- Adapt to network conditions  

    The window size must depend on the network’s state as well!  

    捕获0.PNG

    捕获.PNG

    △Slow Start & Congestion Avoidance

    捕获.PNG

    捕获2.PNG

    捕获.PNG

    捕获.PNG

    △TCP Header  

    20 byte 固定+20 byte optional

    TCP中的checksum是必须的(UDP不是)

    Reading instruction:

    Ch 13,14,15.1-15.4  

     


    Lecture 10 &11 Application Layer

    1.In general

    Applications run on end-systems only  

    Possible structure of applications:

    - Client-server

    Server

    Client

    Always on  

    May be intermittently connected  

    At a permanent, well-known location

    (For instance, an HTTP server is at port 80, by default)

    May have dynamic IP addresses  

    Can service many clients  

    “Ephemeral” ports

    (Short-lived, dynamically allocated ports)

    - Peer-to-peer (P2P)  

    • No always-on server

    • Peers request service from other peers, provide service in return to other peers  

     

    2.Creating network applications  

    捕获.PNG

    Sequencial Server

    捕获.PNG

    Concurrent Server

    捕获2.PNG

     

    3.Web and HTTP  

    捕获.PNG

    HTTP: hypertext transfer protocol--Web application layer protocol

    △client/server model (client: browser, server: Web server)  

    △uses TCP,步骤如下:

    •client initiates TCP connection (creates socket) to server, port 80

    •server accepts TCP connection from client  

    •HTTP messages (application layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)

    •TCP connection closed  

    △HTTP is stateless

    •Request/response

    •Server maintains no information about past client requests  

    △HTTP Response Status Codes

    Status code appears in first line in server-to-client response message. Some sample codes:  

    200 OK - request succeeded, requested object later in this response

    301 Moved Permanently - requested object moved, new location specified later in this response (Location:)

    400 Bad Request - Request not understood by server

    404 Not Found - requested document not found on this server 505 HTTP Version Not Supported  

    △TCP connection strategies  

    Non-persistent Connection  

    Persistent Connection

    捕获.PNG

    捕获2.PNG

    One TCP connection per HTTP transaction

    1. Reuse same TCP connection for multiple HTTP transactions

    - Default as of HTTP 1.1

    2. How long should connection be left open?

    - Occupies server resources

    - Controlled by “Keep-Alive” header  

     

    △HTTP cookies

    捕获.PNG

    △Web caches (proxy server) 代理服务器

    Capture.PNG

    Capture2.PNG

     

    4. Remote login--Telnet & SSH

    1) Telnet Remote Login

    Capture.PNG

    Capture2.PNG

    2) SSH – Secure Shell

    • Telnet considered insecure

    - No encryption – eavesdropping

    - No authentication of client/server

    • SSH

    - Encryption and authentication

    - Create a secure (encrypted and authenticated) channel over TCP

    - Default port 22

    3) Port Forwarding

    Capture2.PNG

    5. Email

    Case1. When the sender and the receiver of an e-mail are on the same mail server, we need only two user agents^{[15]}.

    Capture.PNG

    [15]  User Agent--Program to create and read e-mail

    - Examples: Outlook, OS X Mail, Thunderbird, Kmail,Envelope, ...

    Case2. When the sender and the receiver of an e-mail are on different mail servers, we need two UAs and a pair of MTAs (client and server).

    Capture.PNG

    Case3. When the sender is connected to the mail server via a LAN or a WAN, we need two UAs and two pairs of MTAs (client and server).

    Capture3.PNG

    Case4. When both sender and receiver are connected to the mail server via a LAN or a WAN, we need two UAs, two pairs of MTAs (client and server), and a pair of MAAs (client and server). This is the most common situation today.

    Capture4.PNG

    Capture5.PNG

    Push和Pull用不同的协议:

    Push--SMTP, Pull--POP, IMAP

    a. SMTP

    Capture.PNG

    SMTP requires message(header & body) to be in 7-bit ASCII

    Capture.PNG

    b. Mail Access Protocols

    Capture.PNG

    Lecture 12 DNS

    捕获.PNG

    - One name can map to several addresses

    - One address can have several names  

    捕获.PNG

    捕获2.PNG

    捕获.PNG^{[16]}

    [16] TLD: 顶级域(或顶级域名;英语:Top-level Domain;英文缩写:TLD)是互联网DNS等级之中的最高级的域,它保存于DNS根域的名字空间中。顶级域名是域名的最后一个部分,即是域名最后一点之后的字母,例如在example.com这个域名中,顶级域是.com(或.COM),大小写视为相同。TLD: 顶级域(或顶级域名;英语:Top-level Domain;英文缩写:TLD)是互联网DNS等级之中的最高级的域,它保存于DNS根域的名字空间中。顶级域名是域名的最后一个部分,即是域名最后一点之后的字母,例如在example.com这个域名中,顶级域是.com(或.COM),大小写视为相同。

    捕获.PNG^{[17]}

    [17] Having multiple name servers is for redundancy. When an organization has multiple name servers, there is one primary server and several secondary servers. The zone file is updated on the primary server, and then the updates are transferred automatically to the secondaries through “zone transfers”.  

    捕获.PNG

    捕获2.PNG

    • If client requests recursion, and server agrees, the server resolves the name for the client

    --Through iterative resolution

    • Otherwise server sends back whatever information it has about the name

    --Typically name of server to contact (but not necessarily)

    • Normally, only resolvers agree to recursion  

    捕获3.PNG

    捕获.PNG

    Quearying tool: dig (domain information groper)  

    捕获.PNG

    捕获2.PNG

    Summary

    • Domain name space organized in hierarchy

    - Generic domains, country domains, inverse domain

    • Database distributed over name servers

    - Root server, TLD servers, authoritative servers

    • Resolver performs (iterative) resolution on behalf of clients

    • Name servers are responsible for zones

    - Responsibilities are distributed through delegations

    • Supports different kinds of queries

    - A, AAAA, NS, PTR, MX, …

    • BIND DNS software

    - Zone file definitions  

     


    Lecture 13 IP Configuration 分IP地址

    Automating IP Configuration--之前还提到了stateless和stateful的分别是HTTP和它的cookie!

    • BOOTP (Bootstrap Protocol)

    - Static, stateful, client-server

    • DHCP (Dynamic Host Configuration Protocol)

    - Dynamic, stateful, client-server

    • SLAAC (Stateless Address Autoconfiguration)

    - Dynamic, stateless

    - RFC 4862: IPv6 Stateless Address Autoconfiguration

    • Zeroconf

    - Autoconfiguration completely without servers?  

    △RARP—Reverse ARP  

    捕获.PNG

    1. BOOTP—Bootstrap Protocol  

    捕获.PNG

     

    2. DHCP—Dynamic Host Configuration  

    捕获.PNG

    捕获.PNG

    Client has neither its own IP address, nor the server’s. How do we then address Request/ Reply?  

    DHCP important:

    捕获.PNG

    如果DHCP的client和server在不同的网络上,就需要relay agent:

    Capture.PNG

    DHCP Scenario(方案,分镜头)

    Capture0.PNG

    Capture.PNG

    Transaction ID should be the same value for all four messages.

    Discover--Offer--Request--ACK

     

    3. Host Configuration—SLAAC--Stateless^{[18]} Autoconfiguration

    SLAAC vs DHCP

    •Unfortunately, SLAACs contain only limited information

    -Prefixes and router address

    •Hosts often need other configuration information

    -E.g., DNS server, Time server, Printer server

    •For these, we still need DHCP servers

    -Good news is that we can use SLAAC for setting up the IP address, and use stateless DHCP for everything else

    [18] Server keeps no state about hosts, only non-host state

     

    4. IPv6 Autoconfiguration^{[19]}—Plug and Play

    •Idea: automatically discover parameters used to connect to the Internet

    -Address, netmask, router, nameserver, ...

    •Two scenarios: stateless and stateful

    In IPv6 stateless autoconfiguration, the client can create an IP address based on its MAC address instead of requesting it from a DHCP server.

    ①Advatage:A MAC-derived IPv6 address is a straight forward way to generate a unique IP address automatically and L3/L2 address translation can be done locally by the sender (no ARP needed).

    ②Problem: The MAC address reveals information about the interface card(L2,L3的地址,name), such as identity and vendor of the interface card, so that e.g. potential bugs could be exploited.

    ③Solution:IPv6 privacy extensions solve this problem by using a randomly assigned interface ID instead and this number can change over time (temporal address). 此时需要ARP

    [19] One of the interesting features of IPv6 addressing is the autoconfiguration of hosts. As we discussed in IPv4, the host and routers are originally configured manually by the network manager. However, the Dynamic Host Configuration Protocol, DHCP, can be used to allocate an IPv4 address to a host that joins the network. In IPv6, DHCP protocol can still be used to allocate an IPv6 address to a host, but a host can also configure itself.

     

    5. Stateful and Stateless Autoconfiguration

    Stateless autoconf

    Stateful autoconf

    -Small networks

    -Nodes can start communicating directly

    -Larger networks

    -Centralized management

    Combination (Stateless DHCP)

    [DHCP本身是stateful的]

     


    Lecture 14 IP Security

    1. Overview

    •Authenticated Keying

    –Internet Key Exchange (IKE)

    •Data Encapsulation

    –ESP: IP Encapsulating Security Payload (RFC 4303)

    –AH: IP Authentication Header (RFC 4302)

    •Security Architecture (RFC 4301)

    –Tunnel/transport Mode

    –Databases (Security Association, Policy, Peer Authorization)

    Capture.PNG

    •AH and ESP rely on an existing security association

    –Idea: parties must share a set of secret keys and agree on each other’s IP addresses and crypto algorithms

    •Internet Key Exchange (IKE)

    –Goal: establish security association for AH and ESP

    –If IKE is broken, AH and ESP provide no protection!

    △IPsec Modes

    •Transport mode

    –Used to deliver services from host to host or from host to gateway

    –Usually within the same network, but can also be end-to-end across networks

    •Tunnel mode^{[20]}

    –Used to deliver services from gateway to gateway or from host to gateway

    –Usually gateways owned by the same organization

     (With an insecure network in the middle)

    Capture.PNG

    IPsec protects communication on the insecure part of the network.

    [20]  tunnel mode’s typical application: virtual private network (VPN,通常由ESP实现)

    两种mode对比:

    Transport

    secures packet payload and leaves IP header unchanged(只管payload)

    Capture.PNG

    Capture.PNG

    Tunnel

    encapsulates both IP header and payload securely into IPsec packets(IPheader+Payload)

    Capture2.PNG

     

    △Security Association (SA)

    •One-way sender-recipient relationship

    –Manually configured or negotiated through IKE

    •SA determines how packets are processed

    –Cryptographic algorithms, keys, AH/ESP, lifetimes, sequence numbers, mode (transport or tunnel)

    •SA is uniquely identified by {SPI, dst IP addr, flag}

    –SPI: Security Parameter Index

    •Chosen by destination (unless traffic is multicast...)

    –Flag: ESP or AH

    –Each IPsec implementation keeps a database of SAs

    –SPI is sent with packet, tells recipient which SA to use

    2. Encapsulation Formats

    1) AH

    –Authentication Header

    –Provides integrity

    Only in transport mode:

    Capture.PNG

    2) ESP

    –Encapsulating Security Payload

    –Provides integrity and/or privacy

    Can work in transport…(original IP header没有被封装起来)

    Capture.PNG

    …or tunnel mode (problem with NAT)

    Capture.PNG

    !!!Tunnel mode can be problematic together with NAT

    •If we set up a tunnel between our host and a public gateway, it won’t work:

    –Our private addresses will be in the original IP header

    •It is OK to set up a tunnel between our host and a private intranet:

    –Private intranet addresses will be in the original IP header

    –New IP header will contain our home private address, which will be translated by the NAT

     

    3. IPsec and IPv6

    IPsec is a mandatory component for IPv6.

    Extension headers are used for IPsec.

    IPsec Tunnel Mode in IPv6:

    Capture.PNG

     

    4. IKE

    •Internet Key Exchange—setting up the SAs for IPsec (ESP and AH SA's)

    •Use IKE protocol to do mutual authentication and to create a session key

    –Use Diffie-Hellman to derive shared symmetric key

    △Diffie-Hellman

    •For IKE to use Diffie-Hellman we need to add

    –Cookies for protection against denial-of-service attacks

    Capture.PNG

    The cookies should be stateless,so “Bob” doesn’t have to keep track of all cookies he sent.

    –Nonces to ensure against replay attacks

    △IKE Phases

    •Phase 1

    –do mutual authentication and establish IKE session keys

    –Sets up the “main” SA (or IKE SA)

    •Phase 2

    –Set up one or more IPsec SAs (child SAs) between the nodes using the keys derived in phase 1

    •Why two phases?

    –Mutual authentication is expensive

    –If multiple SAs are needed or if SA parameters need to be changed, this can be done without repeating mutual authentication

    Capture.PNG

    加入cookie和nounces之后:

    Capture1.PNG

    Capture2.PNG

     


    Lecture 15 IP Gateways

    这一章首先介绍了什么事gateway--

    A machine that sits between two interconnected networks and relays traffic between them.

    Traffic cannot flow between the two networks without the assistance of the gateway.

    Conclusion: A routeris a network layer gateway

    –But we can have other types of gateways, both at the network layer and elsewhere

    都有什么特殊功能呢

    1. Connecting networks with incompatible (不兼容的) address systems,比如:

    •IPv4 and IPv6----IPv4/IPv6 Gateways(不是重点)

    •Two IPv4 networks with independent address domains-----NAT

    2. Restricting what traffic flows between two networks-----firewall

    •Protective purposes

    3. Redirecting traffic, possibly tunneling it

    •Mobility, VPNs, IPsectunnels etc

     

    1. Firewall

    Isolates organization’s internal network from larger Internet, allowing some packets to pass and blocking others.

    △Firewall Locations in the Network

    •Between internal LAN and external network

    •At the gateways of sensitive subnetworkswithin the organizational LAN

    -Payroll’s network must be protected separately within the corporate network

    •On end-user machines

    -“Personal firewall”

    -Microsoft’s Internet Connection Firewall (ICF)

    △Firewall types

    Capture.PNG

    Capture2.PNG

    Two default policies:

    •Default = discard

    -which is not explicitly permitted is prohibited

    •Default = forward

    -which is not explicitly prohibited is permitted

    •Default = discard is more conservative

     

    对比:

    •Packet filter can do its job without requiring software changes in communicating nodes

    -Allowed conversations proceed normally (in most cases)

    •An application level gateway is visible to the users

    -Need to connect to the gateway

    •Application level gateway can be more powerful than packet filters—e.g., look at data inside email messages

    -Gateway is application-aware

     

    2. NAT-Network Address Translation

    Capture.PNG

    右边的这些local network用138.76.29.7的不同端口表示。

    10.0.0.1到10.0.0.4是可以在其他local network中重复利用的,而138.76.29.7是唯一的。

    例子:Assume that host 10.0.0.1 on a private network (10.0.0.0/24) sends an HTTP request through its NAT box to a web server on address 128.119.40.186 and that this web server answers with an HTTP response back to the host.

    Capture.PNG

    1) port 80是web server的默认HTTP端口,固定的; 10.0.0.1的port3345不是固定的

    2) 最终138.76.29.7, port 5001被分配给10.0.0.2。(5001不是固定的,只是这么分配而已,可以给下面两个hosts分配5002,5003)

    3) 两个方向上每次都是138和10开头的地址替换,webserver的地址一直为Source/Dest.

     


    总图

     

    Capture.PNG

    展开全文
  • 1、什么是TCP/IP协议 TCP/IP 是一类协议系统,它是用于网络通信的一套协议集合. 传统上来说 TCP/IP 被认为是一个四层协议 1) 网络接口层: 主要是指物理层次的一些接口,比如电缆等. 2) 网络层: 提供...

    1、什么是TCP/IP协议

    TCP/IP 是一类协议系统,它是用于网络通信的一套协议集合.

    传统上来说 TCP/IP 被认为是一个四层协议

     

     

    1) 网络接口层:

    主要是指物理层次的一些接口,比如电缆等.

     

    2) 网络层:

    提供独立于硬件的逻辑寻址,实现物理地址与逻辑地址的转换.

     

    在 TCP / IP 协议族中,网络层协议包括 IP 协议(网际协议),ICMP 协议( Internet 互联网控制报文协议),以及 IGMP 协议( Internet 组管理协议).

     

    3) 传输层:

    为网络提供了流量控制,错误控制和确认服务.

     

    在 TCP / IP 协议族中有两个互不相同的传输协议: TCP(传输控制协议)和 UDP(用户数据报协议).

     

    4) 应用层:

    为网络排错,文件传输,远程控制和 Internet 操作提供具体的应用程序

     

    2.数据包

    在 TCP / IP 协议中数据先由上往下将数据装包,然后由下往上拆包

    在装包的时候,每一层都会增加一些信息用于传输,这部分信息就叫报头,当上层的数据到达本层的时候,会将数据加上本层的报头打包在一起,继续往下传递.

    在拆包的时候,每一层将本层需要的报头读取后,就将剩下的数据往上传.

     

    3.网络接口层

    这一块主要主要涉及到一些物理传输,比如以太网,无线局域网.这里就不做详细的介绍了

     

    4.网络层

    前面有提到,网络层主要就是做物理地址与逻辑地址之间的转换.

     

    目前市场上应用的最多的是 32 位二进制的 IPv4 ,因为 IPv4 的地址已经不够用了,所以 128 位二进制的 IPv6 应用越来越广泛了(但是下面的介绍都是基于 IPv4 进行的)

     

    1) IP:

    TCP/IP 协议网络上的每一个网络适配器都有一个唯一的 IP 地址.

     

    IP 地址是一个 32 位的地址,这个地址通常分成 4 端,每 8 个二进制为一段,但是为了方便阅读,通常会将每段都转换为十进制来显示,比如大家非常熟悉的 192.168.0.1

     

    IP 地址分为两个部分:

     

    网络 ID

    主机 ID

    但是具体哪部分属于网络 ID,哪些属于主机 ID 并没有规定.

     

    因为有些网络是需要很多主机的,这样的话代表主机 ID 的部分就要更多,但是有些网络需要的主机很少,这样主机 ID 的部分就应该少一些.

     

    绝大部分 IP 地址属于以下几类

     

    A 类地址:IP 地址的前 8 位代表网络 ID ,后 24 位代表主机 ID。

    B 类地址:IP 地址的前 16 位代表网络 ID ,后 16 位代表主机 ID。

    C 类地址:IP 地址的前 24 位代表网络 ID ,后 8 位代表主机 ID。

    这里能够很明显的看出 A 类地址能够提供出的网络 ID 较少,但是每个网络可以拥有非常多的主机

     

    但是我们怎么才能看出一个 IP 地址到底是哪类地址呢?

     

    如果 32 位的 IP 地址以 0 开头,那么它就是一个 A 类地址。

    如果 32 位的 IP 地址以 10 开头,那么它就是一个 B 类地址。

    如果 32 位的 IP 地址以 110 开头,那么它就是一个 C 类地址。

    那么转化为十进制(四段)的话,我们就能以第一段中的十进制数来区分 IP 地址到底是哪类地址了。

     

     

    注意:

    十进制第一段大于 223 的属于 D 类和 E 类地址,这两类比较特殊也不常见,这里就不做详解介绍了。

    每一类都有一些排除地址,这些地址并不属于该类,他们是在一些特殊情况使用地址(后面会介绍)

    除了这样的方式来划分网络,我们还可以把每个网络划分为更小的网络块,称之为子网(后面会介绍)

    全是 0 的主机 ID 代表网络本身,比如说 IP 地址为 130.100.0.0 指的是网络 ID 为130.100 的 B 类地址。

     

    全是 1 的主机 ID 代表广播,是用于向该网络中的全部主机方法消息的。 IP 地址为 130.100.255.255 就是网络 ID 为 130.100 网络的广播地址(二进制 IP 地址中全是 1 ,转换为十进制就是 255 )

     

    以十进制 127 开头的地址都是环回地址。目的地址是环回地址的消息,其实是由本地发送和接收的。主要是用于测试 TCP/IP 软件是否正常工作。我们用 ping 功能的时候,一般用的环回地址是 127.0.0.1

     

    2)地址解析协议 ARP

    简单的来说 ARP 的作用就是把 IP 地址映射为物理地址,而与之相反的 RARP(逆向 ARP)就是将物理地址映射为 IP 地址。

     

    3)子网

    前面提到了 IP 地址的分类,但是对于 A 类和 B 类地址来说,每个网络下的主机数量太多了,那么网络的传输会变得很低效,并且很不灵活。比如说 IP地址为 100.0.0.0 的 A 类地址,这个网络下的主机数量超过了 1600 万台。

     

    所以子网掩码的出现就是为了解决这样的问题。

     

    我们先回顾一下之前如何区分主机 IP 和网络 IP 的。

     

    以 A 类地址 99.10.10.10 为例,前 8 位是网络 IP ,后 24 位是主机 IP 。(如下图)

     

     

     

     

     

    子网掩码也是一个 32 为的二进制数,也可以用四个十进制数来分段,他的每一位对应着 IP 地址的相应位置,数值为 1 时代表的是非主机位,数值为 0 时代表是主机位。

     

     

     

     

     

    由表格可以很清晰的看出,网络 IP 仍是由之前的分类来决定到底是多少位,主机 IP 则是由子网掩码值为 0 的位数来决定,剩下的则是子网 IP

     

    5 传输层

    传输层提供了两种到达目标网络的方式

     

    传输控制协议(TCP):提供了完善的错误控制和流量控制,能够确保数据正常传输,是一个面向连接的协议。

    用户数据报协议(UDP):只提供了基本的错误检测,是一个无连接的协议。

    特点:

    1)UDP:

    把数据打包

    数据大小有限制(64k)

    不建立连接

    速度快,但可靠性低

    2)TCP:

    建立连接通道

    数据大小无限制

    速度慢,但是可靠性高

    由于传输层涉及的东西比较多,比如端口,Socket等,都是我们做移动开发需要了解的,之后的文章中我们再具体做介绍,这里就不讲解了。

     

    6 应用层

    应用层做为 TCP/IP 协议的最高层级,对于我们移动开发来说,是接触最多的。

     

    运行在TCP协议上的协议:

    HTTP(Hypertext Transfer Protocol,超文本传输协议),主要用于普通浏览。

    HTTPS(Hypertext Transfer Protocol over Secure Socket Layer, or HTTP over SSL,安全超文本传输协议),HTTP协议的安全版本。

    FTP(File Transfer Protocol,文件传输协议),由名知义,用于文件传输。

    POP3(Post Office Protocol, version 3,邮局协议),收邮件用。

    SMTP(Simple Mail Transfer Protocol,简单邮件传输协议),用来发送电子邮件。

    TELNET(Teletype over the Network,网络电传),通过一个终端(terminal)登陆到网络。

    SSH(Secure Shell,用于替代安全性差的TELNET),用于加密安全登陆用。

    运行在UDP协议上的协议:

    BOOTP(Boot Protocol,启动协议),应用于无盘设备。

    NTP(Network Time Protocol,网络时间协议),用于网络同步。

    DHCP(Dynamic Host Configuration Protocol,动态主机配置协议),动态配置IP地址。

    其他:

    DNS(Domain Name Service,域名服务),用于完成地址查找,邮件转发等工作(运行在TCP和UDP协议上)。

    ECHO(Echo Protocol,回绕协议),用于查错及测量应答时间(运行在TCP和UDP协议上)。

    SNMP(Simple Network Management Protocol,简单网络管理协议),用于网络信息的收集和网络管理。

    ARP(Address Resolution Protocol,地址解析协议),用于动态解析以太网硬件的地址。

     

     

     

     

    2、三次握手

    三次握手涉及到的数据段

    1. 序号seq:TCP连接中每个字节都按顺序编号,seq表示本报文段所发送的数据的第一个字节的序号。
    2. ACK: 置1表示确认号ack有效。TCP连接建立后所有报文段ACK=1。
    3. 确认号ack: 表示期望收到对方下一个报文段的第一个数据字节的序号ack。(同时暗示了序号在ack前的字节成功接收)。
    4. 同步SYN: SYN=1,ACK=0表示一个连接请求报文段(第一次握手)。SYN=1,ACK=1表示这是同意建立连接(第二次握手)

    三次握手流程

    1. A发送(SYN=1,ACK=0)的一个连接请求报文段且不携带数据,seq=x表示该报文所用序号为x。A进入SYN-SENT(同步已发送)状态。
    2. B接收A连接请求报文,发送SYN=1,ACK=1(ack有效)的同意建立连接报文,ack=x+1期望收到A的下一个数据序号为x+1, seq=y表示该报文所用序号为y。B进入SYN-RCVD(同步收到)状态。
    3. A接收到同意连接报文,向B发送ACK=1的确认报文段,ack=y+1期望收到B的下一个数据序号为y+1, seq=x+1表示该报文数据第一个序号为x+1。TCP连接建立成功,A进入ESTABLISHED(已建立连接)状态。
    4. B收到A的确认报文段,进入ESTABLISHED(已建立连接)状态。

    两次握手会有什么问题

    1. A发送第一个连接请求报文x,因为某种原因阻塞了。
    2. x阻塞后超时,A重新发送连接请求报文y,顺利到达B....成功建立TCP连接发送完数据,释放了。
    3. x在上述TCP连接释放后到达B后,B发送同意连接报文给A后(第二次握手),就认为重新建立了TCP连接,一直等待A发送数据,造成B资源浪费。
    4. 三次握手解决思路:3中x到达B后,B需要等A的确认连接(第三次握手)后才认为建立TCP连接。而此时,因为A不需要连接了,所以在接收到B的同意连接报文后舍弃,不会发送确认连接(第三次握手),B在一定时间内没有接收到确认连接,就不会认为连接建立,因此不会造成B资源浪费。

    第三次握手失败后

    当A与B的第三次握手失败了之后,即A发送至B的确认建立连接报文段未能到达B,B在等待A回复ACK的过程中超时了,那么B会向A发送一个RTS报文段并进入关闭状态。 
    即:并不等待A第三次握手的ACK包重传,直接关闭连接请求。 
    这主要是为了防止泛洪攻击,即坏人伪造许多IP向B发送连接请求,从而将B的未连接队列塞满,浪费B的资源。

    三次握手有什么缺陷可以被黑客利用,用来对服务器进行攻击?

    黑客仿造IP大量的向B发送TCP连接请求报文包,从而将B的半连接队列占满,从而使得B拒绝其他正常的连接请求。 
    拒绝服务攻击

    怎么防范上述攻击

    1. 缩短服务器接收客户端SYN报文之后的等待连接时间,即SYN timeout时间,也就是B接收到SYN报文段,到最后放弃此连接请求的超时时间,将SYN timeout设置的更低,便可以成倍的减少B的负荷.但是过低的SYN timeout可能会影响正常的TCP连接的建立,一旦网络不通畅便可能导致A连接请求失败
    2. SYN cookie + SYN proxy 无缝集成(较好的解决方案) 
      1. SYN cookie:当B接收到A的SYN之后,不立即分配资源,而是根据A发送过来的SYN包计算出一个cookie值,这个cookie值用来存储B返回给A的SYN+ACK数据包中的初始序列号,当A返回第三次握手的ACK包之后进行校验,如果校验成功则B分配资源,建立连接。
      2. SYN proxy代理,作为B与A连接的代理,代替B与A建立三次握手的连接,同时SYN proxy与A建立好了三次握手连接之后,确保是正常的TCP连接,而不是TCP泛洪攻击,那么SYN proxy就与B建立三次握手连接,作为代理)来连通A与B。

     

     

    3、四次挥手

    四次挥手涉及到的数据段

    1. 序号seq
    2. ACK
    3. 确认号ack
    4. FIN: FIN=1,表示此报文段的发送方的数据已经发送完毕,要求释放TCP连接

    四次挥手流程

    1. 初始状态A、B处于ESTABLISHED状态
    2. A的数据已经发送完毕,向B发出连接释放报文段(FIN=1第一次挥手),seq=u表示该报文所用序号为u。A进入FIN-WAIT-1(终止等待1)状态,等待B的确认。
    3. B收到A的连接释放报文后,发出确认报文(ACK=1第二次挥手),ack=u+1表示期望收到A的下一个报文序号为u+1,seq=v表示该报文所用序号为v。B进入CLOSE-WAIT(关闭等待)状态。
    4. 此时A已经没有数据要发送给B了,但B仍然可以发送数据给A,所以A仍要接收。
    5. A收到B的确认报文后,进入FIN-WAIT-2(终止等待2)状态,等待B的连接释放报文。
    6. 假设B发送确认报文(ACK=1)后继续向A发送了一些数据,数据发送完毕,想要释放连接了。此时B向A发送连接释放报文(FIN=1, ACK=1第三次挥手),seq=w表示该报文所用序号为w,ack=u+1因为上次A发送的连接释放报文(FIN=1)序号为u。B进入LAST-ACK(最后确认)状态,等待A的确认。
    7. A收到B的连接释放报文后,发出确认报文(ACK=1第四次挥手),seq=u+1, ack=w+1。进入TIME-WAIT。
    8. 此时,TCP连接好没有释放掉,经过2MSL(2个最长报文段寿命)后,进入CLOSED状态,释放掉TCP连接。
    9. B收到A的确认报文后,进入CLOSED状态,释放掉TCP连接,比A早一些(A在等待2MSL)。

    三次挥手会有什么问题

    B向A发送链接释放报文(FIN=1,ACK=1)后直接断开连接,如果A没有收到这个FIN数据包,A就会一直处于FINT-WAIT-2状态

    等待2MSL原因

      1. 若A发送给B的第四次挥手报文丢失,B没有收到,1MSL后B重发第三次挥手,保证再过1MSLA可以收到
      2. 保证在链接阶段所有报文段失效。

     

     

    转载于:https://www.cnblogs.com/cyyz-le/p/11175754.html

    展开全文
  • Qt 之进程间通信(TCP/IP

    千次阅读 2019-12-26 15:59:41
    Qt 之进程间通信(TCP/IP) 原创 ...

    Qt 之进程间通信(TCP/IP)

    简述

    可以通过Qt提供的IPC使用TCP/IP,使用QtNetwork模块即可实现,TCP/IP在实现应用程序和进程内部通信或与远程进程间的通信方面非常有用。

    QtNetwork模块提供的类能够创建基于TCP/IP的客户端与服务端应用程序。为实现底层的网络访问,可以使用QTcpSocket、QTcpServer和QUdpSocket,并提供底层网络类。还提供了使用常规协议实现网络操作的QNetworkRequest、QNetworkReply、QNetworkAccessManager。

    | 版权声明:一去、二三里,未经博主允许不得转载。

    QtNetwork

    作为使用IPC的方法,TCP/IP可以使用多种类进行进程内部和外部的通信。

    QtNetwork模块提供的类:

    说明
    QLocalServer基于服务器的本地套接字的类
    QLocalSocket支持本地套接字的类
    QNetworkAccessManager处理从网络首发收据响应的类
    QSocketNotifier监控从网络通知消息的类
    QSsl在所有网络通信上用于SSL认证的类
    QSslSocket支持通过客户端和服务器端加密的套接字的类
    QTcpServer基于TCP的服务器端类
    QTcpSocketTCP套接字
    QUdpSocketUDP套接字

    除表中所示,Qt提供的QtNetwork模块还支持多种协议。如果需要实现内部进程间的通信,建议使用QLocalSocket类。

    下面我们来看一个示例,可以在Creator自带的示例中查找QLocalSocket或Local Fortune。

    Server

    首先,启动Server,这是必然的,服务端不开启,客户端怎么连接得上呢?

    server = new QLocalServer(this);
    
    // 告诉服务器监听传入连接的名字。如果服务器当前正在监听,那么将返回false。监听成功返回true,否则为false
    if (!server->listen("fortune")) {
        QMessageBox::critical(this, tr("Fortune Server"),
                            tr("Unable to start the server: %1.")
                            .arg(server->errorString()));
        close();
        return;
    }
    
    fortunes << tr("You've been leading a dog's life. Stay off the furniture.")
             << tr("You've got to think about tomorrow.")
             << tr("You will be surprised by a loud noise.")
             << tr("You will feel hungry again in another hour.")
             << tr("You might have mail.")
             << tr("You cannot kill time without injuring eternity.")
             << tr("Computers are not intelligent. They only think they are.");
    
    // 有新客户端进行连接时,发送数据
    connect(server, SIGNAL(newConnection()), this, SLOT(sendFortune()));
    
    // 发送数据
    void Server::sendFortune()
    {
        // 从fortunes中随机取出一段字符串然后进行写入。
        QByteArray block;
        QDataStream out(&block, QIODevice::WriteOnly);
        out.setVersion(QDataStream::Qt_4_0);
        out << (quint16)0;
        out << fortunes.at(qrand() % fortunes.size());
        out.device()->seek(0);
        out << (quint16)(block.size() - sizeof(quint16));
    
        // nextPendingConnection()可以返回下一个挂起的连接作为一个连接的QLocalSocket对象。
        QLocalSocket *clientConnection = server->nextPendingConnection();
        connect(clientConnection, SIGNAL(disconnected()),
                clientConnection, SLOT(deleteLater()));
    
        clientConnection->write(block);
        clientConnection->flush();
        clientConnection->disconnectFromServer();
    }
     
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43

    socket被当做server的孩子创建,这意味着,当QLocalServer对象被销毁时它也会被自动删除。这明显是一个删除对象的好主意,使用完成以后,避免了内存的浪费。

    Client

    启动客户端,连接到对应的服务器,如果连接不上,则进行错误处理。

    socket = new QLocalSocket(this);
    
    connect(getFortuneButton, SIGNAL(clicked()),
            this, SLOT(requestNewFortune()));
    connect(socket, SIGNAL(readyRead()), this, SLOT(readFortune()));
    connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),
            this, SLOT(displayError(QLocalSocket::LocalSocketError)));
    
    // 连接到服务器,abort()断开当前连接,重置socket。
    void Client::requestNewFortune()
    {
        getFortuneButton->setEnabled(false);
        blockSize = 0;
        socket->abort();
        socket->connectToServer(hostLineEdit->text());
    }
    
    // 读取服务器端发送的数据
    void Client::readFortune()
    {
        // 读取接收到的数据
        QDataStream in(socket);
        in.setVersion(QDataStream::Qt_4_0);
    
        if (blockSize == 0) {
            if (socket->bytesAvailable() < (int)sizeof(quint16))
                return;
            in >> blockSize;
        }
    
        if (in.atEnd())
            return;
    
        QString nextFortune;
        in >> nextFortune;
    
        // 如果当前的数据和收到的数据相同,则重新请求一次,因为是随机的字符串,所以肯定不会每次都相同。
        if (nextFortune == currentFortune) {
            QTimer::singleShot(0, this, SLOT(requestNewFortune()));
            return;
        }
    
        currentFortune = nextFortune;
        statusLabel->setText(currentFortune);
        getFortuneButton->setEnabled(true);
    }
    
    // 发生错误时,进行错误处理
    void Client::displayError(QLocalSocket::LocalSocketError socketError)
    {
        switch (socketError) {
        case QLocalSocket::ServerNotFoundError:
            QMessageBox::information(this, tr("Fortune Client"),
                                     tr("The host was not found. Please check the "
                                        "host name and port settings."));
            break;
        case QLocalSocket::ConnectionRefusedError:
            QMessageBox::information(this, tr("Fortune Client"),
                                     tr("The connection was refused by the peer. "
                                        "Make sure the fortune server is running, "
                                        "and check that the host name and port "
                                        "settings are correct."));
            break;
        case QLocalSocket::PeerClosedError:
            break;
        default:
            QMessageBox::information(this, tr("Fortune Client"),
                                     tr("The following error occurred: %1.")
                                     .arg(socket->errorString()));
        }
    
        getFortuneButton->setEnabled(true);
    }
     
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73

    更多参考

    •                     <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                              <use xlink:href="#csdnc-thumbsup"></use>
                          </svg><span class="name">点赞</span>
                          <span class="count">5</span>
                          </a></li>
                          <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                              <use xlink:href="#icon-csdnc-Collection-G"></use>
                          </svg><span class="name">收藏</span></a></li>
                          <li class="tool-item tool-active is-share"><a href="javascript:;"><svg class="icon" aria-hidden="true">
                              <use xlink:href="#icon-csdnc-fenxiang"></use>
                          </svg>分享</a></li>
                          <!--打赏开始-->
                                                  <!--打赏结束-->
                                                  <li class="tool-item tool-more">
                              <a>
                              <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                              </a>
                              <ul class="more-box">
                                  <li class="item"><a class="article-report">文章举报</a></li>
                              </ul>
                          </li>
                                              </ul>
                  </div>
                              </div>
              <div class="person-messagebox">
                  <div class="left-message"><a href="https://blog.csdn.net/u011012932">
                      <img src="https://profile.csdnimg.cn/6/9/A/3_u011012932" class="avatar_pic" username="u011012932">
                                              <img src="https://g.csdnimg.cn/static/user-reg-year/1x/7.png" class="user-years">
                                      </a></div>
                  <div class="middle-message">
                                          <div class="title"><span class="tit"><a href="https://blog.csdn.net/u011012932" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">一去丶二三里</a></span>
                                                      <span class="flag expert">
                                  <a href="https://blog.csdn.net/home/help.html#classicfication" target="_blank">
                                      <svg class="icon" aria-hidden="true">
                                          <use xlink:href="#csdnc-blogexpert"></use>
                                      </svg>
                                      博客专家
                                  </a>
                              </span>
                                              </div>
                      <div class="text"><span>发布了414 篇原创文章</span> · <span>获赞 3930</span> · <span>访问量 571万+</span></div>
                  </div>
                                  <div class="right-message">
                                              <a href="https://bbs.csdn.net/forums/p-u011012932" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-messageboard">他的留言板
                          </a>
                                                              <a class="btn btn-sm attented bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">已关注</a>
                                      </div>
                              </div>
                      </div>
      </article>
      
            <div class="hide-article-box hide-article-pos text-center">
            <a class="btn-readmore" data-report-view="{&quot;mod&quot;:&quot;popu_376&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/liang19890820/article/details/50633819&quot;,&quot;strategy&quot;:&quot;readmore&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_376&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/liang19890820/article/details/50633819&quot;,&quot;strategy&quot;:&quot;readmore&quot;}">
                展开阅读全文
                <svg class="icon chevrondown" aria-hidden="true">
                    <use xlink:href="#csdnc-chevrondown"></use>
                </svg>
            </a>
        </div>
    <script>
    $("#blog_detail_zk_collection").click(function(){
        window.csdn.articleCollection()
    })
    
    还能输入1000个字符
    <div class="comment-list-container">
    	<a id="comments"></a>
    	<div class="comment-list-box" style="max-height: none;"><ul class="comment-list"><li class="comment-line-box d-flex" data-commentid="6046678" data-replyname="res518357">      <a target="_blank" href="https://me.csdn.net/res518357"><img src="https://profile.csdnimg.cn/1/D/2/3_res518357" username="res518357" alt="res518357" class="avatar"></a>        <div class="right-box ">          <div class="new-info-box clearfix">            <a target="_blank" href="https://me.csdn.net/res518357"><span class="name ">cdn_yiqian</span></a><span class="date" title="2016-05-23 22:48:13">3年前</span><span class="floor-num">#2楼</span><span class="new-comment">怎么实现外网和内网通信呢?楼主</span><span class="new-opt-box"><a class="btn btn-link-blue btn-report" data-type="report">举报</a><a class="btn btn-link-blue btn-reply" data-type="reply">回复</a><a class="btn btn-link-blue btn-read-reply" data-type="readreply">查看回复(1)</a></span></div><div class="comment-like " data-commentid="6046678"><svg t="1569296798904" class="icon " viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5522" width="200" height="200"><path d="M726.016 906.666667h-348.586667a118.016 118.016 0 0 1-116.992-107.904l-29.013333-362.666667A117.589333 117.589333 0 0 1 348.458667 309.333333H384c126.549333 0 160-104.661333 160-160 0-51.413333 39.296-88.704 93.397333-88.704 36.906667 0 71.68 18.389333 92.928 49.194667 26.88 39.04 43.178667 111.658667 12.714667 199.509333h95.530667a117.418667 117.418667 0 0 1 115.797333 136.106667l-49.28 308.522667a180.608 180.608 0 0 1-179.072 152.704zM348.458667 373.333333l-4.48 0.170667a53.461333 53.461333 0 0 0-48.768 57.472l29.013333 362.666667c2.218667 27.52 25.6 49.024 53.205333 49.024h348.544a116.949333 116.949333 0 0 0 115.925334-98.816l49.322666-308.736a53.418667 53.418667 0 0 0-52.650666-61.781334h-144.085334a32 32 0 0 1-28.458666-46.634666c45.909333-89.130667 28.885333-155.434667 11.562666-180.522667a48.981333 48.981333 0 0 0-40.192-21.504c-6.912 0-29.397333 1.792-29.397333 24.704 0 111.317333-76.928 224-224 224h-35.541333zM170.624 906.666667a32.042667 32.042667 0 0 1-31.872-29.44l-42.666667-533.333334a32.042667 32.042667 0 0 1 29.354667-34.474666c17.066667-1.408 33.024 11.733333 34.432 29.354666l42.666667 533.333334a32.042667 32.042667 0 0 1-31.914667 34.56z" p-id="5523"></path></svg><span></span></div></div></li><li class="replay-box"><ul class="comment-list"><li class="comment-line-box d-flex" data-commentid="6047257" data-replyname="u011012932">      <a target="_blank" href="https://me.csdn.net/u011012932"><img src="https://profile.csdnimg.cn/6/9/A/3_u011012932" username="u011012932" alt="u011012932" class="avatar"></a>        <div class="right-box reply-box">          <div class="new-info-box clearfix">            <a target="_blank" href="https://me.csdn.net/u011012932"><span class="name mr-8">一去丶二三里</span></a><span class="text">回复</span>  <span class="nick-name">cdn_yiqian</span><span class="date" title="2016-05-24 14:28:24">3年前</span><span class="text"></span><span class="new-comment">通过代理来设置</span><span class="new-opt-box"><a class="btn btn-link-blue btn-report" data-type="report">举报</a><a class="btn btn-link-blue btn-reply" data-type="reply">回复</a></span></div><div class="comment-like " data-commentid="6047257"><svg t="1569296798904" class="icon " viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5522" width="200" height="200"><path d="M726.016 906.666667h-348.586667a118.016 118.016 0 0 1-116.992-107.904l-29.013333-362.666667A117.589333 117.589333 0 0 1 348.458667 309.333333H384c126.549333 0 160-104.661333 160-160 0-51.413333 39.296-88.704 93.397333-88.704 36.906667 0 71.68 18.389333 92.928 49.194667 26.88 39.04 43.178667 111.658667 12.714667 199.509333h95.530667a117.418667 117.418667 0 0 1 115.797333 136.106667l-49.28 308.522667a180.608 180.608 0 0 1-179.072 152.704zM348.458667 373.333333l-4.48 0.170667a53.461333 53.461333 0 0 0-48.768 57.472l29.013333 362.666667c2.218667 27.52 25.6 49.024 53.205333 49.024h348.544a116.949333 116.949333 0 0 0 115.925334-98.816l49.322666-308.736a53.418667 53.418667 0 0 0-52.650666-61.781334h-144.085334a32 32 0 0 1-28.458666-46.634666c45.909333-89.130667 28.885333-155.434667 11.562666-180.522667a48.981333 48.981333 0 0 0-40.192-21.504c-6.912 0-29.397333 1.792-29.397333 24.704 0 111.317333-76.928 224-224 224h-35.541333zM170.624 906.666667a32.042667 32.042667 0 0 1-31.872-29.44l-42.666667-533.333334a32.042667 32.042667 0 0 1 29.354667-34.474666c17.066667-1.408 33.024 11.733333 34.432 29.354666l42.666667 533.333334a32.042667 32.042667 0 0 1-31.914667 34.56z" p-id="5523"></path></svg><span></span></div></div></li></ul></li></ul><ul class="comment-list"><li class="comment-line-box d-flex" data-commentid="5927760" data-replyname="hezf_hero">      <a target="_blank" href="https://me.csdn.net/hezf_hero"><img src="https://profile.csdnimg.cn/D/4/2/3_hezf_hero" username="hezf_hero" alt="hezf_hero" class="avatar"></a>        <div class="right-box ">          <div class="new-info-box clearfix">            <a target="_blank" href="https://me.csdn.net/hezf_hero"><span class="name ">hezf_hero</span></a><span class="date" title="2016-03-11 08:41:50">3年前</span><span class="floor-num">#1楼</span><span class="new-comment">请问博主
    

    QT的CS架构还是基于TCP/IP的靠谱吧?
    一般的通信可以使用json-rpc远程调用,但是传资源的时候还得靠基本的TCP链接
    那么问题来了
    我想传一条完整的信息,包括简单的标题,文字描述,还有图片和一小段视频资源
    这样应该怎么处理呢?单独传的话都是没有问题的
    但是不知道怎么把它们连在一起

    最后感谢博主,才发现这个系列,造福人类啊,在群里公告可以宣传下举报回复查看回复(1)

    展开全文
  • 总结一下`计算机网络`学期课程所学,方便以后的复习和补充。 本文主要是第十一章`TCP/IP传输层和应用层`计算题部分。需要掌握的知识点如下图。 需要手写记录的笔记pdf和课本pdf可私信。
  • TCP/IP摘要

    千次阅读 2017-01-16 12:22:31
    TCP/IP是互联网的基础协议栈,它包括大大小小几十个协议。本篇文章主要涉及到就是HTTP、TCPIP协议。我们经常学的网络模型是七层或者五层,实际上一般认为一共只有四层就可以了。 Application layer ->HTTP --...
  • TCP/IP详解学习笔记(1)-基本概念 原创 2006年04月15日 23:48:00 <ul class="article_tags clearfix csdn-track
  • 内核版本:2.6.12 作者:kendo ... 说明:这仅仅是一个笔记,由于偶的水平有限,我甚至不能保证其中内容正确率超过80%。另外,我不太习惯在代码中注解来自哪个文件,第几行之类的,因为偶...socket并不是TCP/IP协议的一
  • 大话TCP/IP协议之HTTP网络协议(一)

    千次阅读 2014-11-23 15:54:02
    TCP/UDP协议比起来,HTTP协议或许更为大家所熟知,因为大家处处都可以看到http://xxx.com的字样。但是,真正了解HTTP协议的同学,或许只是少数,还有很多人甚至不知道“404”的含义。而本文,正是让大家来更深入的...
  • 一、TCP协议简介 在传输层协议中,UDP是一种没有复杂控制,提供面向无连接通信服务的一种协议,它将部分控制转移给应用程序去处理,自己却只提供作为传输层协议的最基本功能。与UDP不同,TCP则是对传输、发送、通信...
  • Tcp_IP_Track.zip

    2019-06-21 14:42:04
    最近需要研究一个通讯,监视抓包的工具感觉不是很直观,网上找到的工具只能转发却看不到数据包内容,实在忍不了了。代码只能达到能用的层度,发生错误重连的功能暂时没有,也不打算写了,临时用一下而已。...
  • TCP/IP协议

    2017-09-04 22:04:04
    TCP/IP协议笔记 TCP状态转换 reference TCP选项 最大段大小(MSS) 选择确认选项(SACK) 窗口缩放选项 时间戳(TSOPT)与防回绕序列号(PAWS) 几种计时器 时间等待计时器 保活计时器 重传计时器 持久计时器 算法 慢启动 ...
  • TCP/IP is a shorthand for the two most important protocols used to make the Internet work. The Internet Protocol (IP) is responsible for transferring these data packets, while the Transmission Contr
  • The Transmission Control Protocol/Internet Protocol (TCP/IP) is a suite of protocols that governs the way data travels from one device to another. IP is a network layer protocol and provides datagram...
  • 其实把单片机局域网的ip地址和端口号映射到公网就可以啦,可以使用花生壳。 还有,自己家的空调,怎么知道对应的红外协议呢?每一家的空调遥控器使用的发射命令可能都不太一样。这个可以上网搜索一下就有啦!去年还...
  • TCP输入处理是系统中最长的一部分代码,tcp_...当发现分组IP首部中的协议字段是TCP协议时,IP协议的软中断处理函数ipintr调用tcp_input函数进行处理。tcp_input函数我删去了处理URG标志的流程,它的代码如下:/* * ...
  • 最近准备系统学习网络相关的知识,主要学习tcp/ip, websocket 知识。 原文地址:http://www.thegeekstuff.com/2011/11/tcp-ip-fundamentals/ Have you ever wondered how your computer talks to other computers...
  • route TCP/IP index

    千次阅读 2016-05-11 16:16:48
    Routing TCP/IP Index
  • 端口 TCP/IP =PORT NUMBERS

    万次阅读 2009-10-29 08:45:00
    David Nanian 28 September 2007 tcpmux 1/tcp TCP Port Service Multiplexer tcpmux 1/udp TCP Port Service Multiplexer # Mark Lottor compressnet 2/tcp Management Utility compressnet 2/udp Management ...
  • Keep track of the most recent SYN queue overflow time (for each SYN queue, not in a global variable). Don't rebuild missing SYN entries if there hasn't been a recent overflow. This stops ACK ...
  • Linux TCP/IP Tuning for Scalability

    千次阅读 2012-10-18 10:20:30
    net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 1 Connection Tracking The next parameter we looked at was Connection Tracking. This is a side effect of using iptables. Since ...
  • TCP/IP 卷一》笔记、ping和traceroute 的实现思路

    千次阅读 多人点赞 2013-10-21 20:59:57
    一、TCP协议相关笔记 Normally TCP does not send an ACK the instant it receives data. Instead, it delays the ACK, hoping to have data going in the same direction as the ACK, so the ACK can be sent...
  • Linux TCP/IP 协议栈之 Socket的实现分析

    千次阅读 2014-12-31 17:20:00
    Linux TCP/IP 协议栈之 Socket的实现分析(一 套接字的创建)    [size=6]Linux TCP/IP 协议栈之 Socket的实现分析[/size]    内核版本:2.6.12  作者:kendo  版权所有,转载请注明出处[[url]ww
  • ############### 表明该skb应该交由 网络层中哪个协议来处理(TCP/IP) # 该值 由 网卡设备驱动程序填充。 __be16 protocol; void (*destructor)(struct sk_buff *skb); ############### 如果启用连接跟踪...
  • # Justine Higgins cspclmulti 2890/tcp CSPCLMULTIcspclmulti 2890/udp CSPCLMULTI# Yoneda Terumasa cinegrfx-elmd 2891/tcp CINEGRFX-ELMD License Managercinegrfx-elmd 2891/ud
  • Linux TCP/IP协议栈之Socket的实现分析

    千次阅读 2013-01-04 14:45:03
    数据包的接收 作者:kendo ... Kernel:2.6.12 一、从网卡说起 ...这并非是一个网卡驱动分析的专门文档,只是对网卡处理数据包的流程进行一个重点的分析。...大多数网卡都是一个PCI设备,PCI设备都包含了
  • Linux TCP/IP Network Configurati…

    千次阅读 2013-05-24 17:05:11
    Linux TCP/IP Network Configuration Files: File Description /etc/resolve.conf List DNS servers for internet domain name resolution. Manual page for: /etc/resolv.conf /etc/hosts Lists hosts
  • How to troubleshoot TCP/IP connectivity

    千次阅读 2007-09-25 21:15:00
    If your local IP address is returned as 0.0.0.0, the DHCP Media Sensing feature override turned on because the network adapter detected its lack of connection to a network, or TCP/IP detected an IP ...
  • Tcp/Udp端口对照表

    万次阅读 2018-01-22 13:52:56
    Tcp/Udp端口對照 reserved 0/tcp Reserved [JBP] reserved 0/udp Reserved [JBP] tcpmux 1/tcp TCP Port Service Multiplexer [MKL] tcpmux 1/udp TCP Port Service Multiplexer [MKL] compressnet

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 13,668
精华内容 5,467
关键字:

tcp/iptrack