才子佳人博客

我的故事我讲述

诊断网络常用的6个命令简介
###SmallArticleTitle###
来源:xjh;  编辑:xjh;  2008-09-04

诊断网络常用的6个命令:Ping ,ifconfig/ipconfig ,tracert/traceroute ,netstat ,Arp ,nslookup

中文详细用法见附件:网络常用命令.txt

网络常用命令
1.Ping

主要功能:该命令主要是用来检查路由是否能够到达。

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] [-R] [-S srcaddr] [-4] [-6] 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 Dont Fragment flag in packet (IPv4-only).

-i TTL Time To Live.

-v TOS Type Of Service (IPv4-only).

-r count Record route for count hops (IPv4-only).

-s count Timestamp for count hops (IPv4-only).

-j host-list Loose source route along host-list (IPv4-only).

-k host-list Strict source route along host-list (IPv4-only).

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

-R Trace round-trip path (IPv6-only).

-S srcaddr Source address to use (IPv6-only).

-4 Force using IPv4.

-6 Force using IPv6.


2.ipconfig、ifconfig

主要功能:用来显示主机内IP协议的配置信息。

适用环境:ipconfi适用于Windows NT/2000/XP,ifconfig 适用于linux。

Usage:

ifconfig [-a] [-i] [-v] [-s] <interface> [[<AF>] <address>]

[add <address>[/<prefixlen>]]

[del <address>[/<prefixlen>]]

[[-]broadcast [<address>]] [[-]pointopoint [<address>]]

[netmask <address>] [dstaddr <address>] [tunnel <address>]

[outfill <NN>] [keepalive <NN>]

[hw <HW> <address>] [metric <NN>] [mtu <NN>]

[[-]trailers] [[-]arp] [[-]allmulti]

[multicast] [[-]promisc]

[mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]

[txqueuelen <NN>]

[[-]dynamic]

[up|down] ...


3.tracert/traceroute

主要功能:判定数据包到达目的主机所经过的路径、显示数据包经过的中继节点清单和到达时间。

适用环境:tracert适用环境于WIN95/98/2000/NT, traceroute适用于linux。

Usage: traceroute [-dFInrvx] [-g gateway] [-i iface] [-f first_ttl]

[-m max_ttl] [ -p port] [-q nqueries] [-s src_addr] [-t tos]

[-w waittime] [-z pausemsecs] host [packetlen]

4.netstat

主要功能:netstat程序有助于我们了解网络的整体使用情况。它可以显示当前正在活动的网络连接的详细信息,例如显示网络连接、路由表和网络接口信息,可以让用户得知目前总共有哪些网络连接正在运行。

适用环境:WIN95/98/2000/NT/linux

usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}

netstat [-vnNcaeol] [<Socket> ...]

netstat { [-veenNac] -i[<Iface>] | [-cnNe] -M | -s } [delay]

-r, --route display routing table

-i, --interfaces=[<Iface>] display interface table

-g, --groups display multicast group memberships

-s, --statistics display networking statistics (like SNMP)

-M, --masquerade display masqueraded connections

-v, --verbose be verbose

-n, --numeric dont resolve names

--numeric-hosts dont resolve host names

--numeric-ports dont resolve port names

--numeric-users dont resolve user names

-N, --symbolic resolve hardware names

-e, --extend display other/more information

-p, --programs display PID/Program name for sockets

-c, --continuous continuous listing

-l, --listening display listening server sockets

-a, --all, --listening display all sockets (default: connected)

-o, --timers display timers

-F, --fib display Forwarding Information Base (default)

-C, --cache display routing cache instead of FIB


5.Arp

主要功能:显示和修改“地址解析协议”(ARP) 所使用的到以太网的 IP 或令牌环物理地址翻译表。该命令只有在安装了 TCP/IP 协议之后才可用。

Usage:

arp [-vn] [<HW>] [-i <if>] [-a] [<hostname>] <-Display ARP cache

arp [-v] [-i <if>] -d <hostname> [pub][nopub] <-Delete ARP entry

arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file

arp [-v] [<HW>] [-i <if>] -s <hostname> <hwaddr> [temp][nopub] <-Add entry

arp [-v] [<HW>] [-i <if>] -s <hostname> <hwaddr> [netmask <nm>] pub <--

arp [-v] [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub <--

-a display (all) hosts in alternative (BSD) style

-e display (all) hosts in default (Linux) style

-s, --set set a new ARP entry

-d, --delete delete a specified entry

-v, --verbose be verbose

-n, --numeric dont resolve names

-i, --device specify network interface (e.g. eth0)

-D, --use-device read <hwaddr> from given device

-A, -p, --protocol specify protocol family

-f, --file read new entries from file or from /etc/ethers

<HW>=Use -H <hw> to specify hardware address type. Default: ether

List of possible hardware types (which support ARP):

strip (Metricom Starmode IP) ash (Ash) ether (Ethernet)

tr (16/4 Mbps Token Ring) tr (16/4 Mbps Token Ring (New)) ax25 (AMPR AX.25)

netrom (AMPR NET/ROM) rose (AMPR ROSE) arcnet (ARCnet)

dlci (Frame Relay DLCI) fddi (Fiber Distributed Data Interface) hippi (HIPPI)

irda (IrLAP) x25 (generic X.25)

6.nslookup

主要功能:连接DNS服务器,查询域名信息的一个非常有用的命令。

Usage:

nslookup [-opt ...] # interactive mode using default server

nslookup [-opt ...] - server # interactive mode using server

nslookup [-opt ...] host # just look up host using default server

nslookup [-opt ...] host server # just look up host using server

分类:网络日志 | 评论数:0 | 浏览数:279
相关文章
文章点击排行
本年度文章点击排行
发表评论:
  • 昵称: *
  • 邮箱: *
  • 网址:
  • 评论:(最多100字)
  • 验证码: