网络实验报告--常用网络命令

计算机网络课程-常用网络命令

实验报告

 

第二篇:计算机网络实验二 在PC机上熟悉常用网络命令实验报告

实验二  熟悉常用的网络命令

实验报告

姓名: 

班级:12级数字媒体技术2班

学号: 

指导教师: 

1.实验目的:

学会使用常用ping ,ipconfig, nslookup, arp ,tracert等常用网络测试命令检测网络连通、了解网络的配置状态,跟踪路由诊断域名系统等相关网络问题。

2实验环境:

(1)运行windows 2000/2003/xp操作系统的PC一台

(2)每台PC机具有一块网卡,通过双绞线与局域网网相连。

(3)局域网能连接Internet

3.实验步骤:

ftp://10.16.23.2

用户名:1234567891234

密码:0123456

1、ARP: 显示和修改IP地址与物理地址之间的转换表

C:\Documents and Settings\ligong>ARP -a

Interface: 10.16.24.18 --- 0x10003

  Internet Address      Physical Address      Type

  192.168.1.3           00-00-00-00-00-00     invalid

C:\Documents and Settings\ligong>ARP -g

Interface: 10.16.24.18 --- 0x10003

  Internet Address      Physical Address      Type

  192.168.1.3           00-00-00-00-00-00     invalid

C:\Documents and Settings\ligong>ARP -d

C:\Documents and Settings\ligong>ARP -s

Displays and modifies the IP-to-Physical address translation tables used by

address resolution protocol (ARP).

ARP -s inet_addr eth_addr [if_addr]

ARP -d inet_addr [if_addr]

ARP -a [inet_addr] [-N if_addr]

  -a            Displays current ARP entries by interrogating the current

                protocol data.  If inet_addr is specified, the IP and Physical

                addresses for only the specified computer are displayed.  If

                more than one network interface uses ARP, entries for each ARP

                table are displayed.

  -g            Same as -a.

  inet_addr     Specifies an internet address.

  -N if_addr    Displays the ARP entries for the network interface specified

                by if_addr.

  -d            Deletes the host specified by inet_addr. inet_addr may be

                wildcarded with * to delete all hosts.

  -s            Adds the host and associates the Internet address inet_addr

                with the Physical address eth_addr.  The Physical address is

                given as 6 hexadecimal bytes separated by hyphens. The entry

                is permanent.

  eth_addr      Specifies a physical address.

  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.

Example:

  > arp -s 157.55.85.212   00-aa-00-62-c6-09  .... Adds a static entry.

  > arp -a                                    .... Displays the arp table.

2、ftp:(功能就不用描述了,请参看下面的具体用法)

ftp> open 10.16.23.2

Connected to 10.16.23.2.

220 欢迎登陆计算机基础教研室FTP服务器

User (10.16.23.2:(none)): 1234567891234

331 User name okay, need password.

Password:

230 User logged in, proceed.

ftp> -v

Invalid command.

ftp> ftp -v

Invalid command.

ftp> ftp [-v]

Invalid command.

ftp> cd

Remote directory ftp !

550 /ftp: No such file or directory.

ftp> !

Microsoft Windows XP [版本 5.1.2600]

(C) 版权所有 1985-2001 Microsoft Corp.

3、Ipconfig

C:\Documents and Settings\ligong>ipconfig

Windows IP Configuration

Ethernet adapter 本地连接 2:

        Connection-specific DNS Suffix  . :

        IP Address. . . . . . . . . . . . : 192.168.1.119

        Subnet Mask . . . . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . . . . : 192.168.1.1

C:\Documents and Settings\ligong>

4、Nbtstat.exe

C:\Documents and Settings\ligong>nbtstat.exe

Displays protocol statistics and current TCP/IP connections using NBT

(NetBIOS over TCP/IP).

NBTSTAT [ [-a RemoteName] [-A IP address] [-c] [-n]

        [-r] [-R] [-RR] [-s] [-S] [interval] ]

  -a   (adapter status) Lists the remote machine's name table given its name

  -A   (Adapter status) Lists the remote machine's name table given its

                        IP address.

  -c   (cache)          Lists NBT's cache of remote [machine] names and their IP

 addresses

  -n   (names)          Lists local NetBIOS names.

  -r   (resolved)       Lists names resolved by broadcast and via WINS

  -R   (Reload)         Purges and reloads the remote cache name table

  -S   (Sessions)       Lists sessions table with the destination IP addresses

  -s   (sessions)       Lists sessions table converting destination IP

                        addresses to computer NETBIOS names.

  -RR  (ReleaseRefresh) Sends Name Release packets to WINS and then, starts Refr

esh

  RemoteName   Remote host machine name.

  IP address   Dotted decimal representation of the IP address.

  interval     Redisplays selected statistics, pausing interval seconds

               between each display. Press Ctrl+C to stop redisplaying

               statistics.

C:\Documents and Settings\ligong>nbtstat -C

Displays protocol statistics and current TCP/IP connections u

(NetBIOS over TCP/IP).

NBTSTAT [ [-a RemoteName] [-A IP address] [-c] [-n]

        [-r] [-R] [-RR] [-s] [-S] [interval] ]

  -a   (adapter status) Lists the remote machine's name table

  -A   (Adapter status) Lists the remote machine's name table

                        IP address.

  -c   (cache)          Lists NBT's cache of remote [machine]

 addresses

  -n   (names)          Lists local NetBIOS names.

  -r   (resolved)       Lists names resolved by broadcast and

  -R   (Reload)         Purges and reloads the remote cache n

  -S   (Sessions)       Lists sessions table with the destina

  -s   (sessions)       Lists sessions table converting desti

                        addresses to computer NETBIOS names.

  -RR  (ReleaseRefresh) Sends Name Release packets to WINS an

esh

  RemoteName   Remote host machine name.

  IP address   Dotted decimal representation of the IP addres

  interval     Redisplays selected statistics, pausing interv

               between each display. Press Ctrl+C to stop red

               statistics.

C:\Documents and Settings\ligong>nbtstat -n

本地连接 2:

Node IpAddress: [192.168.1.119] Scope Id: []

                NetBIOS Local Name Table

       Name               Type         Status

    ---------------------------------------------

    H16            <00>  UNIQUE      Registered

    H16            <20>  UNIQUE      Registered

    2HJF           <00>  GROUP       Registered

    2HJF           <1E>  GROUP       Registered

C:\Documents and Settings\ligong>nbtstat -s

本地连接 2:

Node IpAddress: [192.168.1.119] Scope Id: []

    No Connections

5、net:

C:\Documents and Settings\ligong>net

此命令的语法是:

NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |

      HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |

      SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]

C:\Documents and Settings\ligong>

C:\Documents and Settings\ligong>net

此命令的语法是:

NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE

      HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT |

      SHARE | START | STATISTICS | STOP | TIME | USE

C:\Documents and Settings\ligong>netstat.exe

Active Connections

  Proto  Local Address          Foreign Address

  TCP    H16:1455               localhost:ftp

  TCP    H16:2078               125.77.199.30:8000

  TCP    H16:2085               localhost:4809

  TCP    H16:2086               localhost:netbios-ss

  TCP    H16:2088               localhost:netbios-ss

  TCP    H16:2090               localhost:netbios-ss

  TCP    H16:2091               localhost:microsoft-

C:\Documents and Settings\ligong>netstat -as

IPv4 Statistics

  Packets Received                   = 188648

  Received Header Errors             = 0

  Received Address Errors            = 41385

  Datagrams Forwarded                = 0

  Unknown Protocols Received         = 0

  Received Packets Discarded         = 1636

  Received Packets Delivered         = 158463

  Output Requests                    = 11606

  Routing Discards                   = 0

  Discarded Output Packets           = 0

  Output Packet No Route             = 0

  Reassembly Required                = 0

  Reassembly Successful              = 0

  Reassembly Failures                = 0

  Datagrams Successfully Fragmented  = 0

  Datagrams Failing Fragmentation    = 0

  Fragments Created                  = 0

ICMPv4 Statistics

                            Received    Sent

  Messages                  36          37

  Errors                    0           0

  Destination Unreachable   3           4

  Time Exceeded             0           0

  Parameter Problems        0           0

  Source Quenches           0           0

  Redirects                 0           0

  Echos                     31          2

  Echo Replies              2           31

  Timestamps                0           0

  Timestamp Replies         0           0

  Address Masks             0           0

  Address Mask Replies      0           0

TCP Statistics for IPv4

  Active Opens                        = 415

  Passive Opens                       = 57

  Failed Connection Attempts          = 145

  Reset Connections                   = 29

  Current Connections                 = 3

  Segments Received                   = 1888

  Segments Sent                       = 2228

  Segments Retransmitted              = 276

UDP Statistics for IPv4

  Datagrams Received    = 213179

  No Ports              = 4718

  Receive Errors        = 95

  Datagrams Sent        = 9046

6、Netstat.exe

C:\Documents and Settings\ligong>netstat.exe

Active Connections

  Proto  Local Address          Foreign Address        State

  TCP    H16:1455               localhost:ftp          CLOSE_WAIT

  TCP    H16:2166               localhost:4809         SYN_SENT

  TCP    H16:2167               125.77.199.30:8000     ESTABLISHED

7、Ping.exe

C:\Documents and Settings\ligong>ping.exe

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]

            [-r count] [-s count] [[-j host-list] | [-k host-list]]

            [-w timeout] target_name

Options:

    -t             Ping the specified host until stopped.

                   To see statistics and continue - type Control-Break

                   To stop - type Control-C.

    -a             Resolve addresses to hostnames.

    -n count       Number of echo requests to send.

    -l size        Send buffer size.

    -f             Set Don't Fragment flag in packet.

    -i TTL         Time To Live.

    -v TOS         Type Of Service.

    -r count       Record route for count hops.

    -s count       Timestamp for count hops.

    -j host-list   Loose source route along host-list.

    -k host-list   Strict source route along host-list.

    -w timeout     Timeout in milliseconds to wait for each reply.

8、Route.exe

C:\Documents and Settings\ligong>route.exe

Manipulates network routing tables.

ROUTE [-f] [-p] [command [destination]

                  [MASK netmask]  [gateway] [METRIC metric]  [IF interface]

  -f           Clears the routing tables of all gateway entries.  If this is

               used in conjunction with one of the commands, the tables are

               cleared prior to running the command.

  -p           When used with the ADD command, makes a route persistent across

               boots of the system. By default, routes are not preserved

               when the system is restarted. Ignored for all other commands,

               which always affect the appropriate persistent routes. This

               option is not supported in Windows 95.

  command      One of these:

                 PRINT     Prints  a route

                 ADD       Adds    a route

                 DELETE    Deletes a route

                 CHANGE    Modifies an existing route

  destination  Specifies the host.

  MASK         Specifies that the next parameter is the 'netmask' value.

  netmask      Specifies a subnet mask value for this route entry.

               If not specified, it defaults to 255.255.255.255.

  gateway      Specifies gateway.

  interface    the interface number for the specified route.

  METRIC       specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database

file NETWORKS. The symbolic names for gateway are looked up in the host name

database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,

(wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only

matching destination routes are printed. The '*' matches any string,

and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

Diagnostic Notes:

    Invalid MASK generates an error, that is when (DEST & MASK) != DEST.

    Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1

             The route addition failed: The specified mask parameter is invalid.

 (Destination & Mask) != Destination.

Examples:

    > route PRINT

    > route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2

             destination^      ^mask      ^gateway     metric^    ^

                                                         Interface^

      If IF is not given, it tries to find the best interface for a given

      gateway.

    > route PRINT

    > route PRINT 157*          .... Only prints those matching 157*

    > route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2

      CHANGE is used to modify gateway and/or metric only.

    > route PRINT

    > route DELETE 157.0.0.0

    > route PRINT

C:\Documents and Settings\ligong>

9、Telnet.exe

欢迎使用 Microsoft Telnet Client

Escape 字符是 'CTRL+]'

Microsoft Telnet> display

Escape 字符是 'CTRL+]'

将验证身份(NTLM Authentication)

关闭本地回显

新行模式 - return 键发送 CR 和 LF

当前模式: 控制台

Will 终端类型

优选的终端类型为 ANSI

Microsoft Telnet> status

没有连接

Microsoft Telnet> ?/help

命令可以缩写。支持的命令为:

c    - close                    关闭当前连接

d    - display                  显示操作参数

o    - open hostname [port]     连接到主机名称(默认端口 23).

q    - quit                     退出 telnet

set  - set                      设置选项 (要列表,请键入 'set

sen  - send                     将字符串发送到服务器

st   - status                   打印状态信息

u    - unset                    解除设置选项 (要列表,请键入 '

?/h  - help                     打印帮助信息

Microsoft Telnet> set

格式为 'set Name '

要查看帮助,请键入 'set ?'。

Microsoft Telnet>

10、Tracert.exe

C:\Documents and Settings\ligong>Tracert.exe

Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name

Options:

    -d                 Do not resolve addresses to hostnames.

    -h maximum_hops    Maximum number of hops to search for target.

    -j host-list       Loose source route along host-list.

    -w timeout         Wait timeout milliseconds for each reply.

11、Winipcfg.exe

C:\Documents and Settings\ligong>winipcfg.exe

'winipcfg.exe' 不是内部或外部命令,也不是可运行的程序

或批处理文件。

12、Winpopup.exe

C:\Documents and Settings\ligong>Winpopup.exe

'Winpopup.exe' 不是内部或外部命令,也不是可运行的程序

或批处理文件。

四、实验小结

a. 实验前不了解各命令的具体用途,尤其是ARP命令,在阅读实验指导后,通过实践知道了各命令的用处,ARP命令所添加的静态项不能是已经有的静态项。

b. ipconfig不能直接读出默认网关,通过ipconfig/all命令显示完整TCP/IP信息。

通过查阅资料和向老师同学询问,初步理解了PC机上常用的网络命令。

相关推荐