文档库 最新最全的文档下载
当前位置:文档库 › Definitions of TCPIP Network Connection Metrics

Definitions of TCPIP Network Connection Metrics

Definitions of TCPIP Network Connection Metrics
Definitions of TCPIP Network Connection Metrics

De?nitions of TCP/IP Network Connection

Metrics

S TERRY BRUGGER

University of California,Davis

January6,2007

Abstract

We propose a working de?nition for what exactly comprises a TCP/IP network connection,and exactly how to extract connection metrics from the viewpoint of a third-party observer.Our de?nitions should be formal enough to allow two di?erent researchers to obtain the same measurement from the same network trace.

1Introduction

In order to do analysis based on various metrics of TCP network connections, researchers need to agree on exactly what those metrics are.To?rst order,we must agree on which packets do and do not belong to a given connection.Given this,we need to agree on exactly how to calculate the connection metrics we’re interested in from a given trace.We are interested in this from the viewpoint of a third-party passive observer,as this is how we collect network data without a?ecting the activity on the network.

This paper presents a de?nition for TCP connections,and how to calculate TCP connection metrics based on state diagrams,based on a reading of RFC793 from the viewpoint of a third party.The metrics themselves have been used by the network intrusion detection community,and we expect they will be of inter-est to anyone desiring a deeper understanding of networks.We hope that people adopt these metrics for their research,however we do not believe that these are the end-all-be-all de?nitions.Instead,we o?er these working de?nitions as a proposal in the hopes of generating discussion on how best to measure TCP connections.

2De?nition of a TCP Connection

We will begin with a very basic de?nition:A TCP Connection is a set of packets between a pair of sockets(Host IP and port pairs).Since the same pair of sockets may be used for multiple connections,this section will further re?ne this de?nition.

1

In a perfect world,the de?nition of a TCP connection is easy:It is all the packets starting with the initial SYN packet,up to and including the ACK of the second FIN(Postal1981).Of course,the RFC acknowledges that we don’t live in a perfect world,and it de?nes how hosts should act in a variety of situations. It is easy to extend the above de?nition to cover some of these,for example,we can say up to and include in the ACK of the second FIN,or a connection RST packet;but do we count a SYN packet in the middle of the current sequence as part of the current connection,or as a separate connection?Do we count a non-SYN packet that is not part of an ESTABLISHED connection to be part of a connection at all?

To that end,we always require a SYN packet to begin a connection.If we don’t see a SYN,and we don’t have a record of the connection already,we must assume that the connection was already begun before we started observation, hence we do not have a complete record of the connection,and we will not attempt to record metrics on it.It is true that an attacker may attempt to attack the network stack by sending in a malicious packet(for instance a“Christmas tree packet”,which has all of the TCP?ags set(Miller2000))without having already established a connection,however this is not a connection,and any desire to include it in overall network characterization should be done separately from the connection metrics.

Once we see the initial SYN packet,we include all packets between the source and destination sockets in the metrics for that connection.This includes packets that are invalid for whatever reason;for instance packets with incorrect checksums,or out of sequence packets.

A connection ends when:

?Both sides have sent a FIN,which is acknowledged.

?One side sends a RST.

?A packet goes unacknowledged for more than TIMEOUT seconds,where we use the300second TIMEOUT suggested by RFC793.

?There is no activity on the connection for more than TIMEOUT seconds.

The?rst two are fairly straight forward.When we combine our de?nition of when a connection begins with the third,it brings with it an important implication:even if a connection never reaches the ESTABLISHED state on the hosts,we include it as a connection in the connection metrics.This means that if a?rewall blocks the connection,we will still record it as a connection consisting of one packet.If the source tries to resend the SYN packet,lets say twice,then we’ll record it as a connection with two duplicate packets.The fourth de?nition is really just a generalization of the third,however we call it out separately as we expect it will generate some discussion.The TCP speci?cation indicates that once a connection is established,it will stay established as long as both hosts keep it established.It may be that during this idle time,one of the hosts is removed from the network(shutdown,unplugged,etc),at which point it will,in essence,terminate the connection,without being able to let the other host know.This condition is known as a half-open connection.Our

2

problem is that,given our point of observation,we can not ascertain when this has occurred.As such,we must infer it through the lack of any activity over some time period.If one accepts this,then the question becomes how long that timeout should be.We propose using the same value as we use for closing the connection when it is in the TIME-WAIT state.

3De?nitions of TCP Connection Metrics

Given the above de?nition of a connection,we will here de?ne various metrics that we might use in characterizing connections.We follow the subsection for a Segment Arriving in the event processing model in RFC793and note where we count various characteristics.Due to our perspective,there is actually little overlap with the endpoint-model that RFC793uses,so we duplicate some information as necessary such that the reader does not require a copy of the RFC as they read though.Some areas we di?er from the RFC are:we ignore the security and precedence checks,as those features of TCP/IP are not used on contemporary networks;and we also assume a three-way handshake to establish

a connection,as it seems the four-way handshake has never borne out.

3.1Metrics to collect

An exhaustive list of the connection metrics that we collect as we follow the event processing model is as follows:

?Number of packets

?Duration(time of last packet minus starting time),in seconds

?Number control packets

?Number data packets(Number of packets minus Number control packets)?Bytes transfered

?Data bytes transfered

?Urgent

?Resend

?Wrong resend

?Duplicate ACK

?Wrong ACK

?Wrong data packet size

?Window exceeded

?Hole

?Connection errors

?Reset connection

?Other errors

3

?Disconnection errors

?Fragmented packets

?Bad fragment

?SYN-ONLY

?SYN-ACK

?Idle connection

?Half-open connection

All of these metrics–except the last four–should be stored in the connection record,and can be reported when that record is closed.The last four can be reported based on the state of the record when it is closed.

All of these metrics should be reported as counts(as opposed to rates),save for duration,which should be the number of seconds,and may be a real number (clock resolution permitting).

3.2Connection record

We use a modi?ed form of the TCB presented in RFC793Section3.2.Since we’re a third party observer to the connection,we attempt to capture the state at both ends of the connection,rather than the de?nitive information that either host uses.

Information on the source of the connection(the machine that sent the initial SYN):

SRC.UNA earliest sequence number the source has sent that has not been acknowledged by the dest–if all segments the source has sent have been acknowledged,this will be equal to the last ACK

SRC.NXT the next sequence number the source is going to use

SRC.WND the size of the window on the source machine

SRC.UP pointer to the last urgent sequence that the source machine should receive

SRC.UF?ag set to true when the urgent pointer should be examined SRC.WL1sequence number used for last window update on source machine SRC.WL2sequence number of last source window update that the dest ac-knowledged

SRC.FIN sequence number of the source’s FIN packet

Information on the destination of the connection:

DST.UNA earliest sequence number the dest has sent that has not been ac-knowledged by the source–if all segments the dest has sent have been acknowledged,this will be equal to the last ACK

DST.NXT the next sequence number the dest is going to use

DST.WND the size of the window on the dest machine

4

DST.UP pointer to the last urgent sequence that the dest machine should receive

DST.UF?ag set to true when the urgent pointer should be examined DST.WL1sequence number used for last window update on dest machine DST.WL2sequence number of last dest window update that the source ac-knowledged

DST.FIN sequence number of the dest’s FIN packet

When looking at an individual packet,we may consider SND to be whomever sent the packet:either SRC or DST,and RCV to be the other.We use the same de?nition for SEG given in RFC793,with the clari?cation that SEG.LEN is the data length of the segment.

3.3Segment Arriving

Since we’re taking the viewpoint of a third-party observer to the connection, the only event we’re interested in is“Segment Arriving”.Of course,to us,the segment isn’t really arriving,a better term might be“Segment Observed”.

A note on sequence comparisons:since sequence numbers run between zero and232?1,then repeat;RFC793notes that all sequence comparisons should be done mod(232),while this is not strictly correct,it is easy enough for TCP implementations to check that SND.UNA<=SEG.ACK<=SND.NXT, taking into account the special case when SND.NXT

B is being done,where either A or B is SEG.SEQ or SEG.ACK,then if A is not less than B,check if A is past halfway on the set of possible sequence numbers(>231),B is below the halfway mark,and the di?erence between them is at least231.In formal notation: A231and B<231and A?B>231) This may only be a heuristic,however it should be su?cient to classify a packet as either a bad resend,or out-of-sequence.

3.3.1Fragmented packets

For everything that follows,we assume that we’re working with complete seg-ments,just as RFC793does.Hence,when a packet arrives with the“More Fragments”(MF)?ag set(that is part of a connection that we either have a record for,or it has the SYN?ag set),it should be queued up in a fragmented packets queue.Any packet without the MF?ag set and with the fragment o?set >0will be assumed to be the last fragment.When it arrives,the fragmentation pre-processor should:

?verify that all the fragments were received(there are no holes)

5

?verify that none of the fragments overlap

?verify that none of the fragments(including the last one)have the“Don’t Fragment”(DF)?ag set.

If there are any holes,the packet is unusable,so the“Fragmented packets”and“Bad fragment”counters should be incremented,and processing on the packet should stop.If any of the conditionals do not hold,then the“Bad fragment”counter should be incremented.In either case,the“Fragmented packets”counter should be incremented.

Since only the?rst fragment has the TCP portion of the header,we must store the full header from the?rst fragment and use it for all the segment information we require.We will need to substitute in the full length of the packet as SEG.LEN.This measure will not account for the extra transmission overhead of the extra headers on all the fragments.This is fair because we are primarily interested in the connection metrics at this point.General network metrics,such as the total number of bytes sent or received on a given link, can be collected independently of the connection.The same argument holds for justi?cation for dropping packets with missing fragments before processing them as part of the connection.

Should the last fragment never arrive,then we may end up counting the packet as a hole,below.If we don’t count it as a hole,that will mean that it was resent.Unfortunately,if it is not fragmented when it is resent,we will not know to increase the“Resent”counter.If it is,however,fragmented,then the resend will show up as a bad fragment due to overlap between the original and the resent fragments.When a connection is closed,a count should be made of any segments from that connection still on the fragmentation queue,and that number added to the“Bad fragments”count.

The primary problem with this approach is that if the fragments arrive out of order–in particular if a fragment arrives after the last fragment–it will be recorded as a bad fragment.Considering how infrequently fragmented packets are encountered in practice anymore,we are not too concerned with this.

3.3.2No Record

If we don’t have a record of the connection,it could mean that the connection was established before we started observing the tra?c,or that this packet is not part of an established connection.In the later case,we don’t know if the connection is in the CLOSED or LISTEN state on the receiving host,so we continue to process this packet.

If the packet is a RST,ignore it.

If the packet is an ACK,then it must be part of a connection that was established before we began listening,so ignore it.

If the packet is a SYN,create a new connection record with

?the two sockets

?the starting time of the connection and time of last packet

6

?set SRC.UNA to SEG.SEQ

?set SRC.NXT to SEG.SEQ+1

?set SRC.WND to SEG.WND

?set SRC.WL1to SEG.SEQ

?set SRC.UP and SRC.WL2to zero

?set SRC.UF to false

?set all the DST?elds to zero

?set the state to SYN-RECEIVED

?set the“Number of packets”counter to one

?set the“Bytes transfered”to the total length of the packet

?if the SEG.LEN is zero,set the“Number controller packets”counter to one,otherwise increment the“Data bytes transfered”by SEG.LEN and set the“Wrong data packet size”counter to one

?set all other counters to zero

3.3.3SYN-RECEIVED

When we’re in the SYN-RECEIVED state,we expect to see a SYN-ACK.

For all packets:

?increment the“Number of packets”counter

?increment the“Bytes transfered”by the total length of the packet

?if the SEG.LEN is zero,increment the“Number controller packets”counter, otherwise increment“Data bytes transfered”by SEG.LEN and increment the“Wrong data packet size”counter

?set time of last packet

If the packet is not an ACK:

?increment the“Connection errors”counter

?stop processing this packet

Otherwise,the packet is an ACK,so check the acknowledgment number.If SEG.ACK!=SRC.NXT:

?increment the“Connection errors”counter

?stop processing this packet

If the ACK is?ne,check if the RST?ag is set.If so:

?increment the“Connection errors”counter

?increment the“Reset connection”counter

?close the record

If the SYN?ag is set,then this is the SYN-ACK we expect:

7

?set DST.UNA to SEG.SEQ

?set DST.NXT to SEG.SEQ+1

?set DST.WND to SEG.WND

?set DST.WL1to SEG.SEQ

?set DST.UP and DST.WL2to zero

?set DST.UF to false

?set SRC.UNA to SEG.ACK

?set SRC.NXT to SEG.ACK

?set the state to SYN-ACK

?stop processing this packet

If we made it this far,the packet is an ACK,but not a SYN-ACK,so:

?increment the“Connection errors”counter

?stop processing this packet

3.3.4SYN-ACK and later

The SYN-ACK state is what we call when the source is in the ESTABLISHED state and the destination is in the SYN-RECEIVED state.For this state,and all the ones that follow,we follow some common steps.

For all packets:

?increment the“Number of packets”counter

?increment the“Bytes transfered”by the total length of the packet

?if the SEG.LEN is zero,increment the“Number controller packets”counter, otherwise increment“Data bytes transfered”by SEG.LEN

?set time of last packet

First,check that the sequence number is acceptable.

?If SEG.SEQ

–increment the“Wrong resend”counter

–stop processing this packet

?If SEG.SEQ+SEG.LEN?1>SND.UNA+RCV.W ND,then the sender is sending a packet that will exceed the receiver’s window:

–if the state is SYN-ACK,increment the“Connection errors”counter

–increment the“Window exceeded”counter

–while an end-host would stop processing the packet at this point,we must consider that we failed to observe a packet or that the end-host

will be lenient in what it accepts

?If SEG.SEQ

8

–increment the“Resend”counter

–stop processing this packet

?Now see if the packets are out of order:If SND.NXT

–If the sequence of any packet in the other direction on the out-of-sequence queue is

–Otherwise,push it on an“out-of-sequence”queue,which we will pro-cess later

?The remaining case is that SEG.SEQ=SND.NXT,which is what we want and expect,so we continue to process it.

Second,if the RST?ag is set:

?increment the“Reset connection”counter

?if the SEG.LEN>0,increment the“Wrong data packet size”counter ?if the state is“SYN-ACK”,increment the“Connection errors”counter ?close the record

Third,if the SYN?ag is set:

?if the state is“SYN-ACK”,increment the“Connection errors”counter, otherwise set the“Other errors”counter

?if the SEG.LEN>0,increment the“Wrong data packet size”counter ?stop processing this packet

Fourth,check the ACK?eld:

?If the ACK?ag is not set:

–if the state is“SYN-ACK”,increment the“Connection errors”counter, otherwise set the“Other errors”counter

–stop processing this packet

?SYN-ACK state:

–If SEG.ACK!=DST.UNA+1:

?increment the“Connection errors”counter

?stop processing this packet

–Otherwise:

?change the state to ESTABLISHED

?ESTABLISHED and FIN-WAIT-2states:

–If SEG.ACK

?increment the“Duplicate ACK”counter

?stop processing this packet

9

–If RCV.NXT

?check the out-of-sequence queue-if there are any packets from the

receiver of this packet to the sender of this packet,see if any of

the sequences are

on the queue,in order,based on their sequence numbers:

·recursively process that packet and remove it from the queue;if

while processing a packet,it?nds a RCV.NXT

then just increment the“Hole”counter,set both RCV.NXT

and RCV.UNA to SEG.ACK,and continue(in other words,we

will recurse from SND→RCV to RCV→SND,from the

perspective of the current segment,but no further).

Once complete,continue to process this packet.

?If after processing any out-of-sequence packets,recheck SEG.ACK<

RCV.UNA;if true:

·increment the“Wrong ACK”counter

·stop processing this packet

?If after processing any out-of-sequence packets,recheck RCV.NXT<

SEG.ACK;if true:

·increment the“Hole”counter

·set RCV.NXT to SEG.ACK

·set RCV.UNA to SEG.ACK

?set RCV.UNA to SEG.ACK

?If SND.W L1

SND.W L2

set SND.WL1to SEG.SEQ,and set SND.WL2to SEG.ACK ?FIN-WAIT-1state:

–Follow the steps for the ESTABLISHED state

–If SEG.ACK=RCV.F IN+1,then set the state to FIN-WAIT-2and set RCV.FIN to zero

?CLOSING state:

–Follow the steps for the ESTABLISHED state

–If SEG.ACK=RCV.F IN+1,then set RCV.FIN to zero(this,plus the state,indicates that it has been ACKed)and set the state to

TIME-WAIT,otherwise increment the“Disconnection errors”counter ?TIME-WAIT state:

–Follow the steps for the ESTABLISHED state

–If SEG.ACK=RCV.F IN+1,then close the record

Note from this point forward that we don’t need to handle the SYN-ACK state as it will have either transitioned to the ESTABLISHED state or have stopped processing with an error.

Fifth,check the URG?ag:

10

?ESTABLISHED,FIN-WAIT-1,and FIN-WAIT-2states:

–If the URG?ag is set,set RCV.UP to the max of RCV.UP and SEG.UP and set RCV.UF to true

–If RCV.UF is true and SEG.SEQ<=RCV.UP,increment the“Ur-gent”counter,otherwise,set RCV.UF to false

?CLOSING,and TIME-WAIT states:

–If the URG?ag is set,increment the“Disconnection errors”counter Sixth,update the source’s sequence information:

?ESTABLISHED,FIN-WAIT-1,and FIN-WAIT-2states:

–If SEG.LEN>0,set SND.NXT to SEG.SEQ+SEG.LEN ?CLOSING,and TIME-WAIT states:

–If SEG.LEN>0,increment the“Wrong data packet size”counter Finally,check the FIN?ag.Since we only process Segment Arrived events, there are only two ways that a connection can be closed:

1.Host A sends a FIN to Host B,Host B ACKs this FIN.Eventually,Host B

sends its own FIN,which Host A will ACK,and the connection is CLOSED.

2.Host A sends a FIN to Host B,Host B is thinking the same thing and sends

a FIN to Host A.One of the hosts(it does not matter which)ACKs the

other’s FIN,then the other host ACKs the other FIN,and the connection is CLOSED.

We tweak the event model in RFC793to?t these two choices:When a FIN is received,we enter the FIN-WAIT-1state.If that FIN is ACKed,we enter the FIN-WAIT-2state.If,instead,the other ACK is received,we enter the CLOSING state.From the FIN-WAIT-2state,when we receive the other FIN, we enter the TIME-WAIT state.From the CLOSING state,when one of the FINs is ACKed,we enter the TIME-WAIT state.From the TIME-WAIT state, when the other FIN is ACKed,we enter the CLOSED state.This is illustrated in?gure1.

So we perform the following steps,if the FIN bit is set:

?ESTABLISHED state:

–set SND.FIN to SEG.SEQ

–set SND.NXT to SEG.SEQ+SEG.LEN+1

–change the state to FIN-WAIT-1

?FIN-WAIT-1state:

–if SND.FIN is set(not zero),increment the“Disconnection errors”

counter and stop processing this packet

–set SND.FIN to SEG.SEQ

–set SND.NXT to SEG.SEQ+SEG.LEN+1

–change the state to CLOSING

11

Figure1:State diagram of how a connection can move from ESTABLISHED to CLOSED.

?FIN-WAIT-2state:

–if SND.FIN is set(not zero),increment the“Disconnection errors”

counter and stop processing this packet

–set SND.FIN to SEG.SEQ

–set SND.NXT to SEG.SEQ+SEG.LEN+1

–change the state to TIME-WAIT

?CLOSING and TIME-WAIT states:

–increment the“Disconnection errors”counter

–stop processing this packet

3.4Cleaning up

When we are done observing the tra?c over this connection,we will still have a number of open connection records.We must decide if these connections are still active,in which case we do not have all the information on the connection to report its metrics,or if the connection has timed out.If a connection has timed out,at least one end of the connection has closed its TCB(or it never created one),and any further attempts to use that connection will result in a

12

RST(or will just be ignored).As explained in section2,if the last packet was more than TIMEOUT seconds before we stopped observing tra?c on this link, then we will assume the connection is idle and close it.

?If the state of the connection is SYN-RECEIVED,then report the“SYN-ONLY”counter as one,otherwise report it as zero.

?If the state of the connection is SYN-ACK,then report the“SYN-ACK”

counter as one,otherwise report it as zero.

?If the state of the connection is ESTABLISHED,then report the“Idle connection”counter as one,otherwise report it as zero.

?If the state of the connection is FIN-WAIT-1,FIN-WAIT-2,CLOSING, or TIME-WAIT,then report the“Half-open connection”counter as one, otherwise report it as zero.

References

Miller,T.(2000,30August).Intrusion detection level analysis of Nmap and Queso.Technical Report1225,SecurityFocus.

Postal,J.(1981,September).RFC793:Transmission control protocol.

13

实验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字节数据,

实验二--配置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 配置,或者进一步

项目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.wendangku.net/doc/e44377877.html,.此时应该按什么顺序。用什么方法。分别检测系统中的那些位置? 2.静态域名解析和动态域名解析有什么区别?分别在哪些文件里面进行设置?系统如何决定用哪种方式对一个域名进行解析? 3.利用ifconfig和route命令配置ip地址,子网掩码和默认网关等信息和利用netcofig以及编辑/etc/syscofig/network-scripts/if-eth0文件配置的ip地址,子网掩码和默认网关等信息有什么不同? 六、实训报告要求 实训目的 实训内容 实训步骤 实训中的问题及解决方法 回答实训思考题 实训心得体会 建议与意见 .

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参数的操作主要包括三个方面

配置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参数的操作主要包括三个方面

配置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端口了。

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服务至少可以给我们带来如下好处: ? 安全可靠的配置

配置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协议);

实验三 Windows网络配置和TCPIP协议配置及诊断

实验三 Windows网络配置和TCP/IP协议配置及诊断 一、实验目的 学习在Windows系统中进行IP地址、网络掩码、DNS服务器等网络协议配置,进一步掌握用ping、ipconfig、tracert等命令工具来进行网络测试和查看网络状态。 本实验在于更好地理解计算机网络设置的基本操作,掌握计算机网络配置的基本监测技术。 二、实验内容 Windows的网络配置、Windows TCP/IP 协议配置 三、实验环境 Windows 2000 操作系统 四、实验步骤 4.1 Windows的网络配置 1、进入网络配置 单击“开始”按钮,打开“开始”菜单,依次选择“设置”和“控制面板”,打开“控制面板”对话框。双击“网络”图标就直接进入“网络”对话框,如图-1所示。在对话框中,一般包括“配置”、“标识”和“访问控制”在内的三个标签选项,当用户计算机尚未配置任何网络组件时,则仅显示“配置”一个标签选项。其中,“配置”标签用于添加和删除各种网络组件及配置已有网络组件的各种属性;“标识”标签选项用于赋予或修改用户计算机的名称包括计算机名、工作组和计算机说明等描述特性;“访问控制”标签选项用于设定共享资源的访问权限。网络的配置工作就是在“配置”标签里完成的。配置标签里列出了已安装了的网络组件清单。这些组件可分成以下四类:客户端、适配卡、通信协议和服务。其中,“客户端”是网络客户机软件,它使用户的计算机可以访问网络中其他服务器提供的共享资源;“适配卡”即网络接口卡;“协议”指网络通信协议;“服务”组件使用户的计算机可以扮演服务器的角色,可以向网络中的其他计算机提供共享资源。

图-1 2、添加客户组件并设定属性 在“配置”标签中单击“添加”按钮,选择“客户”组件类型,然后单击“确定”,或双击“客户”组件类型即可进入如图-2所示的“选定网络客户”对话框。对话框的左边是网络厂商,右边是由厂商提供的网络客户组件,选择所需按确定即可。 在网络组件列表中单击相应的客户组件,单击“属性”命令按钮,即可激活相应的“网络客户特性”对话框,该对话框有两个活页卡片可选择:“高级”和“通用”,可根据需要选择或输入设定的内容。

项目3 TCPIP网络接口配置

班级_________________学号___________姓名___________ 实训项目3 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地址和域名。 ●用ping命令检测上面设置好的网关的域名,测试静态域名解析是否成功。 ●编辑/etc/resolv.conf文件,加入域名服务器的IP地址,设置动态域名解析。 ●编辑/etc/host.conf文件,设置域名解析顺序为:hosts,bind。 ●用nslookup命令查询一个网址对应的IP地址,测试域名解析的设置。 子项目5. 启动和停止守护进程 ●用service命令查看守护进程sshd的状态。

Windows TCPIP配置

TCP/IP 配置参数 Windows 2000 TCP/IP 协议组件实现从注册表中获取全部配置数据。配置信息 是由安装程序写到注册表中的。一些信息也可以由动态主机配置协议(DHCP) 客户 服务提供(如启用)。本附录定义了用于配置协议驱动程序(Tcpip.sys) 的所有 注册表参数,它实施标准的TCP/IP 网络协议。 仅使用安装程序和DHCP 所收集的配置信息,协议组件实现就可以在大多数环 境中正常而有效地工作。大多数使用环境下,协议的所有其它配置项的最优默认值 已编入该驱动程序中。一些用户安装设置可能需要更改某些默认值。要这样做,可 以创建一些可选的注册表参数,修改协议驱动程序某些默认设置。 {0>Note The Windows TCP/IP implementation is largely self-tuning.<}0{>备注Windows TCP/IP 实现基本上是自调整的。<0} {0>Adjusting registry parameters may adversely affect system performance.<}0{>?调整注册表参数可能对系统性能造成不利的影响。0} 所有TCP/IP 参数就是放在注册表项下面的注册表值。 HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip \Parameters 适配器特有的数值列在每个适配器的子项中。根据系统或适配器是由DHCP 配置的 ,还是指定了静态覆盖值,参数可能会拥有DHCP 配置和静态配置值。如果使用注 册表编辑器更改其中的任何参数,通常系统需要重新启动,更改才能生效。如果使 用网络连接接口更改注册表值,通常不需要重新启动。 可用注册表编辑器配置的参数 在TCP/IP 组件安装过程中,设定下列参数的默认值。要修改其中的任何值,请使 用注册表编辑器(Regedt32.exe)。默认情况下,在注册表中可以看见一些参数, 但是大多数参数必须重新创建,以便修改TCP/IP 协议驱动程序的默认设置。以下 分别列出了用户接口的可配置参数。 AllowUserRawAccess 项:Tcpip\Parameters 数值类型:REG_DWORD - 布尔值 有效范围:0、1(false、true)

TCPIP协议详解-配置选项

附录E 配置选项 我们已经看到了许多冠以“依赖于具体配置”的T C P/I P特征。典型的例子包括是否使能U D P的检验和(11 .3节),具有同样的网络号但不同的子网号的目的I P地址是本地的还是非本地的(1 8.4节)以及是否转发直接的广播(1 2.3节)。实际上,一个特定的T C P/I P实现的许多操作特征都可以被系统管理员修改。 这个附录列举了本书中用到的一些不同的T C P/I P实现可以配置的选项。就像你可能想到的,每个厂商都提供了与其他实现不同的方案。不过,这个附录给出的是不同的实现可以修改的参数类型。一些与实现联系紧密的选项,如内存缓存池的低水平线,没有描述。 这些描述的变量只用于报告的目的。在不同的实现版本中,它们的名字、默认值、或含义都可以改变。所以你必须检查你的厂商的文档(或向他们要更充分的文档)来 了解这些变量实际使用的单词。 这个附录没有覆盖每次系统引导时发生的初始化工作:对每个网络接口使用i f c o n f i g 进行初始化(设置I P地址、子网掩码等等)、往路由表中输入静态路由等等。这个附录集中描述了影响T C P/I P操作的那些配置选项。 E.1 BSD/386 版本1.0 这个系统是自从4 .2B S D以来使用的“经典”B S D配置的一个例子。因为源代码是和系统一起发布的,所以管理员可以指明配置选项,内核也可重编译。存在两种类型的选项:在内核配置文件中定义的常量(参见c o n f i g( 8)手册)和在不同的C源文件中的变量初始化。大胆而又经验丰富的管理员也可以使用排错工具修改正在运行的内核或者内核的磁盘映像中这些变量的值,以避免重新构造内核。 下面列出的是在内核配置文件中可以修改的常量。 IPFORWARDING 这个常量的值初始化内核变量i p f o r w a r d i n g。如果值为0(默认),就不转发I P数据报。如果是1,就总是使能转发功能。 GATEWAY 如果定义了这个常量,就使得I P F O R WA R D I N G的值被置为1。另外,定义这个常量还使得特定的系统表格(A R P快速缓存表和路由表)更大。 SUBNETSARELOCAL 这个常量的值初始化内核变量s u b n e t s a r e l o c a l。如果值为1(默认),一个和发送主 I P地址被认为是本地的。如果是0,只有在同一个子

TCPIP网络协议配置

实习6 TCP/IP网络协议配置 一、实习目的 1.掌握IP地址配置方法; 2.理解网络基本配置中包含的协议、服务、客户端,以及基本参 数; 3.练习并掌握简单网络命令的使用。 二、实习内容 1.查看所在机器的主机名称和网络属性,包括网络基本配置中包 含的协议、服务、客户端,以及有关的基本参数; 2.修改网络配置参数; 3.常用网络命令的使用。 三、实习步骤 1. 常用网络命令的使用 提示:Windows命令使用方法:单击【开始】按钮→选择【程序】→选择【附件】→选择【命令提示符】即可打开命令操作窗口,可在命令提示符下执行Windows命令。命令的格式一般为:?命令/参数?,如:IPConfig /?,?参数可以查看命令的使用说明

图为进入命令提示符界面的截图命令提示符界面的截图 (1)IPConfig IPConfig命令可用于显示当前的TCP/IP配置信息,这些信息一般用来检验人工配置的TCP/IP设置是否正确。但是,如果你的计算机和所在的局域网使用了动态主机配置协议,这个程序所显示的信息也许更加实用。这时,IPConfig可以让你了解你的计算机是否成功的租用到一个IP地址,如果租用到则可以了解它目前分配到的是什么地址。了解计算机当前的IP地址、子网掩码和缺省网关实际上是进行测试和故障分析的必要项目。 该命令用来显示当前的TCP/IP 配置,也可显示本机网卡的物理地址。加all参数可以查看配置全部信息。 在命令行下键入:ipconfig/all ,显示类似以下信息,阅读并解释。 记录本机IP地址、MAC地址等信息(注:每台计算机配置信 息不同)。 Microsoft Windows 2000 [Version 5.00.2195] (C) 版权所有1985-2000 Microsoft Corp.

WIN7下TCPIP的配置与测试

WIN7下TCP/IP的配置与测试 12.1 实训准备 一、实训目标 掌握Windows7系统IP地址配置的方法 理解子网掩码的作用 掌握子网掩码的配置 掌握TCP/IP基本测试方法和正确理解网络测试命令Ping和ipconfig等 二、实训环境 硬件环境:CPU主频≥2.0GHz,内存≥2G, 软件环境:Win7操作系统、网络连接正常 三、实训知识要点 1.IP地址 Internet上的每台主机都有一个唯一的IP地址。IP协议的一项重要功能就是屏蔽主机原来的物理地址,从而在全网中使用统一的IP地址。IP协议就是使用该地址在主机之间传递信息,这是Internet 能够运行的基础。 031 网络号主机号 图12-1 IP地址的结构 成,网络号用来标识一个网络,主机号用来标识这个网络上的某一台主机,如图12-1所示。 寻址时先按IP地址中的网络号把网络找到,再按主机号把主机找到。所以IP地址并不只是一个计算机的编号,而是指出了连接到某个网络上的某个计算机。 IP地址由32位二进制数组成,按8为单位分成4个字节。如:11000000 10101000 00000000 01100011。由于二进制不容易记忆,IP地址通常用点分十进制的方式表示。点分十进制方式就是将32位的IP地址中的每8位用其等效的十进制数字表示,每个十进制数字之间用小数点隔开。例如:上述二进制数用点分十进制方式可以表示为:193.168.0.99,相对于二进制形式,这种表示要直观的多,便于阅读和理解。 图12-2 五类IP地址的结构

IP地址分为五类:A类、B类、C类、D类和E类,其中A、B和C类地址被称为基本的Internet地址,供用户使用,为主类地址。D类和E类地址为次类地址:D类地址称为组播地址,E类地址被称为保留地址。五类IP地址的结构如图12-2所示。 A类地址第一个字节的第一位是“0”,其余7为网络号,后三个字节为主机号。A类地址中网络数为126(27-2)个,网络号全“0”和全“1”这两个值保留用于特殊目的。每个网络包含的主机数为16777214(224-2)个,全“0”和全“1”也有特殊用途。一台主机能使用的A 类地址的有效范围是1.0.0.1~126.255.255.254,一般用于世界上少数的具有大量主机的网络。 B类地址第一个字节的前两位是“10”,其余6位加上第二个字节的8位(14位)为网络号,后两个字节为主机号。B类地址中网络数为16382(214-2)个,网络号全“0”和全“1”这两个值保留用于特殊目的。每个网络包含的主机数为65534(216-2)个,全“0”和全“1”也有特殊用途。一台主机能使用的B类地址的有效范围是128.0.0.1~191.255.255.254,主要用于一些国际大公司和政府机构等中等规模的网络。 C类地址第一个字节的前三位是“110”,其余5位加上第二、三字节共21位表示网络号,最后一个字节为主机号。C类地址中网络数为2097150(221-2)个,网络号全“0”和全“1”这两个值保留用于特殊目的。每个网络包含的主机数为254(28-2)个,全“0”和全“1”也有特殊用途。一台主机能使用的C类地址的有效范围是192.0.0.1~223.255.255.254,主要用于一些小公司和普通的研究机构等小型网络。 D类地址第一个字节的前四位是“1110”,地址范围为224.0.0.0~239.255.255.255。通常用于已知的多点传送或者组播的寻址,主要是留给Internet体系结构委员会IAB使用。 E类地址第一个字节的前五位是“11110”,是一个实验性地址,保留给将来使用。 IP地址不是任意分配的,分配A类IP地址的国际组织是国际网络信息中心NIC;分配B类地址的国际组织是InterNIC、APNIC和ENIC;分配C类地址的组织是国家或地区网络的NIC。 2.子网掩码 互联网是由许多小型网络构成的,每个网络上都有许多主机,这样便构成了一个有层次的结构。IP地址在设计时就考虑到地址分配的层次特点,将每个IP地址都分割成网络号和主机号两部分,以便于IP地址的寻址操作。IP地址的网络号和主机号各是多少位呢?如果不指定,就不知道哪些位是网络号、哪些是主机号,这就需要通过子网掩码来实现。 子网掩码不能单独存在,它必须结合IP地址一起使用。子网掩码只有一个作用,就是将某个IP地址划分成网络地址和主机地址两部分。子网掩码的设定必须遵循一定的规则。与IP地址相同,子网掩码的长度也是32位,左边是网络位,用二进制数字“1”表示;右边是主机位,用二进制数字“0”表示。附图所示的就是IP地址为“192.168.1.1”和子网掩码为“255.255.255.0”的二进制对照。其中,“1”有24个,代表与此相对应的IP地址左边24位是网络号;“0”有8个,代表与此相对应的IP地址右边8位是主机号。这样,子网掩码就确定了一个IP地址的32位二进制数字中哪些是网络号、哪些是主机号。这对于采用TCP/IP协议的网络来说非常重要,只有通过子网掩码,才能表明一台主机所在的子网与其他子网的关系,使网络正常工作。 子网掩码是一个32位地址,用于屏蔽IP地址的一部分以区别网络标识和主机标识。例如子网掩码255.255.255.0 转化为二进制为11111111 11111111 11111111 00000000,其中11111111 11111111 11111111是网络标识,表示C类地址;00000000 是主机标识,表示可分配的计算机台数。 那么,在这个网络中,192.168.1.200这个IP地址表示网络地址是192.168.1.0,主机地址是200,在Internet上一般使用网络地址(有时也称为网段)进行路由寻址的。 3.MAC地址

TCPIP协议配置参数

TCP/IP协议配置参数 Windows 2000 TCP/IP协议组件实现从注册表中获取全部配置数据。配置信息是由安装程序写到注册表中的。一些信息也可以由动态主机配置协议(DHCP) 客户服务提供(如启用)。本附录定义了用于配置协议驱动程序(Tcpip.sys)的所有注册表参数,它实施标准的TCP/IP 网络协议。 仅使用安装程序和DHCP 所收集的配置信息,协议组件实现就可以在大多数环 境中正常而有效地工作。大多数使用环境下,协议的所有其它配置项的最优默认值 已编入该驱动程序中。一些用户安装设置可能需要更改某些默认值。要这样做,可 以创建一些可选的注册表参数,修改协议驱动程序某些默认设置。 {0>Note The Windows TCP/IP implementation is largely self-tuning.<}0{>备 注Windows TCP/IP 实现基本上是自调整的。<0} {0>Adjusting registry parameters may adversely affect system performance.<}0{>?调整注册表参数 可能对系统性能造成不利的影响。0} 所有TCP/IP 参数就是放在注册表项下面的注册表值。 HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip \Parameters 适配器特有的数值列在每个适配器的子项中。根据系统或适配器是由DHCP 配置的 ,还是指定了静态覆盖值,参数可能会拥有DHCP 配置和静态配置值。如果使用注 册表编辑器更改其中的任何参数,通常系统需要重新启动,更改才能生效。如果使 用网络连接接口更改注册表值,通常不需要重新启动。 可用注册表编辑器配置的参数 在TCP/IP 组件安装过程中,设定下列参数的默认值。要修改其中的任何值,请使 用注册表编辑器(Regedt32.exe)。默认情况下,在注册表中可以看见一些参数, 但是大多数参数必须重新创建,以便修改TCP/IP 协议驱动程序的默认设置。以下 分别列出了用户接口的可配置参数。 AllowUserRawAccess 项:Tcpip\Parameters 数值类型:REG_DWORD –布尔值 有效范围:0、1(false、true) 默认值:0 (false) 说明:该参数控制对原始套接字的访问。如果为true,则非管理用户可以访问原 始套接字。默认情况下,只有管理员可以访问原始套接字。有关原始套接字的详细 信息,请参见Windows Sockets 规范,网址是:ftp://ftp.microsoft./ com/bussys/winsock/winsock2。 ArpAlwaysSourceRoute 项:Tcpip\Parameters 数值类型:REG_DWORD –布尔值 有效范围:0、1 或不存在(false、true 或不存在)

TCPIP常用网络工具的使用

实验四TCP/IP常用网络工具的使用 一、实验目的: 1.了解网络命令及其所代表的含义,以及所能对网络进行的操作。 2.通过网络命令了解系统的网络运行状态,并利用网络命令对网络进行简单的操作。 二、实验环境: WINDOWS XP、局域网 三、实验相关理论: 1.Ping:测试TCP/IP协议安装配置是否成功 (1)命令作用 Ping是测试网络联接状况以及信息包发送和接收状况非常有用的工具,可以用它来检测数据包到达目的主机的可能性,是网络测试最常用的命令。Ping向目标主机(地址)发送一个回送请求数据包,要求目标主机收到请求后给予答复,从而判断网络的响应时间和本机是否与目标主机(地址)连通。 如果执行Ping不成功,则可以预测故障出现在以下几个方面:网线故障,网络适配器配置不正确,IP地址不正确。如果执行Ping成功而网络仍无法使用,那么问题很可能出在网络系统的软件配置方面,Ping成功只能保证本机与目标主机间存在一条连通的物理路径。 (2) 命令格式 命令格式:ping [-t] [-a] [-n count] [-l size] destination-list 参数含义: -t不停地向目标主机发送数据;直到用户按ctrl+c结束 -a以IP地址格式来显示目标主机的网络地址; -n count指定要Ping多少次,具体次数由count来指定; -l size指定发送到目标主机的数据包的大小。 (3)用法举例 ①测试本机TCP/IP协议安装配置是否成功 Ping 127.0.0.1 这个Ping命令被送到本地计算机的IP软件,如果此测试不能通过,就表示TCP/IP的安装或配置存在问题。 ② Ping 本机IP 这个命令被送到本地计算机所配置的IP地址,本地计算机始终都应该对该Ping命令作出应答,如果没有,则表示本地配置或安装存在问题。出现此问题时,局域网用户请断开网络电缆,然后重新发送该命令。如果网线断开后本命令正确,则表示另一台计算机可能配置了相同的IP 地址。 ③ Ping 局域网内其他IP 这个命令发出的信息应该离开本地的计算机,经过网卡及网络电缆到达其他计算机,再返回。收到回送应答表明本地网络中的网卡和载体运行正确。但如果收到0个回送应答,那么表示子网掩码(进行子网分割时,将IP地址的网络部分与主机部分分开的代码)不正确或网卡配置错误或电缆系统有问题。 ④ Ping 网关IP 这个命令如果应答正确,表示局域网中的网关路由器正在运行并能够作出应答。 ⑤ Ping 远程IP 如果收到4个应答,表示成功的使用了缺省网关。 ⑥ Ping localhost

Linux系统中TCPIP网络配置文件

Linux系统中TCP/IP网络配置文件 在Linux系统中,TCP/IP网络是通过若干个文本文件进行配置的,需要编辑这些文件来完成联网工作。系统中重要的有关网络配置文件为: ◆ /etc/sysconfig/network ◆ /etc/HOSTNAME ◆ /etc/hosts ◆ /etc/services (服务名_端口号_协议名称) ◆ /etc/protocols (系统支持的协议) ◆ /etc/host.conf ◆ /etc/nsswitch.conf ◆ /etc/resolv.conf ◆ /etc/rc.d/init.d/network 接下来我们将对这些文件逐一讲述,这些文件都可以在系统运行时进行修改,不用启动或者停止任何守护程序,更改会立刻生效(除了/etc /sysconfig/network)。另外,这些文件都支持由"#"开头的注释,每一个文件都有在UNIX手册页中的第5部分中有一项,可以用man 命令来获取它们。 ◆ /etc/sysconfig/network 网络设置 该文件用来指定服务器上的网络配置信息,包含了控制和网络有关的文件和守护程序的行为的参数。下面是一个例子文件: NETWORKING=yes HOSTNAME=machine1 GATEWAY=210.34.6.2 FORWARD_IPV4=yes GATEWAYDEV= 其中,NETWORK=yes/no 表示网络是否被配置;

HOSTNAME=hostname hostname 表示服务器的主机名; GATEWAY=gw-ip gw-ip 表示网络网关的IP地址; FORWARD_IPV4=yes/no 是否开启IP转发功能; GAREWAYDEV=gw-dev gw-dw 表示网关的设备名,如:eth0等; 为了和老的一些软件相兼容,"/etc/HOSTNAME"文件应该用和HOSTNAME=hostname相同的主机名。 ◆ /etc/HOSTNAME 主机名 该文件包含了系统的主机名称,包括完全的域名,如: 192.168.0.1 machine1.domain machine1 这个文件是在启动时从文件/etc/sysconfig/network中的HOSTNAME行中得到的,用于在启动时设置系统的主机名。 -------------------------------------------------------------------------------- ◆ /etc/hosts IP地址和主机名的映射 /etc/hosts中包含了IP地址和主机名之间的映射,还包括主机名的别名,IP地址的设计使计算机容易识别,但对于人却很难记住它们,为了解决这个问题,创建了/etc/hosts这个文件。下面是一个例子文件: 127.0.0.1 machine1 localhost.localdomain localhost 192.168.1.100 machine7 192.168.1.101 otherpc otheralias 在这个例子中,本机名是machine1,otherpc还有别名otheralias,它可以指向otheralias。。一旦配置完机器的网络配置文件,应该重新启动网络以使修改生效,使用下面的命令来重新启动网络: /etc/rc.d/init.d/network restart /etc/hosts文件通常含有主机名、localhost和系统管理员经常使用的系统别名,有时候telnet到Linux机器要等待很长时间,可以通过在"/etc/hosts"加入客户的机器的IP

相关文档
相关文档 最新文档