Netzwerktools

Aus Friedmar's Wiki
Zur Navigation springen Zur Suche springen

dig

Der Terminal-Befehl dig liefert alle DNS-Informationen zu einer bestimmten Domain. Die möglichen Optionen liefert dig -h:

friedmar@fhubuntu:~$ dig -h
Usage:  dig [@global-server] [domain] [q-type] [q-class] {q-opt}
            {global-d-opt} host [@local-server] {local-d-opt}
            [ host [@local-server] {local-d-opt} [...]]
Where:  domain	  is in the Domain Name System
        q-class  is one of (in,hs,ch,...) [default: in]
        q-type   is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]
                 (Use ixfr=version for type ixfr)
        q-opt    is one of:
                 -x dot-notation     (shortcut for reverse lookups)
                 -i                  (use IP6.INT for IPv6 reverse lookups)
                 -f filename         (batch mode)
                 -b address[#port]   (bind to source address/port)
                 -p port             (specify port number)
                 -q name             (specify query name)
                 -t type             (specify query type)
                 -c class            (specify query class)
                 -k keyfile          (specify tsig key file)
                 -y [hmac:]name:key  (specify named base64 tsig key)
                 -4                  (use IPv4 query transport only)
                 -6                  (use IPv6 query transport only)
                 -m                  (enable memory usage debugging)
        d-opt    is of the form +keyword[=value], where keyword is:
                 +[no]vc             (TCP mode)
                 +[no]tcp            (TCP mode, alternate syntax)
                 +time=###           (Set query timeout) [5]
                 +tries=###          (Set number of UDP attempts) [3]
                 +retry=###          (Set number of UDP retries) [2]
                 +domain=###         (Set default domainname)
                 +bufsize=###        (Set EDNS0 Max UDP packet size)
                 +ndots=###          (Set NDOTS value)
                 +edns=###           (Set EDNS version)
                 +[no]search         (Set whether to use searchlist)
                 +[no]showsearch     (Search with intermediate results)
                 +[no]defname        (Ditto)
                 +[no]recurse        (Recursive mode)
                 +[no]ignore         (Don't revert to TCP for TC responses.)
                 +[no]fail           (Don't try next server on SERVFAIL)
                 +[no]besteffort     (Try to parse even illegal messages)
                 +[no]aaonly         (Set AA flag in query (+[no]aaflag))
                 +[no]adflag         (Set AD flag in query)
                 +[no]cdflag         (Set CD flag in query)
                 +[no]cl             (Control display of class in records)
                 +[no]cmd            (Control display of command line)
                 +[no]comments       (Control display of comment lines)
                 +[no]question       (Control display of question)
                 +[no]answer         (Control display of answer)
                 +[no]authority      (Control display of authority)
                 +[no]additional     (Control display of additional)
                 +[no]stats          (Control display of statistics)
                 +[no]short          (Disable everything except short
                                      form of answer)
                 +[no]ttlid          (Control display of ttls in records)
                 +[no]all            (Set or clear all display flags)
                 +[no]qr             (Print question before sending)
                 +[no]nssearch       (Search all authoritative nameservers)
                 +[no]identify       (ID responders in short answers)
                 +[no]trace          (Trace delegation down from root)
                 +[no]dnssec         (Request DNSSEC records)
                 +[no]nsid           (Request Name Server ID)
                 +[no]sigchase       (Chase DNSSEC signatures)
                 +trusted-key=####   (Trusted Key when chasing DNSSEC sigs)
                 +[no]topdown        (Do DNSSEC validation top down mode)
                 +[no]multiline      (Print records in an expanded format)
        global d-opts and servers (before host name) affect all queries.
        local d-opts and servers (after host name) affect only that lookup.
        -h                           (print help and exit)
        -v                           (print version and exit)

Eine erste Information für die Auflösung eines Internetnamens liefert bereits die Syntax dig host:

friedmar@fhubuntu:~$ dig wiki.bf1705.de

; <<>> DiG 9.7.3 <<>> wiki.bf1705.de
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3902
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;wiki.bf1705.de.			IN	A

;; ANSWER SECTION:
wiki.bf1705.de.		1510	IN	A	82.165.48.237

;; AUTHORITY SECTION:
bf1705.de.		60436	IN	NS	ns66.1und1.de.
bf1705.de.		60436	IN	NS	ns65.1und1.de.

;; ADDITIONAL SECTION:
ns65.1und1.de.		1562	IN	A	217.160.82.171
ns66.1und1.de.		1562	IN	A	217.160.83.171

;; Query time: 10 msec
;; SERVER: 192.168.178.1#53(192.168.178.1)
;; WHEN: Sun Jul 24 19:21:39 2011
;; MSG SIZE  rcvd: 124


ifconfig

Für Windows-User ist es der Kommandozeilenbefehl ipconfig bzw. ipconfig /all, um an die aktuellen Netzwerkinformationen zu kommen. Linux-User kennen den Terminal-Befehl ifconfig als passendes Gegenstück. Alle möglichen Eingabeoptionen liefert uns die Eingabe ifconfig --help:

friedmar@fhubuntu:~$ sudo ifconfig --help
Aufruf:
  ifconfig [-a] [-v] [-s] <interface> [[<AF>] <adresse>]
  [add <Adresse>[/<Präfixlänge>]]
  [del <Adresse>[/<Präfixlänge>]]
  [[-]broadcast [<Adresse>]]  [[-]pointopoint [<Adresse>]]
  [netmask <Adresse>]  [dstaddr <Adresse>]  [tunnel <Adresse>]
  [outfill <NN>] [keepalive <NN>]
  [hw <HW> <Adresse>]  [metric <NN>]  [mtu <NN>]
  [[-]trailers]  [[-]arp]  [[-]allmulti]
  [multicast]  [[-]promisc]
  [mem_start <NN>]  [io_addr <NN>]  [irq <NN>]  [media <Typ>]
  [txqueuelen <Länge>]
  [[-]dynamic]
  [up|down] ...

  <HW>=Hardwaretyp.
  Liste möglicher Hardwaretypen:
    loop (Lokale Schleife) slip (Serielle IP) cslip (Serielle VJ-IP)
    slip6 (6-bit Serielle IP) cslip6 (VJ 6-bit Serielle IP) adaptive (Adaptive Serielle IP)
    strip (Metricom Starmode IP) ash (Ash) ether (Ethernet)
    tr (16/4 Mb/s Token-Ring) tr (16/4 Mb/s Token-Ring (neu)) ax25 (AMPR AX.25)
    netrom (AMPR NET/ROM) rose (AMPR ROSE) tunnel (IPIP Tunnel)
    ppp (Punkt-zu-Punkt-Verbindung) hdlc ((Cisco)-HDLC) lapb (LAPB)
    arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device) 
    sit (IPv6-nach-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI)
    irda (IrLAP) ec (Econet) x25 (Generisches X.25)
    eui64 (Generisches EUI-64)
  <AF>=Adressfamilie.  Standardwert: inet
  List der möglichen Adressfamilien:
    unix (UNIX-Domain) inet (DARPA-Internet) inet6 (IPv6)
    ax25 (AMPR AX.25) netrom (AMPR NET/ROM) rose (AMPR ROSE)
    ipx (Novell IPX) ddp (Appletalk DDP) ec (Econet)
    ash (Ash) x25 (CCITT X.25)

In der Regel interessiert uns, ob und welche Einstellungen DHCP beim Start des Betriebssystems liefert. Wurde einer bestimmten Netzwerkschnittstelle eine IP-Adresse zugewiesen, wurden Broadcast, Subnetz-Maske, Vorgaberoute und primärer DNS-Eintrag initialisiert? Wer den Gerätename der aktiven Netzwerkschnittstelle kennt wählt als Syntax ifconfig <interface>, mit ifconfig kommt man natürlich auch zum gewünschten Erfolg:

friedmar@fhubuntu:~$ sudo ifconfig wlan0
wlan0     Link encap:Ethernet  Hardware Adresse 00:ff:00:ff:00:ff
          inet Adresse:192.168.178.32  Bcast:192.168.178.255  Maske:255.255.255.0
          inet6-Adresse: fe80::f27b:cbff:fe44:523e/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:20463 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19136 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000
          RX bytes:14146926 (14.1 MB)  TX bytes:4207061 (4.2 MB)

iwconfig

Die Eingabe von iwconfig im Terminal beantwortet schnell den Devise-Namen für den WLAN-Adapter. In meinem Fall ist wlan0 ein WLAN-Gerät:

friedmar@fhubuntu:~$ sudo iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"sbf1705"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:FF:00:FF:00:FF
          Bit Rate=162 Mb/s   Tx-Power=14 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=70/70  Signal level=-33 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:11  Invalid misc:18   Missed beacon:0

Zur Beachtung: Ich habe mir erlaubt, die MAC-Adresse meiner WLAN-Karte zu türken.

iwlist

Wer schon einmal Probleme mit der Verbindungsaufnahme über WLAN hatte, für den ist der Befehl iwlist sehr hilfreich. Der Aufruf von iwlist <interface> scan im Terminal beantwortet schon einmal die Frage, ob das Interface überhaupt aktiv ist und welche Wireless Access Points im Umfeld empfangen werden.

friedmar@fhubuntu:~$ sudo iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: 00:FF:00:FF:00:FF
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=70/70  Signal level=-33 dBm
                    Encryption key:on
                    ESSID:"<essid>"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=00000006c36ee180
                    Extra: Last beacon: 17750ms ago
                    IE: Unknown: 000773626631373035
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030101
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: 2A0100
                    IE: Unknown: 32043048606C
                    IE: Unknown: DD180050F2020101820003A4000027A4000042435E0062322F00
                    IE: Unknown: 2D1ACE131BFFFF000000000000000000000000000000000000000000
                    IE: Unknown: 3D16010D0A00000000000000000000000000000000000000
                    IE: Unknown: DD0900037F01010000FF7F
                    IE: Unknown: DD0A00037F04010020000000
                    IE: Unknown:

iftop

iftop ist ein Kommandozeilenwerkzeug zum Überwachen des Netzwerkverkehrs (Traffic) in Echtzeit. Es listet alle Verbindungen einer Netzwerkschnittstelle auf und zeichnet im Hintergrund ein Balkendiagramm auf. Evtl. muss iftop nachträglich installiert werden. Die Ausgabe des Befehls iftop -h zeigt folgendes Listing:

 iftop: display bandwidth usage on an interface by host
 
 Synopsis: iftop -h | [-npblNBP] [-i interface] [-f filter code]
                                [-F net/mask] [-G net6/mask6]
 
    -h                  display this message
    -n                  don't do hostname lookups
    -N                  don't convert port numbers to services
    -p                  run in promiscuous mode (show traffic between other
                        hosts on the same network segment)
    -b                  don't display a bar graph of traffic
    -B                  Display bandwidth in bytes
    -i interface        listen on named interface
    -f filter code      use filter code to select packets to count
                        (default: none, but only IP packets are counted)
    -F net/mask         show traffic flows in/out of IPv4 network
    -G net6/mask6       show traffic flows in/out of IPv6 network
    -l                  display and count link-local IPv6 traffic (default: off)
    -P                  show ports as well as hosts
    -m limit            sets the upper limit for the bandwidth scale
    -c config file      specifies an alternative configuration file
 
 iftop, version 1.0pre2
 copyright (c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors

Weiter Informationen finden sich hier: wiki.ubuntuusers.de

iperf

Das Client-Server-Programm iperf für die Kommandozeile macht es möglich, den Durchsatz zwischen zwei Rechnern innerhalb eines Netzwerks zu messen. Evtl. muss iperf nachträglich installiert werden. Der Befehl sudo iperf --help liefert folgende Ausgabe:

 friedmar@fhubuntu:~$ sudo iperf --help
 Usage: iperf [-s|-c host] [options]
        iperf [-h|--help] [-v|--version]
 
 Client/Server:
   -b, --bandwidth #[KMG | pps]  bandwidth to send at in bits/sec or packets per second
   -e, --enhancedreports    use enhanced reporting giving more tcp/udp and traffic information
   -f, --format    [kmKM]   format to report: Kbits, Mbits, KBytes, MBytes
   -i, --interval  #        seconds between periodic bandwidth reports
   -l, --len       #[KM]    length of buffer to read or write (default 8 KB)
   -m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)
   -o, --output    <filename> output the report or error message to this specified file
   -p, --port      #        server port to listen on/connect to
   -u, --udp                use UDP rather than TCP
   -w, --window    #[KM]    TCP window size (socket buffer size)
   -z, --realtime           request realtime scheduler
   -B, --bind      <host>   bind to <host>, an interface or multicast address
   -C, --compatibility      for use with older versions does not sent extra msgs
   -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)
   -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm
   -V, --ipv6_domain        Set the domain to IPv6
 
 Server specific:
   -s, --server             run in server mode
   -U, --single_udp         run in single threaded UDP mode
   -D, --daemon             run the server as a daemon
 
 Client specific:
   -c, --client    <host>   run in client mode, connecting to <host>
   -d, --dualtest           Do a bidirectional test simultaneously
   -n, --num       #[KM]    number of bytes to transmit (instead of -t)
   -r, --tradeoff           Do a bidirectional test individually
   -t, --time      #        time in seconds to transmit for (default 10 secs)
   -B, --bind [<ip> | <ip:port>] bind src addr(s) from which to originate traffic
   -F, --fileinput <name>   input the data to be transmitted from a file
   -I, --stdin              input the data to be transmitted from stdin
   -L, --listenport #       port to receive bidirectional tests back on
  <nowiki>  -P, --parallel  #        number of parallel client threads to run
   -T, --ttl       #        time-to-live, for multicast (default 1)
   -Z, --linux-congestion <algo>  set TCP congestion control algorithm (Linux only)
 
 Miscellaneous:
   -x, --reportexclude [CDMSV]   exclude C(connection) D(data) M(multicast)
                                 S(settings) V(server) reports
   -y, --reportstyle C      report as a Comma-Separated Values
   -h, --help               print this message and quit
   -v, --version            print version information and quit
 
 [KM] Indicates options that support a K or M suffix for kilo- or mega-
 
 The TCP window size option can be set by the environment variable
 TCP_WINDOW_SIZE. Most other options can be set by an environment variable
 IPERF_<long option name>, such as IPERF_BANDWIDTH.
 
 Source at <http://sourceforge.net/projects/iperf2/>
 Report bugs to <iperf-users@lists.sourceforge.net>

iwScanner

netstat