铺货车板:命令提示符中的arp命令

来源:百度文库 编辑:九乡新闻网 时间:2024/07/08 15:04:08
C:\Documents and Settings\Administrator>arp /?
Displays and modifies the IP-to-Physical address translation tables used byaddress 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.上面的分别是什么意思?
最佳答案

ARp是一个重要的TCp/Ip协议,并且用于确定对应Ip地址的网卡物理地址。实用arp命令,我们能够查看本地计算机或另一台计算机的ARp高速缓存中的当前内容。此外,使用arp命令,也可以用人工方式输入静态的网卡物理/Ip地址对,我们可能会使用这种方式为缺省网关和本地服务器等常用主机进行这项作,有助于减少网络上的信息量。 
按照缺省设置,ARp高速缓存中的项目是动态的,每当发送一个指定地点的数据报且高速缓存中不存在当前项目时,ARp便会自动添加该项目。一旦高速缓存的项目被输入,它们就已经开始走向失效状态。例如,在Windows NT/2000网络中,如果输入项目后不进一步使用,物理/Ip地址对就会在2至10分钟内失效。因此,如果ARp高速缓存中项目很少或根本没有时,请不要奇怪,通过另一台计算机或路由器的ping命令即可添加。所以,需要通过arp命令查看高速缓存中的内容时,请最好先ping 此台计算机(不能是本机发送ping命令)。 
ARp常用命令选项: 
·arp -a或arp –g 用于查看高速缓存中的所有项目。-a和-g参数的结果是一样的,多年来-g一直是UNIX平台上用来显示ARp高速缓存中所有项目的选项,而Windows用的是arp -a(-a可被视为all,即全部的意思),但它也可以接受比较传统的-g选项。 
·arp -a Ip 如果我们有多个网卡,那么使用arp -a加上接口的Ip地址,就可以只显示与该接口相关的ARp缓存项目。 
·arp -s Ip 物理地址 我们可以向ARp高速缓存中人工输入一个静态项目。该项目在计算机引导过程中将保持有效状态,或者在出现错误时,人工配置的物理地址将自动更新该项目。 
·arp -d Ip 使用本命令能够人工删除一个静态项目。 
例如我们在命令提示符下,键入 Arp –a;如果我们使用过 ping 命令测试并验证从这台计算机到 Ip 地址为 10.0.0.99 的主机的连通性,则 ARp 缓存显示以下项: 
Interface:10.0.0.1 on interface 0x1 Internet Address physical Address Type 10.0.0.99 00-e0-98-00-7c-dc dynamic 
在此例中,缓存项指出位于 10.0.0.99 的远程主机解析成 00-e0-98-00-7c-dc 的媒体访问控制地址,它是在远程计算机的网卡硬件中分配的。媒体访问控制地址是计算机用于与网络上远程 TCp/Ip 主机物理通讯的地址。 
至此我们可以用ipconfig和ping命令来查看自己的网络配置并判断是否正确、可以用netstat查看别人与我们所建立的连接并找出ICQ使用者所隐藏的Ip信息、可以用arp查看网卡的MAC地址。