班级:软件
学号:
姓名:
实验1.1 验证常用的网络命令
[实验目的]:
熟悉windows下的一些网络命令的功能和使用方法。进而能用这些命令察看网络的状况并解决网络中的一些问题。 [实验要求]:
1、请尝试以下一些windows下的网络命令,记录实验的过程、结果以及遇到的问题及解决方法,并撰写实验总结。 [实验过程]: 实验内容 (1) Ipconfig
该诊断命令显示所有当前的 TCP/IP 网络配置值。该命令在运行 DHCP 系统上的特殊用途,允许用户决定 DHCP 配置的 TCP/IP 配置值。 ipconfig [/? | /all | /release [adapter] | /renew [adapter] | /flushdns | /registerdns
| /showclassid adapter |/displaydns | /setclassid adapter [classidtoset] ]
/all 产生完整显示。在没有该开关的情况下 ipconfig 只显示 IP 地址、子网掩码和每个网卡的默认网关值。
例如: C:\\>ipconfig
Windows 2000 IP Configuration Ethernet adapter 本地连接:
Connection-specific DNS Suffix . : //IP地址 //子网掩码 //缺省网关
C:\\>ipconfig /displaydns //显示本机上的DNS域名解析列表 C:\\>ipconfig /flushdns //删除本机上的DNS域名解析列表 (2) ARP:
显示和修改IP地址与物理地址之间的转换表 ARP -s inet_addr eth_addr [if_addr] ARP -d inet_addr [if_addr] ARP -a [inet_addr] [-N if_addr]
-a 显示当前的ARP信息,可以指定网络地址 -g 跟 -a一样.
-d 删除由inet_addr指定的主机.可以使用* 来删除所有主机.
-s 添加主机,并将网络地址跟物理地址相对应,这一项是永久生效的。 eth_addr 物理地址.
if_addr If present, this specifies the Internet address of the
interface whose address translation table should be modified. If not present, the first applicable interface will be used.
例子:
C:\\>arp –a (显示当前所有的表项)
Internet Address Physical Address Type dynamic //物理地址一般为48位即6个字节
(只显示其中一项) No ARP Entries Found
(只显示其中一项) terface 0x1000003
Internet Address Physical Address Type
C:\\>添加,可以再打入arp –a 验证是否已经加入.
(3) Netstat (网络状态)
显示协议统计和当前的 TCP/IP 网络连接。该命令只有在安装了 TCP/IP 协议后才可以使用。
netstat [-a] [-e] [-n] [-s] [-b] [-p protocol] [-r] [interval] 参数
-a 显示所有连接和侦听端口。服务器连接通常不显示。 -b 显示使用该端口的程序。
-e 显示以太网统计。该参数可以与 -s 选项结合使用。 -n 以数字格式显示地址和端口号(而不是尝试查找名称)。
-s 显示每个协议的统计。默认情况下,显示 TCP、UDP、ICMP 和 IP 的统计。-p 选项可以用来指定默认的子集。
-p protocol 显示由 protocol 指定的协议的连接;protocol 可以是 tcp 或 udp。如果与 -s 选项一同使用显示每个协议的统计,protocol 可以是 tcp、udp、icmp 或 ip。
-r 显示路由表的内容。
Interval 重新显示所选的统计,在每次显示之间暂停 interval 秒。按 CTRL+B 停止重新显示统计。如果省略该参数,netstat 将打印一次当前的配置信息。 例如: C:\\>netstat –nab …
8.157:4466 ESTABLISHED [ikuacc.exe] [ftp.exe]
[thunderplatform.exe] …
C:\\>netstat -as IP Statistics
Packets Received = 256325 …
ICMP Statistics
Received Sent Messages 16 68 … TCP Statistics …
Segments Received = 41828 UDP Statistics
Datagrams Received = 82401 …
(4)Route
控制网络路由表。该命令只有在安装了 TCP/IP 协议后才可以使用。
route [-f] [-p] [command [destination] [mask subnetmask] [gateway] [metric costmetric]] 参数
-f 清除所有网关入口的路由表。如果该参数与某个命令组合使用,路由表将在运行命令前清除。
-p 该参数与 add 命令一起使用时,将使路由在系统引导程序之间持久存在。默认情况下,系统重新启动时不保留路由。与 print 命令一起使用时,显示已注册的持久路由列表。忽略其他所有总是影响相应持久路由的命令。 Command 指定下列的一个命令。 命令 目的 print 显示打印路由 add 添加路由 Delete 删除路由
change 更改现存路由
destination 指定发送 command 的计算机。 mask subnetmask gateway 指定网关。
metric costmetric 指派整数跃点数(从 1 到 9999)在计算最快速、最可靠和(或)最便宜
的路由时使用。
例如:
C:\\>route print (键入此命令查看路由表,看是否已经添加了)
C:\\>route print (此时可以看见已经没了添加的项)
如下命令用于测试-- (5) Ping
验证与远程计算机的连接。该命令只有在安装了 TCP/IP 协议后才可以使用。
ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [[-j computer-list] | [-k computer-list]] [-w timeout] destination-list 参数
-t Ping 指定的计算机直到中断。 -a 将地址解析为计算机名。
-n count 发送 count 指定的 ECHO 数据包数。默认值为 4。
-l length 发送包含由 length 指定的数据量的 ECHO 数据包。默认为 32 字节;最大值是 65,527。
-f 在数据包中发送“不要分段”标志。数据包就不会被路由上的网关分段。 -i ttl将“生存时间”字段设置为 ttl 指定的值。 -v tos 将“服务类型”字段设置为 tos 指定的值。
-r count 在“记录路由”字段中记录传出和返回数据包的路由。count 可以指定最少 1 台,
最多 9 台计算机。
-s count 指定 count 指定的跃点数的时间戳。
-j computer-list 利用 computer-list 指定的计算机列表路由数据包。连续计算机可以被中间网
关分隔(路由稀疏源)IP 允许的最大数量为 9。
-k computer-list 利用 computer-list 指定的计算机列表路由数据包。连续计算机不能被中间
网关分隔(路由严格源)IP 允许的最大数量为 9。
-w timeout 指定超时间隔,单位为毫秒。 destination-list 指定要 ping 的远程计算机。 较一般的用法是 ping – 例如: Pingi
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 10ms, Average = 2ms
(6) Tracert
该诊断实用程序将包含不同生存时间 (TTL) 值的 Internet 控制消息协议 (ICMP) 回显数据包发送到目标,以决定到达目标采用的路由。要在转发数据包上的 TTL 之前至少递减 1,必需路径上的每个路由器,所以 TTL 是有效的跃点计数。数据包上的 TTL 到达 0 时,路由器应该将“ICMP 已超时”的消息发送回源系统。Tracert 先发送 TTL 为 1 的回显数据包,并在随后的每次发送过程将 TTL 递增 1,直到目标响应或 TTL 达到最大值,从而确定路由。路由通过检查中级路由器发送回的“ICMP 已超时”的消息来确定路由。不过,有些路由器悄悄地下传包含过期 TTL 值的数据包,而 tracert 看不到。
tracert [-d] [-h maximum_hops] [-j computer-list] [-w timeout] target_name 参数
/d 指定不将地址解析为计算机名。
-h maximum_hops 指定搜索目标的最大跃点数。 -j computer-list 指定沿 computer-list 的稀疏源路由。 -w timeout 每次应答等待 timeout 指定的微秒数。 target_name 目标计算机的名称。
最简单的一种用法如下: C:\\>tracert
over a maximum of 30 hops:
3 <10 ms <10 Trace complete.
(7) nslookup 域名解析
nslookup这个名字的意思是:\"name server lookup\"。这个命令行工具是内置的命令行工具, windows和unix上都有. 能允许用户查询网络中的域IP地址, 或主机的IP地址。 基本格式:nslookup [-option ...] [computer-to-find | - [server]] 模式
Nslookup 有两种模式:交互式(有提示符,逐个输入域名)和非交互式(一次把参数都给它)。
如果仅需要查找一块数据,请使用非交互式模式。若使用交互模式,对于第一个参数,键入要查找的计算机的名称或 IP 地址。对于第二个参数,键入 DNS 名称服务器的名称或 IP 地址。如果忽略第二个参数,将使用默认的 DNS 名称服务器。 例如:
C:\\Users\\Mufchen>nslookup -type=A Addr
Non-authoritative answer:
Aliases:
如果需要查找多块数据,可以使用交互式模式。第一个参数键入连字符 (-),第二个参数键入 DNS 名称服务器的名称或 IP 地址。或者,省略使用的参数和默认 DNS 名称服务器。 例如:
C:\\Users\\Mufchen>nslookup Default Server: xslns5
Server: xslns5
Non-authoritative answer:
Server: xslns5
Non-authoritative answer: Aliases >
常用的一些 option/command 1. set all
可以得知目前 nslookup 的一些 default 设定值 tung@traveler:~> nslookup > set all
Address: 140.116.72.14 Set options:
nodebug defname search recurse nod2 novc noignoretc port=53 ..
querytype=A class=IN timeout=5 retry=4 root=a.root-servers.net.
2. server dns_server_ip
表示将内定的 local DNS 换成另一部 server
3. set type=any|A|CNAME|NS|MX
表示在查询某个 domain name 时, 将和这个 domain name 的一些相关资料一并显示出来 > set type=any
Non-authoritative answer:
yohoo canonical name = yohoo Authoritative answers can be found from:
(8) ftp 命令行或图形化界面使用 文件传输命令
该命令只有在安装了 TCP/IP 协议之后才可用。Ftp 是一种服务,一旦启动,将创建在其中可以使用 ftp 命令的子环境,通过键入 quit 子命令可以从子环境返回到 Windows 2000 命令提示符。当 ftp 子环境运行时,它由 ftp 命令提示符代表。 ftp [-v] [-n] [-i] [-d] [-g] [-s:filename] [-a] [-w:windowsize] [computer] 参数
-v 禁止显示远程服务器响应。 -n 禁止自动登录到初始连接。 -I 多个文件传送时关闭交互提示。
-d 启用调试、显示在客户端和服务器之间传递的所有 ftp 命令。
-g 禁用文件名组,它允许在本地文件和路径名中使用通配符字符(* 和 ?)。(请参阅联机“命令参考”中的 glob 命令。)
-s: filename指定包含 ftp 命令的文本文件;当 ftp 启动后,这些命令将自动运行。该参数
中不允许有空格。使用该开关而不是重定向 (>)。 -a 在捆绑数据连接时使用任何本地接口。
-w:windowsize 替代默认大小为 4096 的传送缓冲区。
Computer 指定要连接到远程计算机的计算机名或 IP 地址。如果指定,计算机必须是行的最后一个参数。 下面是一些常用命令:
!: 从ftp子系统退出到系统外壳 ?:显示ftp说明,跟help一样
append: 添加文件,格式为:append 本地文件 远程文件
cd: 更换远程目录
lcd: 更换本地目录,若无参数,将显示当前目录 open:与指定的ftp服务器连接 open computer [port] close:结束与远程服务器的 FTP 会话并返回命令解释程序 bye:结束与远程计算机的 FTP 会话并退出 ftp dir: 结束与远程计算机的 FTP 会话并退出 ftp
get 和 recv:使用当前文件转换类型将远程文件复制到本地计算机 get remote-file [local-file] send 和 put:上传文件:send local-file [remote-file] 其它命令请参考帮助文件。 例子:
220 Serv-U FTP Server v6.2 for WinSock ready...
331 User name okay, need password. Password:
230 User logged in, proceed. ftp> dir //查看本目录下的内容: 200 PORT Command successful.
150 Opening ASCII mode data connection for /bin/ls. drw-rw-rw- 1 user group 0 Sep 27 16:06 . drw-rw-rw- 1 user group 0 Sep 27 16:06 ..
-rw-rw-rw- 1 user group 1449143 Sep 26 10:13 Chapter2_4e_Part1(Intro_H TTP_DNS).ppt.rar …
226 Transfer complete.
ftp: 1391 bytes received in 0.04Seconds 34.77Kbytes/sec. ftp> cd _tools //切换目录 250 Directory changed to / _Tools ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for file list. … ftp> cd ..
ftp> lcd e:\\ //本地目录切换 Local directory now E:\\. ftp> get test.txt //下载文件 200 PORT Command successful.
150 Opening ASCII mode data connection for test.txt (4 Bytes). 226 Transfer complete.
ftp: 4 bytes received in 0.00Seconds 4000.00Kbytes/sec.
ftp> bye //离开 221 Goodbye.
(9) netsh
Configures networking services from the command line.
Description
This group of commands enables command-line administration of networking services such as DHCP, DNS, Routing and Remote Access, and WINS. NetShell (netsh.exe) is a command-line scripting tool that can administer these services on local or remote computers in both interactive and batch mode. It provides a shell from which you can enter different contexts for administering each service. Contexts are provided by helper DLLs, which extend NetShell's functionality by providing service-specific command sets. Some contexts have subcontexts as well, which are described in the following entries.
NetShell supports two kinds of commands:
Global commands
These can be run within any context and provide general functionality to the shell.
Context-specific commands
These are commands specific to a given context (see later in this section and in the following entries).
The various contexts and subcontexts currently supported by NetShell include the following:
AAAA
Configures the AAAA component that is used by both Routing and Remote Access and Internet Authentication Service
DHCP
Configures DHCP servers
Server
Subcontext for configuring a specific DHCP server
Interface
Configures demand-dial interfaces
IP
Subcontext for configuring IP demand-dial interfaces
RAS
Configures remote-access servers
IP, IPX, NETBEUI, Appletalk, AAAA
Possible subcontexts for configuring RAS
Routing
Configures IP and IPX routing
IP, IPX
Possible subcontexts for configuring routing
WINS
Configures WINS servers
NetShell can be run in two command modes:
Interactive (online) mode
Commands typed at the NetShell prompt (netsh>) are executed immediately.
Batch (offline) mode
Commands typed at the NetShell prompt are collected and then run as a batch job using the commit command. Note that this is only for router-configuration commands in the routing context.
In addition, you can create a text file containing a script of NetShell commands and then run the script using the -f switch or exec command (see netsh--Global Context).
Syntax
netsh [-a Aliasfile] [-c Context] [-r RemoteComputer] [command | -f Scriptfile]
Options
-a Aliasfile
Specifies an alias file to use. It is a file containing a list of NetShell commands together with an alias to allow the commands to be used by just typing the alias name (useful for mapping commands on other platforms, such as Unix, to specific NetShell commands).
-c Context
Opens the NetShell shell and switches immediately to the specified context.
-r RemoteComputer
Specifies the remote computer on which NetShell commands are to be executed. The computer can be specified using its computer name (NetBIOS or DNS name) or IP address. If this option is omitted, the commands are executed on the local computer.
command
Specifies any NetShell global command to be executed immediately (see the following \"Examples\" section).
-f Scriptfile
Runs the NetShell commands found in the file Scriptfile (include path).
Examples
Open the NetShell shell:
C:\\>netsh netsh>
Open the NetShell shell in the DHCP context to configure DHCP interactively: C:\\>netsh -c dhcp dhcp>
Open the NetShell shell, switch to the IP subcontext of the Interface context, obtain IP address information about the network interface, and return to the command shell:
C:\\>
Configuration for interface \"Local Area Connection\" DHCP enabled: No
GatewayMetric: 1 InterfaceMetric: 1 C:\\>
任务:
1. 利用上述命令检测本机与教师机的网络连接情况。 2.
3. 利用上述命令获取某个IP地址对应的MAC地址。
4. 5.
实验1.2使用网络协议分析器
[实验要求]:
1、 利用Wireshark进行基本网络协议分析。
2、 两人为一组,利用Wireshark及其他网络命令对IPmsg(飞鸽传书)的网络行为进
行分析。
记录实验的过程、结果以及遇到的问题及解决方法,并撰写实验总结。 IP头的分析
Ip头的格式如上图,所截获的TCP包中IP首部的信息如下图
由图中的可知ip首部的信息对应如下表格 4 20 9725 128 TCP(6) 192.168.1.100 122.97.252. 0 010(二进制) 0x9c0b 40 0 TCP头的分析
TCP头的格式如上图,所截获的TCP包中TCP首部的信息如下图
由图中的可知ip首部的信息对应如下表格
41609 260 207 20 000000(保留6位) 0xc319 0 1 0 0 0 1 16508 0 80 UDP头的分析
UDP头的格式如上图,所截获的UDP包中UDP首部的信息如下图
由图中的可知ip首部的信息对应如下表格 4000 47 8000 0x1b31 分析TCP建立连接的三次握手过程,分析其ACK,SYN,序号,和确认号字段 1、打开capture interface
2
3
4 、接下来是TCP 三次握手的第三步主机发送TCP 包给谷歌网站,其序列号是1 ,表明请求的下一个TCP包的序列号为1 ;确认号为1 ,表明是对第2732 个包的确认,而且其ACK 位为1 ,即ACK 包。截图如下
5 、至此,TCP 协议的三次握手过程已经完成,主机和谷歌网站之间已经建立连接,可以进行数据传输。
分析PING命令产生的数据包结构和工作过程
从16到23个包,都是在ping baidu 过程中产生的,由图可知,ping命令使用的是icmp报文,wireshark中的icmp报文格式如下
Ping命令是用来测试网络连通性的,在进行测试时, 飞鸽传书测试
由上图可见飞鸽传书使用的是UDP协议,使用的端口是2425
如上图,当用户名为“huixiong”的用户给我发“nb”消息时,在这里可以抓大(红色方框)中,同理也可以抓到我发的消息,所以飞鸽传书聊天内容不加密
调试过程
在学习net send命令时,首先是在win7系统下,这个命令不可以使用,然后换到xp系统时,发现总是不能给指定的ip发送消息,后来发现没有启动messenger服务,可是启动后,依然不能发送,又去调了下防火墙的相关设置,可是还是不能发送,上网查资料依然无果,还希望老师给以指正。
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- vipyiyao.com 版权所有 湘ICP备2023022495号-8
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务