zoukankan      html  css  js  c++  java
  • nslookup、arp、netstat、traceroute

    nslookup

      主要用于测试DNS服务器是否正常工作,除此之外,还可以对域名和IP地址进行查询。

    [root@weekend110 ~]# nslookup
    > www.guet.edu.cn        输入待查询的域名  www.guet.edu.cn
    Server: 192.168.80.2
    Address: 192.168.80.2#53

    以上为所使用的DNS服务器

    Non-authoritative answer:
    Name: www.guet.edu.cn
    Address: 202.193.64.56
    Name: dns.guet.edu.cn
    Address: 202.103.243.112
    Name: mango.guet.edu.cn
    Address: 202.193.64.33
    > 202.193.64.33      输入待查询的IP地址
    Server: 192.168.80.2
    Address: 192.168.80.2#53

    以上为所使用的DNS服务器

    Non-authoritative answer:
    33.64.193.202.in-addr.arpa name = 33.64.193.202.in-addr.arpa.
    33.64.193.202.in-addr.arpa name = mango.gliet.cn.
    33.64.193.202.in-addr.arpa name = mango.gliet.edu.cn.

    Authoritative answers can be found from:
    193.202.in-addr.arpa nameserver = dns.gliet.cn.
    193.202.in-addr.arpa nameserver = mango.gliet.cn.
    dns.gliet.cn internet address = 202.103.243.112
    mango.gliet.cn internet address = 202.193.64.33
    > exit      退出nslookup命令环境

    [root@weekend110 ~]#

      也可以,不进入nslookup命令交互模式,直接使用命令查询IP地址或域名使用的DNS服务器。

    [root@weekend110 ~]# nslookup www.guet.edu.cn
    Server: 192.168.80.2
    Address: 192.168.80.2#53

    Non-authoritative answer:
    Name: www.guet.edu.cn
    Address: 202.193.64.56
    Name: dns.guet.edu.cn
    Address: 202.103.243.112
    Name: mango.guet.edu.cn
    Address: 202.193.64.33

    [root@weekend110 ~]# nslookup 202.193.64.33        查询IP地址为202.193.64.33的服务器的域名
    Server: 192.168.80.2
    Address: 192.168.80.2#53

    Non-authoritative answer:
    33.64.193.202.in-addr.arpa name = 33.64.193.202.in-addr.arpa.
    33.64.193.202.in-addr.arpa name = mango.gliet.cn.
    33.64.193.202.in-addr.arpa name = mango.gliet.edu.cn.

    Authoritative answers can be found from:
    193.202.in-addr.arpa nameserver = mango.gliet.cn.
    193.202.in-addr.arpa nameserver = dns.gliet.cn.
    dns.gliet.cn internet address = 202.103.243.112
    mango.gliet.cn internet address = 202.193.64.33

    [root@weekend110 ~]# nslookup 202.193.64.56
    Server: 192.168.80.2
    Address: 192.168.80.2#53

    Non-authoritative answer:
    56.64.193.202.in-addr.arpa name = 56.64.193.202.in-addr.arpa.

    Authoritative answers can be found from:
    193.202.in-addr.arpa nameserver = dns.gliet.cn.
    193.202.in-addr.arpa nameserver = mango.gliet.cn.
    dns.gliet.cn internet address = 202.103.243.112
    mango.gliet.cn internet address = 202.193.64.33

    [root@weekend110 ~]#

     arp

      arp可以实现,从IP地址到以太网MAC地址之间的转换。

    [root@weekend110 ~]# man arp
    ARP(8) Linux Programmer’s Manual ARP(8)

    NAME
    arp - manipulate the system ARP cache

    SYNOPSIS
    arp [-evn] [-H type] [-i if] -a [hostname]

    arp [-v] [-i if] -d hostname [pub]

    arp [-v] [-H type] [-i if] -s hostname hw_addr [temp]

    arp [-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub

    arp [-v] [-H type] [-i if] -Ds hostname ifa [netmask nm] pub

    arp [-vnD] [-H type] [-i if] -f [filename]

    NOTE
    This program is obsolete. For replacement check ip neighbor.

    DESCRIPTION
    Arp manipulates the kernel’s ARP cache in various ways. The primary options are clearing an address mapping
    entry and manually setting up one. For debugging purposes, the arp program also allows a complete dump of the
    ARP cache.

    OPTIONS
    -v, --verbose
    Tell the user what is going on by being verbose.

    -n, --numeric

     arp -a        以BSD默认格式显示arp表中的所有记录项

     arp -e        以linux默认格式显示arp表中的所有记录项

     arp -s         设置一个新的arp记录项

     arp -d        删除一个arp记录项

     arp -i        指定网络接口

     arp -f         从指定文件中读取新的记录项

     arp -v        冗余模式

    [root@weekend110 ~]# arp -a      
    ? (192.168.80.2) at 00:50:56:f4:e1:51 [ether] on eth0
    WIN-BQOBV63OBNM (192.168.80.1) at 00:50:56:c0:00:08 [ether] on eth0
    [root@weekend110 ~]# arp -e
    Address HWtype HWaddress Flags Mask Iface
    192.168.80.2 ether 00:50:56:f4:e1:51 C eth0
    WIN-BQOBV63OBNM ether 00:50:56:c0:00:08 C eth0
    [root@weekend110 ~]#

    netstat

      用于显示网络的连接状态、查询路由表和对网络接口进行统计。

    [root@weekend110 ~]# man netstat
    NETSTAT(8) Linux Programmer’s Manual NETSTAT(8)

    NAME
    netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast
    memberships

    SYNOPSIS
    netstat [address_family_options] [--tcp|-t] [--udp|-u] [--raw|-w] [--listening|-l] [--all|-a] [--numeric|-n]
    [--numeric-hosts][--numeric-ports][--numeric-ports] [--symbolic|-N] [--extend|-e[--extend|-e]] [--timers|-o]
    [--program|-p] [--verbose|-v] [--continuous|-c] [delay]

    netstat {--route|-r} [address_family_options] [--extend|-e[--extend|-e]] [--verbose|-v] [--numeric|-n]
    [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c] [delay]

    netstat {--interfaces|-I|-i} [iface] [--all|-a] [--extend|-e] [--verbose|-v] [--program|-p] [--numeric|-n]
    [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c] [delay]

    netstat {--groups|-g} [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c]
    [delay]

    netstat {--masquerade|-M} [--extend|-e] [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports]
    [--continuous|-c] [delay]

    netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--raw|-w] [delay]

    netstat {--version|-V}

    netstat {--help|-h}

    address_family_options:

    [--protocol={inet,inet6,unix,ipx,ax25,netrom,ddp, ... } ] [--unix|-x] [--inet|--ip] [--ax25] [--ipx] [--netrom]
    [--ddp]

    NOTE
    This program is obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement

     netstat -r      显示核心路由表

     netstat -g      显示多播组成员信息

     netstat -c      进行动态显示,每隔1秒更新1次

     netstat -p      显示每个socket所属的进程号和程序名

     netstat -l      显示所有处于侦听模式的socket

     netstat -a       显示所有的socket,无论其是否处于侦听状态

     netstat -n      以IP地址形式(即数字格式)进行显示

      查看当前linux系统中的,路由表

     

    [root@weekend110 ~]# netstat -r
    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    192.168.80.0 * 255.255.255.0 U 0 0 0 eth0
    link-local * 255.255.0.0 U 0 0 0 eth0
    default 192.168.80.2 0.0.0.0 UG 0 0 0 eth0
    [root@weekend110 ~]#

      查看当前linux系统中所有处于侦听状态的socket

    [root@weekend110 ~]# netstat -l
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 0 *:sunrpc *:* LISTEN
    tcp 0 0 *:ssh *:* LISTEN
    tcp 0 0 localhost:ipp *:* LISTEN
    tcp 0 0 localhost:smtp *:* LISTEN
    tcp 0 0 *:42011 *:* LISTEN
    tcp 0 0 *:sunrpc *:* LISTEN
    tcp 0 0 *:ssh *:* LISTEN
    tcp 0 0 localhost:ipp *:* LISTEN
    tcp 0 0 localhost:smtp *:* LISTEN
    tcp 0 0 *:36611 *:* LISTEN
    udp 0 0 *:sunrpc *:*
    udp 0 0 *:dec_dlm *:*
    udp 0 0 *:ipp *:*
    udp 0 0 *:vacdsm-app *:*
    udp 0 0 *:57815 *:*
    udp 0 0 *:sunrpc *:*
    udp 0 0 *:dec_dlm *:*
    udp 0 0 *:45438 *:*
    Active UNIX domain sockets (only servers)
    Proto RefCnt Flags Type State I-Node Path
    unix 2 [ ACC ] STREAM LISTENING 14040 public/cleanup
    unix 2 [ ACC ] STREAM LISTENING 13165 /var/run/cups/cups.sock
    unix 2 [ ACC ] STREAM LISTENING 13232 /var/run/acpid.socket
    unix 2 [ ACC ] STREAM LISTENING 14204 /var/run/abrt/abrt.socket
    unix 2 [ ACC ] STREAM LISTENING 17430 /tmp/orbit-root/linc-7d0-0-4bd6383e5553e
    unix 2 [ ACC ] STREAM LISTENING 16499 /tmp/keyring-8HHVIm/socket
    unix 2 [ ACC ] STREAM LISTENING 17537 /tmp/orbit-root/linc-7db-0-7588364fa30
    unix 2 [ ACC ] STREAM LISTENING 19412 /tmp/orbit-root/linc-8e5-0-721f687210c51
    unix 2 [ ACC ] STREAM LISTENING 17602 /tmp/orbit-root/linc-7ed-0-5e98d0f082c23
    unix 2 [ ACC ] STREAM LISTENING 19149 /tmp/orbit-root/linc-827-0-332326bc39787
    unix 2 [ ACC ] STREAM LISTENING 17679 /tmp/orbit-root/linc-7f0-0-7172996f4d82
    unix 2 [ ACC ] STREAM LISTENING 17318 /tmp/keyring-8HHVIm/socket.ssh
    unix 2 [ ACC ] STREAM LISTENING 9291 @/com/ubuntu/upstart
    unix 2 [ ACC ] STREAM LISTENING 17803 /tmp/orbit-root/linc-7f8-0-6c7fd4bd93072
    unix 2 [ ACC ] STREAM LISTENING 17808 /tmp/orbit-root/linc-7f7-0-7a6b30919fbd0
    unix 2 [ ACC ] STREAM LISTENING 18113 /tmp/orbit-root/linc-812-0-7eebc3b381f7
    unix 2 [ ACC ] STREAM LISTENING 18127 /tmp/orbit-root/linc-810-0-5dede9ea43407
    unix 2 [ ACC ] STREAM LISTENING 18147 /tmp/orbit-root/linc-814-0-27515ff3110f1
    unix 2 [ ACC ] STREAM LISTENING 18169 /tmp/orbit-root/linc-80f-0-396353431195e
    unix 2 [ ACC ] STREAM LISTENING 18810 /tmp/orbit-root/linc-7ee-0-5b99b8d7edc48
    unix 2 [ ACC ] STREAM LISTENING 14047 private/tlsmgr
    unix 2 [ ACC ] STREAM LISTENING 19087 /tmp/orbit-root/linc-81d-0-42129c74b7757
    unix 2 [ ACC ] STREAM LISTENING 14051 private/rewrite
    unix 2 [ ACC ] STREAM LISTENING 19058 /tmp/orbit-root/linc-82b-0-533037353012d
    unix 2 [ ACC ] STREAM LISTENING 18913 /tmp/orbit-root/linc-81a-0-7112e73a1f025
    unix 2 [ ACC ] STREAM LISTENING 19025 /tmp/orbit-root/linc-84c-0-66c382f0c6b3f
    unix 2 [ ACC ] STREAM LISTENING 13276 @/var/run/hald/dbus-dBCYzUv7ZV
    unix 2 [ ACC ] STREAM LISTENING 19167 /tmp/orbit-root/linc-822-0-51dd63b7702ba
    unix 2 [ ACC ] STREAM LISTENING 20387 /tmp/orbit-root/linc-996-0-79704b5eac021
    unix 2 [ ACC ] STREAM LISTENING 19192 /tmp/orbit-root/linc-82d-0-32d7b94d98dd8
    unix 2 [ ACC ] STREAM LISTENING 20501 /tmp/orbit-root/linc-9a6-0-72a6389f1b80
    unix 2 [ ACC ] STREAM LISTENING 17297 /tmp/orbit-root/linc-7c8-0-6c211c5c709ed
    unix 2 [ ACC ] STREAM LISTENING 14935 @/tmp/.X11-unix/X0
    unix 2 [ ACC ] STREAM LISTENING 17314 /tmp/orbit-root/linc-76b-0-522d509a82410
    unix 2 [ ACC ] STREAM LISTENING 13269 @/var/run/hald/dbus-5pt50VnGon
    unix 2 [ ACC ] STREAM LISTENING 17320 /tmp/keyring-8HHVIm/socket.pkcs11
    unix 2 [ ACC ] STREAM LISTENING 14936 /tmp/.X11-unix/X0
    unix 2 [ ACC ] STREAM LISTENING 15293 @/tmp/gdm-session-PjeRYypV
    unix 2 [ ACC ] STREAM LISTENING 14055 private/bounce
    unix 2 [ ACC ] STREAM LISTENING 14059 private/defer
    unix 2 [ ACC ] STREAM LISTENING 16904 /tmp/orbit-root/linc-7c4-0-38b3482d4e5c7
    unix 2 [ ACC ] STREAM LISTENING 16776 @/tmp/dbus-HJiBk8d8vI
    unix 2 [ ACC ] STREAM LISTENING 14063 private/trace
    unix 2 [ ACC ] STREAM LISTENING 17142 /tmp/orbit-root/linc-775-0-2edd1e56f3e7
    unix 2 [ ACC ] STREAM LISTENING 15122 @/tmp/gdm-greeter-XLcQAHNj
    unix 2 [ ACC ] STREAM LISTENING 18948 /tmp/.esd-0/socket
    unix 2 [ ACC ] STREAM LISTENING 18951 /root/.pulse/af81270238cf72a12c7e89bc0000003d-runtime/native
    unix 2 [ ACC ] STREAM LISTENING 14067 private/verify
    unix 2 [ ACC ] STREAM LISTENING 14071 public/flush
    unix 2 [ ACC ] STREAM LISTENING 14075 private/proxymap
    unix 2 [ ACC ] STREAM LISTENING 14079 private/proxywrite
    unix 2 [ ACC ] STREAM LISTENING 14083 private/smtp
    unix 2 [ ACC ] STREAM LISTENING 14087 private/relay
    unix 2 [ ACC ] STREAM LISTENING 14091 public/showq
    unix 2 [ ACC ] STREAM LISTENING 14095 private/error
    unix 2 [ ACC ] STREAM LISTENING 14099 private/retry
    unix 2 [ ACC ] STREAM LISTENING 14103 private/discard
    unix 2 [ ACC ] STREAM LISTENING 14107 private/local
    unix 2 [ ACC ] STREAM LISTENING 14111 private/virtual
    unix 2 [ ACC ] STREAM LISTENING 14115 private/lmtp
    unix 2 [ ACC ] STREAM LISTENING 14119 private/anvil
    unix 2 [ ACC ] STREAM LISTENING 14123 private/scache
    unix 2 [ ACC ] STREAM LISTENING 16880 /tmp/.ICE-unix/1909
    unix 2 [ ACC ] STREAM LISTENING 12587 /var/run/rpcbind.sock
    unix 2 [ ACC ] STREAM LISTENING 16879 @/tmp/.ICE-unix/1909
    unix 2 [ ACC ] STREAM LISTENING 12668 /var/run/dbus/system_bus_socket
    [root@weekend110 ~]#

     traceroute

      用于检测到达目的地的路由状况

    [root@weekend110 ~]# traceroute -n www.guet.edu.cn
    traceroute to www.guet.edu.cn (202.193.64.56), 30 hops max, 60 byte packets
    1 192.168.80.2 0.175 ms 0.084 ms 0.132 ms
    2 * * *
    3 * * *
    4 * * *
    5 * * *
    6 * * *
    7 * * *
    8 * * *
    9 * * *
    10 * * *
    11 * * *
    12 * * *
    13 * * *
    14 * * *
    15 * * *
    16 * * *
    17 * * *
    18 * * *
    19 * * *
    20 * * *
    21 * * *
    22 * * *
    23 * * *
    24 * * *
    25 * * *
    26 * * *
    27 * * *
    28 * *^C
    [root@weekend110 ~]#

  • 相关阅读:
    判断以下字符串中出现次数最多的字符,并且算出该字符出现的次数
    status的状态码
    call和apply的区别?
    闭包
    $(document).ready和window. onload的区别
    python_pandas常用操作
    python经典例题
    爬B站并保存成csv文件。提供数据
    data_analysis:初识numpy
    01爬取豆瓣网电影数据进行numpy的练习
  • 原文地址:https://www.cnblogs.com/zlslch/p/5985169.html
Copyright © 2011-2022 走看看