Improving TCPIP Performance over Wireless IEEE 802.11 Link

Improving TCPIP Performance over Wireless IEEE 802.11 Link
Improving TCPIP Performance over Wireless IEEE 802.11 Link

The Performance TCP/IP over wireless IEEE802.11 Link

Milenko Petrovic Mokhtar Aboelaze

Dept. of Computer Science

York University

4700 Keele St.

Toronto, ON. Canada

M3J 1P3

{petrovi, aboelaze}@cs.yorku.ca

Abstract

Cellular phones, wireless laptops, personal portable devices that supports both voice and data access are all examples of communicating devices that uses wireless communication. Sine TCP/IP (and UDP) is the dominant technology in use in the internet, it is expected that they will be used (and they are currently) over wireless connections. In this paper, we investigate the performance of the TCP (and UDP) over IEEE802.11 wireless MAC protocol. We investigate the performance of the TCP and UDP assuming three different traffic patterns. First bulk transmission where the main concern is the throughput. Second real-time audio (using UDP) in the existence of bulk TCP transmission where the main concern is the packet loss for audio traffic. Finally web traffic where the main concern is the response time. We also investigate the effect of using forward Error Correction (FEC) technique and the MAC sublayer parameters on the throughput and response time..

Key Words: IEEE802.11, Wireless MAC, TCP performance, UDP performance

1. Introduction

There is an ever-increasing demand for wireless applications. The current rend in wireless communication is to provide the infrastructure required to support a wide range of emerging and existing applications. These applications range from the traditional file transfer program (ftp), to voice and video communication using cellular phones and personal digital assistants. Also, these applications are no more limited to a run on a PC or a workstation that is connected to a local area network. Wireless terminals are gaining a widespread acceptance for audio transmission (cell phones) as well as interactive applications (web enabled cell phones and PDA devices), which access the wired-line network over a wireless link.

The requirements for these different services are quite diverse. For example ftp like applications require a large bandwidth with error-free transmissions, but there is no requirement for a tight delay bounds. Voice communication on the other hand, can tolerate some data loss without any loss in the perception of the voice signal. However, it requires a tight end-to-end delay.

TCP/IP has been the dominant network technology and for good reasons. TCP is a reliable transport protocol that is fine-tuned in order to provide a good performance over widespread networks with completely different characteristics. The only problem is that TCP is tuned for wire-line networks with its very low error rate. The TCP interprets any packet loss as a sign of congestion not as a result of corrupted packet due to errors. That leads to TCP trying to reduce its transmission rate in order to drain the backlog that caused the congestion. When TCP is used with wireless networks (with its relatively higher error rate) that leads to a system working on a reduced capacity since TCP reduces its transmission rate with each corrupted

In this paper we will concentrate on the DCF mode of operation. In this mode nodes use CSMA/CA to compete in order to transmit. Nodes do have the option of using Request To Send/Clear To Send RTS/CTS in order to avoid the hidden terminal problem. On the other hand nodes may decide to use RTS/CTS only for long packets or not use it at all.

packet thinking it is a congestion rather than error problem.

The main question here is “is TCP a good transport protocol for wireless networks, especially the IEEE802.11?” In this paper, we investigate the performance of TCP (and UDP) over a wireless IEEE802.11 link. Our emphasis her is on two parts, the first is how TCP works under 802.11 in the existence of channel noise. The second is the effect of bulk transmission on interactive traffic. For interactive traffic we choose web traffic (TCP) and audio traffic (UDP). We used the NS [1] simulator to simulate different scenarios.

TCP is one of the most successful protocols in the history of computer networks (albeit a short history). It provides a reliable transport layer connection between two transport layer entities (processes). The TCP protocol adjusts its transmission rate in order to avoid congestion and to recover form the congestion when it happens. It maintains an estimate for the round trip time, and reacts to packet loss (assuming that most losses are due to congestion) by lowering its transmission rate and slowly increases it again in order to fully utilize all the available bandwidth between sender and receiver.

The paper is organized as follows: The next section introduces the IEEE802.11 standard and briefly explains its salient features. And briefly describe the TCP protocol. Section 3 introduces the setup of the network we are simulating and the three different traffic patterns we used. Section 4 introduces the results of our simulation and discusses them. Section 5 is a conclusion and future work.

TCP uses a dynamic window-sizing algorithm in which it maintains an estimate of the current round trip delay. If a packet was not ACKed within a specific time out (that is a function of the round trip time), the packet is considered lost due congestion and it reduces its transmission rate and probe the network in order to reach the network’s maximum capacity. 2. IEEE802.11 and TCP( UDP)

IEEE802.11 [2,3] is a standard that defines the physical and Medium Access Control sublayer (MAC) of a wireless local area network. At the physical layer, it defines the physical interface at three different frequency bands, 1 and 2 Mbps infrared, 1,2,5.5, and 11 Mbps at the 2.4GHz band using direct sequence and frequency hopping spread spectrum. It also uses the 5GHz band and Orthogonal FDM to achieve a transmission rate up to 54Mbps (IEEE802.11a) [4]. At the MAC sublayer, it defines two modes of operation, the first is called Distributed Coordination Function (DCF) that uses an asynchronous, contention based access using CSMA/CA (CA stands for collision avoidance). It also supports the Point Coordination Function (PCF) for a centralized contention free transmission for application that requires a constant bandwidth requirement with delay bound. In the DCF mode, it can use Request to send/Clear to send (RTS/CTS) to minimize the collisions and to deal with hidden terminal problems.

Jacobson in [5] proposed two procedures in order to improve the performance of TCP. The first procedure, known as fast retransmission, which states that if the receiver receives an out of order segment, it must send an ACK for the last in-order segment it received and repeats that with each out of order segment that it receives. If the sender receives 3 duplicates ACK’s it assume that that segment is lost and retransmit it right away.

The second procedure, known as fast recovery, which states that in case of fast retransmission due to 3 duplicate ACK’s, the sender should not reduce its window size to 1 segment, but rather cut the current window in half and proceed with the linear increase. A more detailed discussion can be found in [6]. Due to the high error rate of the wireless links, the TCP does not perform in wireless networks as well as it does in wire-line

We assumed a variation of the Gilbert-Elliott channel model [11,12], in which the state of the channel alternate between good and bad states. The duration of the good period and bad period are exponentially distributed random variable with mean τg and τb respectively. In our simulation we used τg =0.1 sec. and τb =0.0333 sec. The probabilities of bit-error in each of the two states are p g and p b respectively. We used p g =10-6, and p b = 10-2 similar to [13].

networks. Many attempts have been made to modify TCP in order to accommodate wireless links, for a review of some of the methods proposed, see [7] for a comparison between the different techniques.

Improving the TCP throughput on lossy wireless links has been studied extensively, In [8] the authors studied segment size adaptation as a way to overcome the losses on the wireless links. In [9] The authors investigated the performance of TCP over wireless links, however they assumed there are no contention at the MAC sublayer, only noise that may result in error to the frame. The authors in [10] proposed a proxy-based solution for enhancing the performance of TCP/IP over 802.11b network. We investigate three different traffic patterns, first, only bulk transmission is allowed each node has an infinite amount of data to transmit, the main criterion here is the throughput. Next, we assume that we have many web connections and we study the interaction between the web traffic (which is more sporadic than bulk traffic) on the performance. Lastly, we assume that there is one bulk connection and many voice connections. The voice connection is assumed to be UDP. The main point here is the bulk throughput and the delay, jitter, and loss rate of voice packets.

In this paper, we investigate the performance of the TCP and UDP protocols over IEEE802.11 wireless link. We concentrate on the interactions between the different TCP streams and its effect on the performance. We also investigate the access method mechanism in IEEE802.11 and its effect on the TCP performance. Finally, we investigate FEC based error correction on the performance of the TCP.

Then, we investigate the effect of Forward Error Correction (FEC) on the performance. The issue of FEC is extremely important in wireless communication. In bad state, the bit error rate can be as low as 0.01, even with moderate packet size, that is almost a guaranteed frame error. The FEC can be used to recover from errors without the need to retransmit.

3. Simulation setup

Here, we describe the simulation setup; we

are assuming a system where more than one mobile node connected to a base station using IEEE802.11 link with 2Mbps. The base station is connected to the wired network through a 5Mbps kink with a 2 msec. Delay. The 5 Mbps link is dedicated to the traffic originating from the base station. We wanted to study the interaction between the IEEE802.11 and TCP in the existence of errors; we avoided any traffic or congestion originating from outside the base station.

We assume that the channel state is estimated at the receiver, and is feedback to the transmitter. If the channel state is bad , then some sort of error correction coding is used. This technique is similar to the one proposed in [14], however they used a different modulation technique in order to reduce the bit error rate. In our simulation, we use a Reed-Solomon error correcting code. To implement, this code on our simulation, we calculated the overhead due to the parity bits (that basically reduces the efficiency of the wireless channel to 71% of its minimal value, and we calculated a new bit error rate after taking the correction into consideration).

The wireless link is half-duplex and based on the AT&T WaveLan network interface card that implements the IEEE802.11 with a 2Mbps transmission rate and a transmission range of 250 meters. We also assume that mobile nodes at the same distance from the base station, and that each mobile node has a buffer of 50 packets in its network interface.

In the next section, we present results based on simulation using NS [1] and discuss the results and its implication on the performance of TCP and UDP using IEEE802.11 as a link layer model.

4. Simulation Results

Window (in packets) R/F

NR/F

R/NF

NR/NF

Packet size= 100 bytes

1 56.3 91.8 63.1 80.1

2 72.35 92.4 79.2 75.8 5 83.9 95.6 70.9 96.2 10 70.6 97.2 78.8 97.7 Packet size = 200 bytes

1 159 175.7 127 167.3

2 128.2 195.2 158.1 214.1 5 192.4 232.1 184.2 201.1 10 203.1 244.4 153.5 231.9 Packet size 500 bytes

1 225.8 41

2 271.1 370.2 2 301.8 421.1 313.9 358.7 5 303.9 342.5 341 433.1 10 332.2 485.8 336.8 472.8 Packet size = 1000 bytes

1 230.8 585.8 453.6 591.5

2 357 656.8 362.7 599 5 372.6 685.2 343.8 692.6 10 465.4 702.6 227.6 716.4 Packet size = 2000 bytes

1 414.9 610.3 479.8 554.1

2 375.4 649.5 621.2 660.4 5 498 698.7 490.8 615.9 10

566.1 826 359.7 616

In this section, we present the results of

our extensive simulation and discuss them

4.1 Bulk Traffic

First, we investigate transmission of bulk

traffic from one or more connection. The major concern here is the throughput, and the interaction between the retransmission policy of the TCP and the IEEE802.11.

Table 1 shows the total bandwidth in Kbps for a 5 bulk TCP connections using four different cases, first, R/F we used RTS/CTS for every packet transmitted and we used FEC using Reed-Solomon coding The second, NR/F we did not use RTS/CTS and we used FEC for error correction. The third is R/NF we used RTS/CTS for every packet and we did not use FEC, the last one is NR/NF we did not use RTS/CTS and no FEC. We also considered different packet sizes (100, 200, 500, 1000, and 2000 bytes). The maximum window size for TCP is 1,2,5, and 10 packets.

From table 1, we can make some important comments. First, as expected, increasing the packet size and increasing the window size results in a better link utilization. However, one might have expected that using FEC to avoid the high error rate of the wireless link should have a detrimental effect on the system performance. Looking at Table 1, with a packet size of 100 bytes, using FEC actually reduces the system throughput disregarding the use of RTS/CTS While larger packet size (2000 bytes) the use of FEC does improve the system performance.

Table 1: The total throughput of 5 TCP connections

sharing an IEEE802.11 link

Node 1 7.05 53.29 1.25 153.35 Node 2 20.54 71.1 157.11 0.31 Node 3 15.09 56.16 0.63 44.84 Node 4 0 89.42 117.29 44.84 Node 5

13.6

1.18

214.5

10.35

Total 56.3 271.1 490.8 359.7 Packet size

100 500 2000 2000

Window 1 1 5 10 R/F R/F R/NF R/NF R/NF

Another observation is that the use of RTS/CTS results in decrease in the system performance. That could be explained by the relatively small cell size in which all the terminals can hear each other and hence no hidden terminal problem.

Table 2: the throughput of the different nodes and their packet size and window size

However, Table 1 does not tell the whole story, we considered the total throughput that is the number of bits per second delivered to the 5 nodes. One issue to consider here is the fairness. Is the total throughput fairly distributed among all the nodes? There is no room to put the detailed results of our experiment. However, Table 2 shows some of the pathological cases where there are nodes that are almost shut off with a very low throughput, while and the rest of the nodes are sharing the link capacity.

For example in fourth column that describe a system with a 2000 bytes packet, window size of 5 packets, and uses RTS/CTS but no error correction, two nodes are sending/receiving with a rate of 1.25 and 0.63 Kbps, while the other three nodes are sending with a rate of 157,117, and 214 Kbps.

Most of these cases are suing RTS and CTS. In our experiment where each node can hear the rest of the nodes, the use of RTS/CTS degrades the performance and is not needed. However, in other situations where the hidden terminal problem does exist we have to use RTS/CTS and we have to worry about the fairness of the protocol.

3.2 Bulk and Web Traffic

In this section, we assumed 10 web connections competing for the wireless link. For the traffic model, we used the web traffic in NS [1]. The main concern here is the response time. We have conducted simulations with a variable number of nodes, variable TCP packet length, and variable TCP window size. Here we present the results for packet sizes of 100 and 1000 bytes only.

Window Size 1 2 5 10

NORTS/NOFEC 3.85 2.99 1.66 2.68

NORTS/FEC 2.21 2.51

3.99

1.78

RTS/NOFEC 6.33 4.98

9.25

5.44

RTS/FEC 10.53 5.23 9.63 4.60

Table 3: The response time in sec. for 10 nodes, web traffic pattern, and 100 bytes TCP packet size

Table 3 shows the response time for 10 nodes using web traffic pattern for different window size and different combination of FEC and RTS/CTS. From Table 3 we can see that in most cases having the combination of no RTS/CTS and FEC results in the best response time (except with a window size of 5 where no FEC produces the best response time).

Window

Size 1 2 5 10 NORTS/NOFEC 0.92 1.01 0.99 0.99 NORTS/FEC 1.06 1.05 0.87 0.89 RTS/NOFEC 3.92 3.65 3.50 3.87 RTS/FEC 4.39 4.27 3.63 3.55

Table 4: The response time in seconds for 10 nodes, web traffic pattern, and 1000 bytes TCP packet size Table 4 shows the same results as table 3 but with a larger packet size (2000 bytes). Here we can see clearly that RTS/CTS only increase the response time and adding FEC results in improving the performance for larger window size. But as we see in the next section, although a larger window size does increase the throughput of bulk transmission, it might not be the best policy when we have interactive traffic sharing the same link with the bulk traffic. It is obvious that TCP can recover from the error in the wireless link quite properly when there is no other competition in the wire-line link.

3.3 Bulk and Audio Traffic

In this part, we consider also one bulk connection and many voice connections using UDP. The emphasis here is on the delay, jitter, and the loss ratio of audio packets. In this case sine the UDP is not a reliable end-to-end connection, we had to extensively use the error detection/correction. In this paper, we present the results for the packet loss only, for the complete results and discussion, the reader is referred to [15].

The voice nodes are transmitting digitized voice signal. We assume a model where the speaker alternate between talk spurts and silence. The talk spurts and silence are assumed to be exponentially distributed with average of 1.0 and 1.35 sec. respectively [16] During the talk spurt, we assume that digitized voice at 32Kbps is being generated.

For real-time voice transmission, the important performance measure is the end-to-end delay, the rate of lost packets, and the jitter. Studies indicate that 1-2% loss of audio data

doesn’t have an impact on the perception of the audio signal. Besides the lost packets, packets that reach the destination delayed may not be useful anymore and will be thrown away by the receiver and will have the same effect as the lost packets.

Table 5 shows the probability of packet loss vs. the UDP packet size and the window size of the TCP source of a 7 bi-directional voice connections. For the TCP source, we assumed a packet size of 1500 bytes, and a variable window size. The packet loss in this model is due to 2 reasons. First, a packet may be lost because it has exhausted the number of retransmission by the IEEE802.11 and thus thrown away, or because it reached the destination late (more than 0.5 sec. delay) and thus deemed unusable by the destination and thrown away, the data in Table 5 is for the total loss rate. The first row in the table indicates the UDP packet size, the first column indicates the TCP window size in packets for the background traffic (note that the TCP packet size is fixed at 1500 bytes).

Since voice transmission is considered O.K. if the probability of lost packets is 1-2%, from Table 5, we can see that voice transmission using IEEE802.11 DCF is possible only if we used a small packet size (the error is the major problem for larger packet sizes). Also, a small TCP window size is helpful however; even for large window sizes the loss rate is still acceptable for small UDP packet size.

W UDP Packet Size

200 500 600 800 1000

1 0.2% 0.40% 0.2% 0.33% 8.5%

2 0.95% 0.36% 0.28% 0.28% 7.2% 4 0.45% 0.46% 0.29% 0.37% 7.6% 8 1.19% 0.36% 0.46% 0.43% 7.2% 16 1.5% 0.23% 0.41% 0.45% 7.2% 32 1.2% 0.5% 0.38% 0.5% 8.2%

Table 5: The probability of loss of 7 audio connections using UDP in the presence of 1 bulk TCP

connection

From our experiment it is almost impossible to have 7 voice connections with a meaningful loss rate with a UDP packet size more than 800 bytes.

The best results are achieved with a small UDP packet size (200 bytes) and a small window size for the background TCP connection.

A small UDP packet size decreases the efficiency since the UDP and IP headers are constant and don’t depend on the UDP packet size. Also decreasing the window size of the background bulk TCP connection will definitely reduce the bulk traffic throughput as we saw in Table 1. However that could be the best way to share the medium between bulk TCP transmission and real-time voice signals.

5. Conclusion

In this paper we presented an analysis of the performance of TCP and UDP on a wireless link that is connected to a wire-line network. We considered three types of traffic, bulk traffic where each node has an infinite amount of data to transmit and the total throughput and the fairness is the dominant performance measure. Web traffic with requests from the client and response from the server, where the response time is the dominant performance measure. Finally Real-time voice calls in the existence of a background connection of bulk transmission where the loss rate for voice packets is the dominant performance measure. References

[1] VINT project U.C. Berkely/LBNL, bs2:

network simulator, http://www-

https://www.360docs.net/doc/0c17875998.html,/ns 2001

[2] IEEE Std 802.11-1997 Standard for

Wireless LAN Medium Access Control

(MAC) And Physical Layer (PHY)

Specifications, 1997.

[3] IEEE Std 802.11b-1999/Cor 1-2001

Standard for wireless LAN medium access

control (MAC) and physical layer (PHY)

specifications 2001

[4] IEEE Std 802.11a-1999 , 30 Dec. 1999

Supplement to IEEE standard wireless LAN

Medium Access Control (MAC) and

Physical Layer (PHY)

[5] V. Jackobson “Modified TCP Congestion

Avoidence Algorithm” end2end –interest

mailing list, April 1990 Also available at ftp://https://www.360docs.net/doc/0c17875998.html,/email/vanj.90apr30.txt [6] W. R. Stevens “TCP/IP Illustrated, Volume

1”Adison-Wesley, 1994 [7] H. Balakrishnan, V.N. Padmanabhan, S.

Seshan,, and R. H. Katz. “A comparison of mechanisms for improving TCP performance over wireless links”, IEEE/ACM Transactions on Networking , Volume: 5 Issue: 6, Dec. 1997 Page(s): 756 –769 [8] H. Kim, and C. Han “Reducing TCP

Response time in Face of Wireless Uplink Losses”, IEEE International Conference on Communication pp 262-266

[9] H.-K. Shiu, Y.-H. Chang, T.-C Hou, and

C.-S. Wu, “Performance Analysis of TCP over Wireless Link with Dedicated Buffers and Link Level Error Control”,IEEE

International Conference on Communication pp3211-3216, 2001 [10] L. Munoz, M. Garcia, J. Choque, and R.

Aguero, “Optimizing Internet Flows over IEEE802.11b Wirelss Local Area Networks: A Peformance-Enhancing Proxy Based on Forward Error Correction”, IEEE Communication magazine , pp 60-67 Dec. 2001 [11] E. N. Gilbert, “Capacity of a Burst-noise

Channel”, Bell System Technical Journal vol. 39, pp 1253-1265, Sept. 1960. [12] E. O. Elliot, Estimates of Error Rates for

Codes on Burst-noise Channel”, Bell System Technical Journal, vol 42, pp1977-1997, Sept. 1963 [13] J . G. Kim, and M. M. Krunz, “Bandwidth

Allocation in Wireless Networks with Guaranteed packet-Loss Peformance” IEEE/ACM Transactions on Networking , Vol. 8, No. 3, pp 337348 June 2000 [14] V. K. N. Lau; Yu-Kwong Kwok ,

“CHARISMA: a novel channel-adaptive TDMA-based multiple access control protocol for integrated wireless voice and data services” Wireless Communications and Networking Conference WCNC. 2000 Page(s): 507 -511 vol.2, 2000

[15] M. Petrovic, “The Performance of TCP/IP

in Wireless Environment using IEEE802.11 MAC” Master Thesis, Dept .of Computer Science, York University , August 2002. [16] J. Gruber and L. Strawczynski “Subjective

Effects of Variable Delay and Speech Clipping in a Dynamically Managed Voice System” IEEE Transactions on Communication , 1985 COM-33 (8) pp801-808

实验1TCPIP属性设置(参考答案)

实验一TCP/IP属性设置与测试 【一】实验目的 1. 通过实验学习局域网接入Internet时的TCP/IP属性的设置; 2. 掌握ping、ipconfig等命令的使用; 3. 熟悉使用相关命令测试和验证TCP/IP配置的正确性及网络的连通性。 【二】实验要求 1. 设备要求:计算机2台以上(装有Windows 2000/XP/2003操作系统、装有网卡已联网); 2. 分组要求:2人一组,合作完成。 【三】实验预备知识 1. IP地址、子网掩码、默认网关、DNS服务器 (1)IP地址 IP地址(IP Address)就是给每个连接在Internet上的主机分配的一个32bit二进制地址,为了方便人们的使用,IP地址经常被写成十进制的形式,中间使用符号“.”分开不同的字节,IP地址它就像一个人可以合法的在社会上办理银行卡、移动电话等社会活动所需要一个身份证号标识一样。 所有的IP地址都由国际组织NIC(Network Information Center)负责统一分配,目前全世界共有三个这样的网络信息中心:InterNIC(负责美国及其他地区)、ENIC(负责欧洲地区)、APNIC(负责亚太地区),我国申请IP地址要通过APNIC,APNIC的总部设在澳大利亚布里斯班。申请时要考虑申请哪一类的IP地址,然后向国内的代理机构提出。 (2)子网掩码 子网掩码(subnet mask)又叫网络掩码、地址掩码、子网络遮罩,它是一种用来指明一个的哪些位标识的是主机所在的子网以及哪些位标识的是主机的位掩码。子网掩码不能单独存在,它必须结合IP地址一起使用。子网掩码只有一个作用,就是将某个IP地址划分成网络地址和主机地址两部分。 (3)默认网关 默认网关(Default Gateway)是一个可直接到达的IP 路由器的IP 地址,配置默认网关可以在IP 路由表中创建一个默认路径,一台主机可以有多个网关。默认网关的意思是一台主机如果找不到可用的网关,就把数据包发给默认指定的网关,由这个网关来处理数据包,它就好像一所学校有一个大门,我们进出学校必须经过这个大门,这个大门就是我们出入的默认关口。现在主机使用的网关,一般指的是默认网关。一台主机的默认网关是不可以随随便便指定的,必须正确地指定,否则一台主机就会将数据包发给不是网关的主机,从而无法与其他网络的主机通信。 (4)DNS服务器 DNS服务器(Domain Name System或者Domain Name Service) 是域名系统或者域名服务,域名系统为Internet上的主机分配域名地址和IP地址。用户使用域名地址,该系统就会自动把域名地址转为IP地址。域名服务是运行域名系统的Internet工具。执行域名服务的服务器称之为DNS服务器,通过DNS服务器来应答域名服务的查询。TCP/IP属性设置中填入的是DNS服务器的IP地址。 2. Ping命令 Ping命令是最常用的一种网络命令,用于确定本地主机是否能与另一台主机交换(发送与接收)数据报。根据返回的信息,可以推断TCP/IP参数是否设置正确以及运行是否正常。按照缺省设置,Windows上运行的Ping命令发送4个ICMP(互联网控制报文协议)回送请求,每个32字节数据,

网络协议报文格式大集合

可编辑 目录 1 序、 (2) 1.1 协议的概念 (2) 1.2 TCP/IP体系结构 (2) 2 链路层协议报文格式 (2) 2.1 Ethernet报文格式 (2) 2.2 802.1q VLAN数据帧(4字节) (3) 2.3 QinQ帧格式 (4) 2.4 PPP帧格式 (4) 2.5 STP协议格式 (5) 2.5.1 语法 (5) 2.5.2 语义 (6) 2.5.3 时序 (8) 2.6 RSTP消息格式 (9) 2.6.1 语法 (9) 2.6.2 语义 (11) 2.6.3 时序 (13) 3 网络层协议报文 (14) 3.1 IP报文头 (14) 3.2 ARP协议报文 (16) 3.2.1 语法 (16) 3.2.2 语义 (17) 3.2.3 时序 (17) 3.3 VRRP协议报文 (18) 3.3.1 语法 (18) 3.4 BGP协议报文 (19) 3.4.1 语法 (19) 3.4.2 语义 (25)

1 序、 1.1 协议的概念 协议由语法、语义和时序三部分组成: 语法:规定传输数据的格式; 语义:规定所要完成的功能; 时序:规定执行各种操作的条件、顺序关系; 1.2 TCP/IP体系结构 TCP/IP协议分为四层结构,每一层完成特定的功能,包括多个协议。本课程实验中相关协议的层次分布如附图3-1所示。 图1-1TCP/IP协议层次 这些协议之间的PDU封装并不是严格按照低层PDU封装高层PDU的方式进行的,附图3-2显示了Ethernet帧、ARP分组、IP分组、ICMP报文、TCP报文段、UDP数据报、RIP报文、OSPF报文和FTP报文之间的封装关系。 图1-2各协议PDU间的封装关系 2 链路层协议报文格式 2.1 Ethernet报文格式 最新的IEEE 802.3标准(2002年)中定义Ethernet帧格式如下:

实验六TCP报文段的格式及协议分析

实验六TCP报文段的格式及协议分析 【实验目的】 1、分析TCP报文段的格式; 2、了解TCP报文段首部结构以及各个字段的内容及其作用; 3、通过观察TCP协议的交互掌握TCP连接建立、数据传输、连接释放的过程。 【实验内容】 1、分析TCP报文段的结构,熟悉各个字段的内容、功能、格式和取值范围; 2、编辑TCP报文段首部各字段的内容; 3、单个或批量发送已经编辑好的TCP报文段; 4、分析TCP协议的交互过程。 【实验原理】 TCP TCP 序号:占4 字段的值指的是本报文段所发送的数据的第一个字节的序号。 确认号:占4个字节,是期望收到对方下一个报文段的数据的第一个字节的序号。 数据偏移:占4 bit,它指出报文段的数据起始处距离TCP报文段的起始处有多远。实际上就是TCP报文段首部的长度。 保留:占6 bit,保留为今后使用。 紧急比特URG:当URG=1时,表明紧急指针有效。它告诉系统报文段中有紧急数据,应尽快传送。

确认比特ACK:ACK=1时确认号字段才有效,ACK=0时确认号字段无效。 推送比特PUSH:接收方接收到PUSH=1的报文段时会尽快的将其交付给接收应用进程,而不再等到整个接收缓存都填满后再向上交付。 复位比特RST:当RST=1时,表明TCP连接中出现严重差错,必须释放连接。复位比特还用来拒绝一个非法的报文段或拒绝打开一个连接。 同步比特SYN:在连接建立时用来同步序号。当SYN=1而ACK=0时,表明这是一个连接请求报文段。对方若同意建立连接,应在响应的报文段中使SYN=1和ACK=1。因此,SYN=1就表示这是一个连接请求或连接接收报文。 终止比特FIN:当FIN=1时,表明此报文段的发送端的数据已发送完毕,并要求释放运输连接。 窗口:占2个字节,用来控制对方发送的数据量,单位是字节,指明对方发送窗口的上限。校验和:占2个字节,校验的范围包括首部和数据两个部分,计算校验和时需要在报文段前加上12字节的伪首部。 紧急指针:占2个字节,指出本报文段中紧急数据最后一个字节的序号。只有当紧急比特URG=1时才有效。 选项:长度可变。TCP只规定了一种选项,即最大报文段长度MSS (Maximum Segment Size)。

实验二--配置TCPIP协议

实验二配置TCP/IP协议 专业班级学号姓名 实验学时2实验类型验证性实验地点数计学院实验中心实验时间指导老师 实验成绩 年月日 一、实验目的 了解TCP/IP协议的工作原理; 掌握TCP/IP协议的安装及配置方法; 掌握常用的TCP/IP网络故障诊断和排除方法; 二、实验环境 多台装有Windows 2008 Server的计算机。 三、实验内容及步骤 1、安装TCP/IP协议 控制面板—>网络连接—>本地连接—>右键调出属性面板—>添加—>协议—>选择 TCP/IP协议—>开始安装 2、设置TCP/IP协议 右击网上邻居—>属性—>右击本地连接—>属性—>选择TCP/IP协议—>属性 设置IP地址:机器号+10 设置子网掩码:设置默认网关:设置DNS服务器:、常用网络测试命令的使用 (1)Ping Ping是测试网络联接状况以及信息包发送和接收状况非常有用的工具,是网络测试最 常用的命令。Ping向目标主机(地址)发送一个回送请求数据包,要求目标主机收到请求后给 予答复,从而判断网络的响应时间和本机是否与目标主机(地址)联通。 如果执行Ping不成功,则可以预测故障出现在以下几个方面:网线故障,网络适配器 配置不正确,IP地址不正确。如果执行Ping成功而网络仍无法使用,那么问题很可能出在 网络系统的软件配置方面,Ping成功只能保证本机与目标主机间存在一条连通的物理路径。 命令格式: 参数含义: -t不停地向目标主机发送数据;直到用户按ctrl+c结束

-a 以IP地址格式来显示目标主机的网络地址; -n count 指定要Ping多少次,具体次数由count来指定; -l size 指定发送到目标主机的数据包的大小。 ①测试本机TCP/IP协议安装配置是否成功 PING127.0.0.1 这个Ping命令被送到本地计算机的IP软件,如果此测试不能通过,就表示TCP/IP的安装或配置存在问题。 ②PING 本机IP 这个命令被送到我们计算机所配置的IP地址,我们的计算机始终都应该对该Ping命令作出应答,如果没有,则表示本地配置或安装存在问题。出现此问题时,局域网用户请断开网络电缆,然后重新发送该命令。如果网线断开后本命令正确,则表示另一台计算机可能配置了相同的IP地址。 ③ PING 局域网内其他IP 这个命令应该离开我们的计算机,经过网卡及网络电缆到达其他计算机,再返回。收到回送应答表明本地网络中的网卡和载体运行正确。但如果收到0个回送应答,那么表示子网掩码(进行子网分割时,将IP地址的网络部分与主机部分分开的代码)不正确或网卡配置错误或电缆系统有问题。 ④PING 网关IP 这个命令如果应答正确,表示局域网中的网关路由器正在运行并能够作出应答。 ⑤PING LOCALHOST LOCALHOST是一个操作系统的网络保留名,它是的别名,每台计算机都应该能够将该名字转换成该地址。如果没有做到这一点,则表示主机文件(/Windows/host)中存在问题。 (2)ipconfig 使用ipconfig /all 查看配置。 发现和解决TCP/IP 网络问题时,先检查出现问题的计算机上的TCP/IP 配置。可以使用ipconfig 命令获得主机配置信息,包括IP 地址、子网掩码和默认网关。 注意:对于Windows 95 和Windows 98 的客户机,请使用winipcfg 命令而不是ipconfig 命令。使用带/all 选项的ipconfig 命令时,将给出所有接口的详细配置报告,包括任何已配置的串行端口。使用ipconfig /all,可以将命令输出重定向到某个文件,并将输出粘贴到其他文档中。也可以用该输出确认网络上每台计算机的TCP/IP 配置,或者进一步

TCPIP协议格式

通过连接实例解读TCP/IP协议 最近狂补基础,猛看TCP/IP协议。不过,书上的东西太抽象了,没有什么数据实例,看了不久就忘了。于是,搬来一个sniffer,抓了数据包来看,呵呵,结合书里面得讲解,理解得比较快。我就来灌点基础知识。 开始吧,先介绍IP协议。 IP协议(Internet Protocol)是网络层协议,用在因特网上,TCP,UDP,ICMP,IGMP数据都是按照IP数据格式发送得。IP协议提供的是不可靠无连接得服务。IP数据包由一个头部和一个正文部分构成。正文主要是传输的数据,我们主要来理解头部数据,可以从其理解到IP协议。 IP数据包头部格式(RFC791) Example Internet Datagram Header 上面的就是IP数据的头部格式,这里大概地介绍一下。 IP头部由20字节的固定长度和一个可选任意长度部分构成,以大段点机次序传送,从左到右。 TCP协议 TCP协议(TRANSMISSION CONTROL PROTOCOL)是传输层协议,为应用层提供服务,和UDP不同的是,TCP协议提供的可靠的面向连接的服务。在RFC793中是基本的TCP描述。关于TCP协议的头部格式内容的说明: TCP Header FORMat

TCP Header FORMat 跟IP头部差不多,基本的长度也是20字节。TCP数据包是包含在一个IP数据报文中的。 好了,简单介绍到此为止。来看看我捕获的例子吧。这是一次FTP的连接,呵呵,是cuteftp默认的cuteftp的FTP站点,IP地址是:216.3.226.21。我的IP地址假设为:192.168.1.1。下面的数据就是TCO/IP连接过程中的数据传输。我们可以分析TCP/IP协议数据格式以及TCP/IP连接的三次握手 (ThreeWay-Handshake)情况。下面的这些十六进制数据只是TCP/IP协议的数据,不是完整的网络通讯数据。 第一次,我向FTP站点发送连接请求(我把TCP数据的可选部分去掉了) 192.168.1.1->216.3.226.21 IP头部: 45 00 00 30 52 52 40 00 80 06 2c 23 c0 a8 01 01 d8 03 e2 15 TCP头部:0d 28 00 15 50 5f a9 06 00 00 00 00 70 02 40 00 c0 29 00 00 来看看IP头部的数据是些什么。 第一字节,“45”,其中“4”是IP协议的版本(Version),说明是IP4。“5”是IHL位,表示IP头部的长度,是一个4bit字段,最大就是1111了,值为12,IP头部的最大长度就是60字节。而这里为“5”,说明是20字节,这是标准的IP头部长度,头部报文中没有发送可选部分数据。 接下来的一个字节“00”是服务类型(Type of Service)。这个8bit字段由 3bit的优先权子字段(现在已经被忽略),4 bit的TOS子字段以及1 bit的未用字段(现在为0)构成.4 bit的TOS子字段包含:最小延时、最大吞吐量、最高可靠性以及最小费用构成,这四个1bit位最多只能有一个为1,本例中都为0,表示是一般服务。 接着的两个字节“00 30”是IP数据报文总长,包含头部以及数据,这里表示48字节。这48字节由20字节的IP头部以及28字节的TCP头构成(本来截取的TCP头应该是28字节的,其中8字节为可选部分,被我省去了)。因此目前最大的IP数据包长度是65535字节。 再是两个字节的标志位(Identification):“5252”,转换为十进制就是21074。这个是让目的主机来判断新来的分段属于哪个分组。 下一个字节“40”,转换为二进制就是“0100 0000”,其中第一位是IP协议目前没有用上的,为0。接着的是两个标志DF和MF。DF为1表示不要分段,MF

项目8 tcp、ip网络接口的配置

实训项目8 tcp、ip网络接口的配置 一、实训目的 掌握Linux下TCP/IP网络的配置方法 学会使用网络命令检测网络配置 学会启用和禁用系统服务 二、项目背景 某企业新增了Linux服务器,在但还没有配置TCP/IP网络参数,请设置好各项TCP/IP参数,并连通网络。 三、实训内容 练习Linux系统下TCP/IP网络设置、网络检测方法。 四、实训步骤 子项目1 设置IP地址以及子网掩码 查看网络接口eth0的配置信息 为此网络接口设置IP地址,广播地址,子网掩码,并启动此网络接口。利用ifconfig命令查看系统中已经启动的网络接口。仔细观察看到的现象。记录启动的网络接口. 子项目2,设置网关和主机名 显示系统的路由设置 设置默认路由。并再次显示系统的路由设置。确定设置成功 显示当前的主机名设置:并以自己姓名的缩写重新设置主机名。再次显示当前的主机名设置。确认修改成功 修改文件。让主机名永久生效 子项目3 网络设置监测 Ping网关的IP地址。监测网络是否连通 用netstat命令显示系统核心路由表 用netstat 命令查看系统开启的TCP端口 子项目4 设置域名解析 编辑/etc/hosts文件,加入要进行静态域名解析的主机的IP地址和域名 Host文件优先于dns服务器。可以查看、etc/host.conf文件 用ping命令检测上面设置好的网关的域名。测试静态域名解析是否成功

编辑/etc/resolv.conf文件,加入域名服务器的IP地址,设置动态域名解析 编辑/etc/resolv.conf文件,设置域名解析顺序为:host,bind。 用nslookup命令查询一个网络地址对应的IP地址。测试域名解析的设置。 子项目5 启动和停止守护进程 用sevice 命令查看守护进程sshd的状态 如果显示sshd处于停用状态,可以试着用ssh命令来连接本地系统,看看是否真的无法登录 然后用service命令启动sshd ,再用ssh命令连接本地系统。看看sshd服务是否真的已经启动 用ntsysv 命令设置sshd在系统启动时自动启动 用service命令停止sshd守护进程 五.实训思考题 1.当无法连接远程主机的时候,例如,用telnet命令无法连接到远程主机https://www.360docs.net/doc/0c17875998.html,.此时应该按什么顺序。用什么方法。分别检测系统中的那些位置? 2.静态域名解析和动态域名解析有什么区别?分别在哪些文件里面进行设置?系统如何决定用哪种方式对一个域名进行解析? 3.利用ifconfig和route命令配置ip地址,子网掩码和默认网关等信息和利用netcofig以及编辑/etc/syscofig/network-scripts/if-eth0文件配置的ip地址,子网掩码和默认网关等信息有什么不同? 六、实训报告要求 实训目的 实训内容 实训步骤 实训中的问题及解决方法 回答实训思考题 实训心得体会 建议与意见 .

计算机网络使用网络协议分析器捕捉和分析协议数据包样本

计算机网络使用网络协议分析器捕捉和分析协议数据包样 本 计算机网络使用网络协议分析器捕捉和分析协议数据包广州大学学生实验报告开课学院及实验室:计算机科学与工程实验室11月月28日学院计算机科学与教育软件学院年级//专业//班姓名学号实验课程名称计算机网络实验成绩实验项目名称使用网络协议分析器捕捉和分析协议数据包指导老师熊伟 一、实验目的 (1)熟悉ethereal的使用 (2)验证各种协议数据包格式 (3)学会捕捉并分析各种数据包。 本文档所提供的信息仅供参考之用,不能作为科学依据,请勿模仿。 文档如有不当之处,请联系本人或网站删除。 二、实验环境1.MacBook Pro2.Mac OS3..Wireshark 三、实验内容,验证数据帧、IP数据报、TCP数据段的报文格式。 ,,分析结果各参数的意义。 器,分析跟踪的路由器IP是哪个接口的。 对协议包进行分析说明,依据不同阶段的协议出分析,画出FTP 工作过程的示意图a..地址解析ARP协议执行过程b.FTP控制连接建立过程c.FTP用户登录身份验证过程本文档所提供的信息仅供参考之用,不能作为科学依据,请勿模仿。

文档如有不当之处,请联系本人或网站删除。 d.FTP数据连接建立过程 e.FTP数据传输过程 f.FTP连接释放过程(包括数据连接和控制连接),回答以下问题:a..当访问某个主页时,从应用层到网络层,用到了哪些协议?b.对于用户请求的百度主页(),客户端将接收到几个应答报文??具体是哪几个??假设从是本地主机到该页面的往返时间是RTT,那么从请求该主页开始到浏览器上出现完整页面,一共经过多长时间??c.两个存放在同一个服务器中的截然不同的b Web页(例如,,和d.假定一个超链接从一个万维网文档链接到另一个万维网文档,由于万维网文档上出现了差错而使超链接指向一个无效的计算机名,这时浏览器将向用户报告什么?e.当点击一个万维网文档时,若该文档除了次有文本外,,那么需要建立几次TCP连接和个有几个UDP过程?本文档所提供的信息仅供参考之用,不能作为科学依据,请勿模仿。 文档如有不当之处,请联系本人或网站删除。 析,分析ARP攻击机制。 (选做),事实上,TCP开始发送数据时,使用了慢启动。 利察用网络监视器观察TCP的传输和确认。 在每一确认到达之后,慢启动过程中发生了什么?(选做),,TCP 必须准备重发初始段(用于打开一个连接的一个段)。 TCP应等多久才重发这一段?TCP应重发多少次才能宣布它不能打开一个连接?为找到结果尝试向一个不存在的地址打开一个连接,并使用网络监视器观察TCP的通信量。

TCP端口设置

TCP端口(静态端口) TCP 0= Reserved TCP 1=TCP Port Service Multiplexer TCP 2=Death TCP 5=Remote Job Entry,yoyo TCP 7=Echo TCP 11=Skun TCP 12=Bomber TCP 16=Skun TCP 17=Skun TCP 18=消息传输协议,skun TCP 19=Skun TCP 20=FTP Data,Amanda TCP 21=文件传输,Back Construction,Blade Runner,Doly Trojan,Fore,FTP trojan,Invisible FTP,Larva, WebEx,WinCrash TCP 22=远程登录协议 TCP 23=远程登录(Telnet),Tiny Telnet Server (= TTS) TCP 25=电子邮件(SMTP),Ajan,Antigen,Email Password Sender,Happy 99,Kuang2,ProMail trojan,Shtrilitz,Stealth,Tapiras,Terminator,WinPC,WinSpy,Haebu Coceda TCP 27=Assasin TCP 28=Amanda TCP 29=MSG ICP TCP 30=Agent 40421 TCP 31=Agent 31,Hackers Paradise,Masters Paradise,Agent 40421 TCP 37=Time,ADM worm TCP 39=SubSARI TCP 41=DeepThroat,Foreplay TCP 42=Host Name Server TCP 43=WHOIS TCP 44=Arctic TCP 48=DRAT TCP 49=主机登录协议 TCP 50=DRAT TCP 51=IMP Logical Address Maintenance,Fuck Lamers Backdoor TCP 52=MuSka52,Skun

基于tcpip协议的Modbus

基于tcp/ip协议的modbus 业以太网与Modbus TCP/IP 一以太网的标准 以太网是一种局域网。早期标准为IEEE802.3,数据链路层使用CSMA/CD,10Mb/s 速度物理层有: (1)10Base5粗同轴电缆,RG-8,一段最长为500m; (2)10Base2细同轴电缆,RG-58,一段最长为185m; (3)10Base T双绞线,UTP或STP,一段最长为100m。 快速以太网为100Mb/s,标准为802.3a,介质为100Base Tx双绞线、100Base Fx光纤。 目前10/100M以太网使用最为普遍,很多企事业用户已实现100M到以太网桌面,确实体验到高速“冲浪”的快感,另外从距离而言,非屏蔽双绞线(UTP)为100m,多模光纤可达2~3km,单模光纤可大于100km。千兆以太网1000Mb/s为802.3z/802.3ab,万兆以太网10Gb/s 为802.3ae,将为新一轮以太网的发展带来新的机遇与冲击。 二工业以太网与商用以太网的区别 什么是工业以太网?技术上,它与IEEE802.3兼容,故从逻辑上可把商用网和工业网看成是一个以太网,而用户可根据现场情况,灵活装配自己的网络部件,但从工业环境的恶劣和抗干扰的要求,设计者希望采用市场上可找到的以太网芯片和媒介,兼顾考虑下述工业现场的特殊要求:首先要考虑高温、潮湿、振动;二是对工业抗电磁干扰和抗辐射有一定要求,如满足EN50081-2、EN50082-2标准,而办公室级别的产品未经这些工业标准测试,表1列出了一些常用工业标准。为改善抗干扰性和降低辐射,工业以太网产品多使用多层线路板或双面电路板,且外壳采用金属如铸铝屏蔽干扰;三是电源要求,因集线器、交换机、收发器多为有源部件,而现场电源的品质又较差,故常采用双路直流电或交流电为其供电,另外考虑方便安装,工业以太网产品多数使用DIN导轨或面板安装;四是通信介质选择,在办公室环境下多数配线使用UTP,而在工业环境下推荐用户使用STP(带屏蔽双绞线)和光纤。

配置tcpip参数的操作主要包括三个方面

配置TCP/IP参数的操作主要包括三个方面:(),指定网关和域名服务器地址。 A、指定计算机的IP地址和子网掩码 B、指定计算机的主机名 C、指定代理服务器 D、指定服务器的IP地址 正确答案 A 答案分析 [分析]使用静态IP地址时,请指定IP地址、子网掩码、网关和域名服务器地址。 TCP/IP(Transmission Control Protocol/internetprotocol)是一种能够实现不同网络间信息传输的协议簇。TCP/IP协议不仅指TCP和IP,还指由FTP、SMTP、TCP、UDP、IP等协议组成的协议簇。由于TCP和IP是TCP/IP中最具代表性的两种协议,因此被称为TCP/IP 协议。

TCP/IP传输协议,即传输控制/网络协议,又称网络通信协议。它是网络应用中最基本的通信协议。TCP/IP传输协议规定了Internet各部分之间通信的标准和方法。另外,TCP/IP传输协议是为了保证网络数据和信息的及时、完整的传输。严格来说,TCP/IP是一个四层体系结构,包括应用层、传输层、网络层和数据链路层。[2] TCP/IP是Internet上最基本的协议。应用层的主要协议有Telnet、FTP、SMTP等,用于根据不同的传输层从传输层接收数据或向传输层传输数据。传输层的主要协议是UDP和TCP,它们是用户平台和计算机信息网络的内部数据,可以实现数据传输和数据共享。IP和IGMP主要负责网络中数据包的传输,网络层的主要协议是ICMP。网络接入层又称网络接口层或数据链路层,主要包括ARP和RARP协议。其主要功能是提供链路管理错误检测,有效处理与不同信息相关的详细信息通信媒介。

TCPIP等协议报文格式

TCP/IP等协议报文格式 应用层(Application) HTTP、Telnet、FTP、SNMP、SMTP 传输层(transport) TCP、UDP 网间层(Internet) IP-ARP、RARP、ICMP 网络接口层(NETwork)Ethernet、X.25、SLIP、PPP 以太网数据报文封装格式 TCP报文 TCP数据区 TCP IP报文 IP数据区 IP 帧头 帧数据区

ETH 前导 目的地址 源地址 帧类型 数据 CRC 长度 8 6 6 2 46~1500 4 用户填充数据60~1514 8字节前导用于帧同步,CRC用于帧校验,此2类数据可由网卡芯片自动添加。目的地址和源地址是指网卡的物理地址,即MAC地址,多数情况下具有唯一性。帧类型或协议类型——0X0806为ARP协议,0X0800为IP协议。 ARP/RARP (地址解析/反向地址解析)报文格式 0~7

8~15 16~23 24~31 硬件协议 协议类型 硬件地址长度 协议地址长度 操作 发送者硬件地址(字节0~3) 发送者硬件地址(字节4~5) 发送者IP地址(字节0~1) 发送者IP地址(字节2~3) 目的硬件地址(字节0~1) 目的硬件地址(字节2~5) 目的IP地址(字节0~3) 硬件类型——发送者本机网络接口类型(以太网=1) 协议类型——发送者所提供/请求的高级协议地址类型(IP协议=0x0800)操作——ARP请求=1,ARP响应=2,RARP请求=3,RARP响应=4

IP数据报头格式如下表0~3 4~7 8~11 12~15 16~18 19~31 4位 版本 4位 包头长度 8位 服务类型(TOS) 16位 总长度 16位 标识号(ID号) 3位 Flag 13位 片偏移 8位 生存时间 8位 协议类型 16位

TCP报文段的格式与协议分析

实验六TCP 报文段的格式及协议分析 【实验目的】 1、分析 TCP 报文段的格式; 2、了解 TCP 报文段首部结构以及各个字段的内容及其作用; 3、通过观察 TCP 协议的交互掌握TCP 连接建立、数据传输、连接释放的过程。 【实验内容】 1、分析 TCP 报文段的结构,熟悉各个字段的内容、功能、格式和取值范围; 2、编辑 TCP 报文段首部各字段的内容; 3、单个或批量发送已经编辑好的TCP 报文段; 4、分析 TCP 协议的交互过程。 【实验原理】 TCP 是 TCP/IP 体系中面向连接的运输层协议,提供全双工的和可靠交付的服务。TCP 报文段的格式如下图所示: 32 bit 源端口目的端口 TCP 首部数据 偏移 序号 确认号20 字节保留 U A P R S F 窗口 R C S S Y I G K HTNN 检验和紧急指针 选项和填充 数据 源端口和目的端口:各占 2 个字节,是运输层与应用层的服务接口。 序号:占 4 个字节。 TCP 连接传送的数据流中的每一个字节都被编上一个序号。首部中序 号字段的值指的是本报文段所发送的数据的第一个字节的序号。 确认号:占 4 个字节,是期望收到对方下一个报文段的数据的第一个字节的序号。 数据偏移:占 4 bit,它指出报文段的数据起始处距离TCP 报文段的起始处有多远。实际上 就是 TCP 报文段首部的长度。 保留:占 6 bit ,保留为今后使用。 紧急比特 URG :当 URG=1 时,表明紧急指针有效。它告诉系统报文段中有紧急数据,应尽快传送。

确认比特 ACK :ACK=1 时确认号字段才有效, ACK=0 时确认号字段无效。 推送比特 PUSH :接收方接收到 PUSH=1 的报文段时会尽快的将其交付给接收应用进程, 而 不再等到整个接收缓存都填满后再向上交付。 复位比特 RST :当 RST=1 时,表明 TCP 连接中出现严重差错,必须释放连接。复位比特还 用来拒绝一个非法的报文段或拒绝打开一个连接。 同步比特 SYN :在连接建立时用来同步序号。当 SYN=1 而 ACK=0 时,表明这是一个连接 请求报文段。 对方若同意建立连接, 应在响应的报文段中使 SYN=1 和 ACK=1 。因此,SYN=1 就表示这是一个连接请求或连接接收报文。 终止比特 FIN :当 FIN=1 时,表明此报文段的发送端的数据已发送完毕, 并要求释放运输连 接。 窗口:占 2 个字节,用来控制对方发送的数据量,单位是字节,指明对方发送窗口的上限。 校验和: 占 2 个字节, 校验的范围包括首部和数据两个部分, 计算校验和时需要在报文段前 加上 12 字节的伪首部。 紧急指针:占 2 个字节,指出本报文段中紧急数据最后一个字节的序号。只有当紧急比特 URG=1 时才有效。 选项:长度可变。 TCP 只规定了一种选项, 即最大报文段长度 MSS (Maximum Segment Size) 。 TCP 连接建立的过程如下图所示: 主机 A 主机 B 主动打开 SY N , S EQ = x 被动打开 SYN , S E Q = y , A CK = x 1 确认 确认 A CK = y 1 TCP 连接释放的过程如下图所示: 主机 A 主机 B 应用进程 F IN , SEQ = x 通知主机 释放连接 应用进程 A C K = x 1 FIN , SEQ = y , A CK = x + 1 应用进程 释放连接 A CK = y 1

配置tcpip参数的操作主要包括三个方面

配置tcpip参数的操作主要包括三个方面 操作系统上端口号1024以下是系统保留的,从1024-65535是用户使用的。由于每个TCP连接都要占一个端口号,所以我们最多可以有60000多个并发连接。我想有这种错误思路朋友不在少数吧?(其中我过去就一直这么认为) 我们来分析一下吧 如何标识一个TCP连接:系统用一个4四元组来唯一标识一个TCP 连接:{local ip, local port,remoteip,remoteport}。好吧,我们拿出《UNIX网络编程:卷一》第四章中对accept的讲解来看看概念性的东西,第二个参数cliaddr代表了客户端的ip地址和端口号。而我们作为服务端实际只使用了bind时这一个端口,说明端口号65535并不是并发量的限制。 server最大tcp连接数:server通常固定在某个本地端口上监听,等待client的连接请求。不考虑地址重用(unix的SO_REUSEADDR 选项)的情况下,即使server端有多个ip,本地监听端口也是独占的,因此server端tcp连接4元组中只有remoteip(也就是client ip)和remoteport(客户端port)是可变的,因此最大tcp连接为客户端ip数×客户端port数,对IPV4,不考虑ip地址分类等因素,最大tcp连接数约为2的32次方(ip数)×2的16次方(port数),

也就是server端单机最大tcp连接数约为2的48次方。 要写网络程序就必须用Socket,这是程序员都知道的。而且,面试的时候,我们也会问对方会不会Socket编程?一般来说,很多人都会说,Socket编程基本就是listen,accept以及send,write等几个基本的操作。是的,就跟常见的文件操作一样,只要写过就一定知道。 对于网络编程,我们也言必称TCP/IP,似乎其它网络协议已经不存在了。对于TCP/IP,我们还知道TCP和UDP,前者可以保证数据的正确和可靠性,后者则允许数据丢失。最后,我们还知道,在建立连接前,必须知道对方的IP地址和端口号。除此,普通的程序员就不会知道太多了,很多时候这些知识已经够用了。最多,写服务程序的时候,会使用多线程来处理并发访问。 我们还知道如下几个事实: 1。一个指定的端口号不能被多个程序共用。比如,如果IIS占用了80端口,那么Apache就不能也用80端口了。

常见网络协议报文格式汇总

附件:报文格式 1.1Ethernet数据包格式(RFC894) 1、DstMac的最高字节的最低BIT位如果为1,表明此包是以太网组播/广播包, 送给CPU处理。 2、将DstMac和本端口的MAC进行比较,如果不一致就丢弃。 3、获取以太网类型字段Type/Length。 0x0800→IP 继续进行3层的IP包处理。 0x0806→ARP 送给CPU处理。 0x8035→RARP 送给CPU处理。 0x8863→PPPoE discovery stage 送给CPU处理。 0x8864→PPPoE session stage 继续进行PPP的2层包处理。 0x8100→VLAN 其它值当作未识别包类型而丢弃。 1.2PPP数据包格式 1、获取PPP包类型字段。 0x0021→IP 继续进行3层的IP包处理。 0x8021→IPCP 送给CPU处理。 0xC021→LCP 送给CPU处理。 0xc023→PAP 送给CPU处理。 0xc025→LQR 送给CPU处理。 0xc223→CHAP 送给CPU处理。 0x8023→OSICP 送给CPU处理。 0x0023→OSI 送给CPU处理。 其它值当作未识别包类型而丢弃。

1.3 ARP 报文格式(RFC826) |←----以太网首部---->|←---------28字节ARP 请求/应答 ------ 1.4 IP 报文格式(RFC791)(20bytes) TOS 1.5 PING 报文格式(需IP 封装)(8bytes) 1.6 TCP 报文格式(需IP 封装)(20bytes)

紧急指针有效 ACK 确认序号有效 PSH 接收方应该尽快将这个报文交给应用层 RST 重建连接 SYN 同步序号用来发起一个连接 FIN 发端完成发送认务 1.7 UDP 报文格式(需IP 封装)(8bytes) 1.8 MPLS 报文格式 MPLS 报文类型: 以太网中 0x8847(单播) 0x8848(组播) PPP 类型上 0x8281(MPLSCP)

配置TCPIP协议(精华版)

实验一配置TCP/IP协议 一、 1、了解TCP/IP协议的工作原理。 2、掌握TCP/IP协议的安装及配置方法。 3、掌握常用的TCP/IP网络故障诊断和排除方法。 二、实验步骤:(实验环境:win7) 1.安装TCP/IP协议,如图1.1。 ······ 图1-1 安装TCP/IP协议2.设置TCP/IP协议,如图1.2。

图1.2 设置TCP/IP协议 3.常用网络测试命令的使用。 ①测试本机TCP/IP协议安装配置是否成功:ping 127.0.0.1(本地回环地址),如图1.3.1 这个Ping命令被送到本地计算机的IP软件,如果此测试不能通过,就表示TCP/IP的安装或配置存在问题。 图1.3.1 测试本机TCP/IP协议安装配置是否成功 ②ping本机IP,如图1.3.2。 这个命令被送到我们计算机所配置的IP地址,我们的计算机始终都应该对该Ping命令作出应答,如果没有,则表示本地配置或安装存在问题。出现此问题时,局域网用户请断开网络电缆,然后重新发

送该命令。如果网线断开后本命令正确,则表示另一台计算机可能配置了相同的IP地址。 图1.3.2 ping本机IP 同理,也可以ping局域网内的其他计算机以及网关。 ③发现和解决TCP/IP 网络问题时,先检查出现问题的计算机上的TCP/IP 配置。可以使用ipconfig 命令获得主机配置信息,包括IP 地址、子网掩码和默认网关,如图1.3.3。 图1.3.3 主机配置信息 ④Netstat命令可以帮助网络管理员了解网络的整体使用情况。它可以显示当前正在活动的网络连接的详细信息,例如显示网络连接、路由表和网络接口信息,可以统计目前总共有哪些网络连接正在运行。利用命令参数,命令可以显示所有协议的使用状态,这些协议包括TCP协议、UDP协议以及IP协议等,另外还可以选择特定的协议并查看其具体信息,还能显示所有主机的端口号以及当前主机的详细路由信息,如图1.3.4。 命令格式: netstat [-r] [-s] [-n] [-a] 参数含义: -r 显示本机路由表的内容; -s 显示每个协议的使用状态(包括TCP协议、UDP协议、IP协议);

TCPIP协议分析实验报告

.. TCP/IP协议分析及应用实验报告 学号:姓名:班级: 实验项目编号: B03862704 实验项目名称:传输控制协议TCP 一、实验目的: 1. 掌握TCP协议的报文格式。 2. 掌握TCP连接的建立和释放过程。 3. 掌握TCP数据传输中编号与确认的过程。 4. 掌握TCP协议校验和的计算方法。 5. 理解TCP重传机制。 二、实验环境: Windows server 2003 TCP/IP协议分析及应用教学实验平台 三、实验原理(或要求): TCP报文格式 16位源端口号 16位目的端口号 位序号32 位确认序号32F P U A R S 4位首6保留(16I 位窗口大小 C 部长R S S Y 位)N N T G K H 度位紧急指针16位校验和16 选项数据 连接的建立TCP在面向连接的环境中,开始传输数据之前,在两个终 TCP是面 向连接的协议。通信双方必须用彼此的初端之间必须先建立一个连接。对于一个 要建立的连接,(指明希望收到的下一个ackseq始化序列号和来自对方成功传输 确认的应答号。ACK,应答信号写为八位组的编号)来同步,习惯上将同步信 号写为SYN整个同步的过程称为三次握手,如图: 优质范文.

连接的释放TCP附加标记的报FINTCP使用四次握手来结束通话(使用一个带有对于一个已经建立的连接,如图。文段) TCP重传机制只要计时器设置的重传时间到期,就对这个报文段设置一次计时器。TCP每发送一个报文段,但还没有收到确认,就要重传这一报文段。

优质范文. .. 四、实验步骤: 练习一:察看TCP连接的建立和释放 主机B、C、D启动协议分析器进行数据捕获,并设置过滤条件(提取TCP协议)。主机A启动仿真编辑器,进入TCP连接视图。在“服务器信息/IP地址”中填入主机C的IP地址;使用“端口扫描”获取主机C的TCP端口列表,在“服务器信息/端口”中填入主机C的一个TCP端口(大于1024);点击“连接”按钮进行连接。 察看主机B、C、D捕获的数据,填写下表。 字段名称报文1 报文2 报文3 Sequence Number Acknowledgement Number ACK SYN TCP连接建立时,前两个报文的首部都有一个“maximum segment size”字段,它的值是多少?作用是什么?结合IEEE802.3协议规定的以太网最大帧长度分析此数据是怎样得出的。 主机A断开与主机C的TCP连接。 察看主机B、C、D捕获的数据,填写下表。

TCPIP网络常用服务

TCP/IP网络中的常用服务 内容摘要 在前一章中,我们已经提到了有关IP地址分配、名称解析的一些问题,由于关系到TCP/IP网络中的计算机能否正常的通信,所以如何有效地解决这些问题是值得每一个管理员重视的。在TCP/IP网络中,提供了DHCP、DNS、NetBIOS Name Server等标准网络服务用来完成这些任务。学习完这一章,你将对这三个服务有如下了解: DHCP、DNS、WINS的基本功能 DHCP、DNS、WINS的基本配置 考点提示 在70-210的考试中,只会涉及到有关这三个服务的基本内容,所以大家在准备时,只要了解它们的基本功能和工作方式即可。 DHCP、DNS、WINS的功能 DHCP客户端的设置 WINS客户端的设置 DNS客户端的设置 5.1 DHCP(动态主机配置协议) 5.1.1 DHCP的基本概念 动态主机配置协议(DHCP)是一种用于简化主机IP配置管理的TCP/IP 标准。DHCP 标准为DHCP 服务器的使用提供了一种有效的方法:即动态管理TCP/IP参数的分配。我们先来看一下“手工配置”和“自动配置”的特点: 手工配置TCP/IP 在你的网络中用人工的方式配置TCP/IP 时,你必须在每一个客户计算机上输入一个IP地址。这就意味着用户可能输入错误的或者非法的IP地址,而没有使用来自网络管理员的合法的IP地址。用了错误的IP地址可能导致网络问题,而对于这类问题,追踪根源非常困难。 自动配置TCP/IP 利用DHCP自动配置TCP/IP,意味着用户不再需要从管理员那里获得IP地址。而是由DHCP服务器为DHCP客户机自动提供所有必要的配置。DHCP还可以自动更新客户机配置信息,以反映网络结构的变化。 由此可见,使用DHCP服务至少可以给我们带来如下好处: ? 安全可靠的配置

相关文档
最新文档