SS 2005 KV Betriebssysteme (R. Hörmanseder, A. Putzinger, M. Sonntag) IPv4 Teil 2 ( Minifassung ) 1
ICMP Internet Control Message Protocol R. Hörmanseder KV Betriebssysteme 2
ICMP Basisaufgaben IP bietet ja nur verbindungslose und unsichere Übertragung an. Damit wichtig: Informationen über Fehler und deren Behandlung Steuerung des Datentransfers Diagnose ICMP arbeitet selber über IP 3
Auswahl aus den ICMP Nachrichten Destination Unreachable: Paket kann nicht zugestellt werden (Fragmentation needed but DF=1 / Network / Host / Protocol / Port /...) Time Exceeded: TTL ist abgelaufen (=> TRACEROUTE), Fragment Reassembly Time Echo Request / Reply: Fragt per Request ein System, ob es noch am Leben ist. Dieses antwortet mit Reply. (=> PING) Timestamp Request / Reply: Wie Echo, aber mit Zeitstempel 4
Wozu dient die TTL? [1] (TTL=Time To Live) Wozu wird die TTL benötigt: Pakete, welche z.b. durch Routingfehler im Kreis gesendet werden, werden verworfen (und kreisen damit nicht endlos im Netz). E:\>ping www.fim.uni-linz.ac.at Reply from 140.78.100.130: TTL=128 (NT, gleiches Netz) E:\>ping fimlinux02.fim.uni-linz.ac.at Reply from 140.78.100.170: TTL=255 E:\>ping mail.fim.uni-linz.ac.at Reply from 140.78.100.3: TTL=127 E:\>ping pserv.fim.uni-linz.ac.at Reply from 140.78.100.45: TTL=14 (Suse Linux, gleiches Netz) (NT, 1 Hop dazwischen) (Axis Printserver, 1 Hop dazwischen) E:\>ping www.uni-linz.ac.at (2 Hops dazwischen) Reply from 140.78.3.23: TTL=126 5
Wozu dient die TTL? [2] (TTL=Time To Live) Routingfehler (Kreise, siehe vorige Folie) Sicherstellen, daß Paket-Lifetime limitiert ein Beispiel dazu folgt: ID & Fragmentierung bei Multicasts... Traceroute Utility Anmerkungen: heute nicht mehr TTL sondern Hop-Count Größe + Zählmode: IP V4: 8 Bits, count-down IP V6: nur??!! 8 Bits, count-down IPX: 8 Bits, count-up Appletalk: nur!! 4 Bits, count-up 6
Beispiel: TTL & ICMP (TTL=Time To Live) Jeder Knoten (auf dem Weg eines IP-Paketes) zählt die TTL um (mindestens) 1 nach unten. Erreicht der Wert 0, so wird das Paket verworfen und (zumeist) eine ICMP-Nachricht als Fehlernachricht zurückgeschickt. (Natürlich löst ein Fehler bei einer ICMP-Nachricht selbst keine ICMP-Nachricht mehr aus.) Host A TTL=2 TTL=1 Router 1 Router 2 Host B ICMP Time Exceeded 7
PING & TRACEROUTE (als spätere Verbindung von ICMP zum Routing) R. Hörmanseder KV Betriebssysteme 8
PING Syntax und Optionen PING [optionen] Zielliste -t Sendet fortlaufend Ping-Signale -a Adressen zu Host-Namen auswerten -n Anzahl Anzahl zu sendender Echo-Anforderungen -l Länge Pufferlänge senden -f Flag für "Don't Fragment" setzen -i TTL Time To Live. -v TOS Type Of Service. -r Anzahl Route für Anzahl Hops aufzeichnen -s Anzahl Zeiteintrag für Anzahl Abschnitte (Hops) -j Host-Liste "Loose Source Route" gemäß Host-Liste -k Host-Liste "Strict Source Route" gemäß Host-Liste -w Timeout Timeout in Millisekunden für eine Antwort (Beschreibungen auf Basis MS-Help) 9
PING Beispiel Round-Trip-Time (RTT) L:\users\hoe>ping www.sun.com Pinging www.sun.com [192.18.97.241] with 32 bytes of data: Reply from 192.18.97.241: bytes=32 time=591ms TTL=228 Reply from 192.18.97.241: bytes=32 time=601ms TTL=228 Reply from 192.18.97.241: bytes=32 time=491ms TTL=228 Reply from 192.18.97.241: bytes=32 time=551ms TTL=228 L:\users\hoe>ping -a 192.18.97.241 Pinging newww.sun.com [192.18.97.241] with 32 bytes of data: Reply from 192.18.97.241: bytes=32 time=451ms TTL=228 Reply from 192.18.97.241: bytes=32 time=511ms TTL=228 Reply from 192.18.97.241: bytes=32 time=511ms TTL=228 Reply from 192.18.97.241: bytes=32 time=871ms TTL=228 L:\users\hoe>_ 10
PING Beispiel mit Switch -a Switch -a: IP-Adresse (via reverse DNS) auf Hostnamen auslösen symbolischer Name DNS reverse DNS 32 Bit Internet Address www.sun.com ping www.sun.com newww.sun.com ping -a 192.18.97.241 192.18.97.241 11
PING Kompatibilität Grenzbereich Broadcasts [1] SUSE Linux 6.3 mit IP 140.78.100.147/25 hoe@linux04: > ping -c 2 140.78.100.255 PING 140.78.100.255 (140.78.100.255): 56 data bytes 64 bytes from 140.78.100.147: icmp_seq=0 ttl=255 time=0.447 ms 64 bytes from 140.78.100.138: icmp_seq=0 ttl=255 time=0.920 ms (DUP!) 64 bytes from 140.78.100.150: icmp_seq=0 ttl=63 time=6.292 ms (DUP!) 64 bytes from 140.78.100.147: icmp_seq=1 ttl=255 time=0.164 ms --- 140.78.100.255 ping statistics --- 2 packets transmitted, 2 packets received, +2 duplicates, 0% packet loss, round-trip min/avg/max = 0.164/1.955/6.292 ms Anmerkungen: Nur Linux-Systeme (140.78.100.147 und 140.78.100.138) sowie ein System von Bay Networks (140.78.100.150) antworten. Die Windows-Systeme (98 / NT 4 / 2000) reagieren nicht. Der Suse-Rechner antwortet auch sich selbst, sodaß das ping auch ohne Anschluß an das Netz Replies (ohne Duplicates) erhält. 12
PING Kompatibilität Grenzbereich Broadcasts [2] Windows 2000 mit IP 140.78.100.145/25 L:\users\hoe>ping -n 2 140.78.100.255 Pinging 140.78.100.255 with 32 bytes of data: Reply from 140.78.100.255: bytes=32 time<10ms TTL=255 Reply from 140.78.100.255: bytes=32 time<10ms TTL=255 Ping statistics for 140.78.100.255: Packets: Sent = 2, Received = 2, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms Anmerkungen: Der Protocol-Analyzer zeigt, daß die Duplicates genau wie in der vorigen Folie über das Netz gehen. Das Ping von Windows 2000 zeigt aber nichts davon an. Der Rechner antwortet sich aber nicht selbst, sodaß ein PING ohne Anschluß an das Netzwerk mit Request timed out beantwortet wird. 13
C:\>PING -n 1 www.suse.com Reply from 202.58.118.8: bytes=32... TTL=228 C:\>PING -n 1 -i 1 www.suse.com Reply from 140.78.100.31: TTL expired in transmit. C:\>PING -n 1 -a 140.78.100.31 Pinging routerzid.fim.uni-linz.ac.at [... C:\>PING -n 1 -i 2 www.suse.com Reply from 193.171.22.17; TTL expired in transmit. C:\>PING -n 1 -a 193.171.22.17 Pinging Linz.ACO.net [... Verfolgen der (einer??) Route von A nach B [1] Möglichkeit 1: PING mit Angabe der TTL (-i) 14
Verfolgen der (einer??) Route von A nach B [2] Möglichkeit 1: PING mit Angabe der TTL (-i)...... C:\>PING -n 1 -i 23 www.suse.com Reply from 198.32.128.81: TTL expired in transmit. C:\>PING -n 1 -a 198.32.128.81 Pinging oak-rtr.dtelecom.com [... C:\>PING -n 1 -i 24 www.suse.com Request timed out. C:\>PING -n 1 -i 25 www.suse.com Reply from 202.58.118.8: bytes=32... TTL=228 15
Verfolgen der (einer??) Route von A nach B [3] Möglichkeit 2: eigenes Tool TRACEROUTE Funktion: Zeichnet auf Basis der ICMP- Messages TTL Exceeded in Transmit bzw. Port Unreachable die (besser gesagt eine) Route auf. Einige Optionen des Tools: -d Adressen nicht zu Host-Namen auswerten -h hops max. Anzahl an Hops bei Zielsuche -j hostlist "Loose Source Route" gemäß hostlist -w Timeout Timeout in Millisekunden für eine Antwort 16
Verfolgen der (einer??) Route von A nach B [4] Wie funktionieren PING und TRACEROUTE? Host A TTL=1 Router 1 Router 2 Host B ICMP Time Exceeded Host A TTL=2 TTL=1 Router 1 Router 2 Host B ICMP Time Exceeded Host A TTL=3 TTL=2 TTL=1 Router 1 Router 2 Host B ICMP Echo Reply (NT) bzw. ICMP UDP Port Unreachable (Unix) (übernommen von Windows 2000 Online Help) 17
Arbeiten mit TRACEROUTE [1] L:\users\hoe>tracert www.suse.com Tracing route to www.suse.com [202.58.118.8] over a maximum of 30 hops: 1 <10 <10 <10 routerzid.fim.uni-linz.ac.at [140.78.100.31] 2 <10 <10 <10 linz.aco.net [193.171.22.17] 3 20 10 10 Vienna-RBS.ACO.net [193.171.25.13] 4 <10 <10 <10 atvie203-tc-f2-2.ebone.net [195.158.245.129] 5 10 10 10 atvie101-tc-p0-2.ebone.net [213.174.70.2] 6 10 10 10 czpra103-tc-p2-0.ebone.net [195.158.242.45] 7 20 20 20 debln302-tc-p2-0.ebone.net [213.174.70.45].. 11 30 31 30 nlams303-tc-p2-0.ebone.net [213.174.70.134] 12 30 30 30 bebru203-tc-p1-0.ebone.net [195.158.225.85].. 23 180 191 190 oak-rtr.dtelecom.com [198.32.128.81] 24 * * * Request timed out. 25 921 958 1012 www1.suse.com [202.58.118.8] Trace complete. (Millisekunden-Bezeichner etc. für bessere Darstellung im Output entfernt) 18
Arbeiten mit TRACEROUTE [2] ~ 2 Jahre später mehrere Unterschiede: andere IP und damit andere (kürzere) Route Geschwindigkeitsunterschiede...? 19
TraceRoute mit graphischem Output: Neotrace [1] 20
TraceRoute mit graphischem Output: Neotrace [2] 21
VisualRoute (1v2) 22
VisualRoute (1v2) 23
TraceRoute mit graphischem Output Tracert C:\>tracert www.qualys.com Tracing route to www.qualys.com [64.41.134.38] over a maximum of 30 hops: 1 routerzid.fim.uni-linz.ac.at [140.78.100.31] 2 linz.aco.net [193.171.22.17] 3 193.171.22.1 [193.171.22.1] 4 wien1.aco.net [193.171.12.193] 5 wien21.aco.net [193.171.23.18] 6 sl-gw10-vie-5-0.sprintlink.net [80.66.137.9] 7 sl-bb21-vie-15-0.sprintlink.net [80.66.136.36] 8 sl-bb20-fra-3-3.sprintlink.net [213.206.129.123] 9 bcr2-so-0-3-0.frankfurt.cw.net [166.63.193.217] 10 dcr1-loopback.santaclara.cw.net [208.172.146.99] 11 bhr1-pos-0-0.santaclarasc5.cw.net [208.172.156.74] 12 csr11-ve242.santaclarasc4.cw.net [216.34.3.83] 24
Tools Kommandozeile Oberfächen für TraceRoute CyberKit Visualisierung der Übertragungsstecke VisualRoute Neotrace 25
MAC-Adressen Ethernet-Netzwerkkarten arbeiten auf Basis von MAC-Adressen 6 Oktets Sedezimale Schreibweise Beispiel: 00-C0-9F-25-E7-D2 ipconfig /all IP-Zuordnung zu MAC-Adressen mittels ARP (Address Resolution Protocol) IP MAC Durch Broadcast Knoten mit IP-Adresse IPx bitte mit seiner MAC-Adresse bei mir melden 26
ARP ARP = Address Resolution Protocol symbolischer Name DNS 32 Bit Internet Address ARP reverse DNS 48 Bit Ethernet Address www.fim.uni-linz.ac.at DNS ARP 140.78.100.130 00-60-97-31-5A-92 reverse DNS 27
Befehl ARP Beispiele C:\>ARP -s 140.78.100.253 01-23-45-67-89-ab C:\>arp -a Interface: 140.78.100.174 --- 0x3 Internet Address Physical Address Type 140.78.100.129 00-00-92-a7-a6-52 dynamic 140.78.100.130 00-50-da-28-96-d3 dynamic 140.78.100.136 00-00-92-c7-b5-99 dynamic 140.78.100.253 01-23-45-67-89-ab static C:\>_ 28
Befehl ARP Online Help 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 / -g 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. 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 if_addr Specifies a physical address. 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. 29
DNS Abfragetool NSLOOKUP D:\>nslookup Default Server: ns1.fim.uni-linz.ac.at Address: 140.78.100.48 >? Commands: NAME print info about the host/domain NAME using default server NAME1 NAME2 as above, but use NAME2 as server set [no]debug print debugging information set [no]recurse ask for recursive answer to query set retry=x set number of retries to X set timeout=x set initial time-out interval to X seconds set type=x set query type (ex. A,ANY,CNAME,MX,NS, PTR,SOA,SRV) server NAME set default server to NAME, using current default server...... exit exit the program 30 sample switches taken from on-line help
NSLOOKUP - CyberKit 31
Basis-Test von IP mit überall verfügbaren, einfachsten Mitteln Testreihenfolge: inside ==> subnet ==> internet R. Hörmanseder KV Betriebssysteme 32
WINIPCFG / WNTIPCFG WNTIPCFG.EXE = IPCONFIG graphisch 33
Test von IP [1] (mit einfachsten Mitteln) 1) ipconfig / winipcfg / wntipcfg ifconfig Allgemeine Informationen über unsere IP- Konfiguration 2) ping loopback / ping 127.0.0.1 / ping localhost Test, ob IP-Software am Rechner verfügbar und ok 3) ping ip-address of computer noch internes Ping auf eigenen Rechner 34
Test von IP [2] (mit einfachsten Mitteln) 4) ping ip-address of default gateway nach außen auf einen anderen Rechner, insb. das default gateway für weiteren Zugriff außerhalb des eigenen Netzes 5) ping ip-address of local stable server falls 4 nicht funktioniert hat, ein weiterer Test ob eventuell nur das Default-Gateway nicht verfügbar ist. 6) arp -a Welche Rechner aus dem eigenen Subnetz antworten auf ARP-Requests? (4 error und 5 ok ==> keine Verbindung nach außen) 35
Test von IP [3] (mit einfachsten Mitteln) 7) ping ip-address of remote host Test ob ein remote Rechner (also ein Rechner außerhalb des eigenen Netzes) erreichbar ist 8) ping ip-address of nameserver1 / 2 nslookup ip-address of nameserver1 / 2 Ist ein Nameserver verfügbar und ok? 9) ping near stable server ping www.fim.uni-linz.ac.at Sprechen wir einen korrekten Nameserver an? Bessere Test etc. =>NSLOOKUP. 36
Test von IP [4] (mit einfachsten Mitteln) 10) traceroute www.fim.uni-linz.ac.at Ansehen der Route zum WEB-Server des FIM 11) ping name of remote host Ist der Nameserver für den remote Host korrekt (gibt es den Namen,..)? 12) ping -a ip-address of remote host Ist die reverse Namensauflösung für den remote host ok? x) netstat, nbtstat, netsh,... 37
NETSTAT: was ist los auf meinem IP-Stack? [1v2] L:\users\hoe>netstat -s -e IP Statistics Packets Received, Received Header Errors, Received Address Errors, Datagrams Forwarded, Unknown Protocols Received, Received Packets Discarded, Received Packets Delivered, Output Requests, Routing Discards, Discarded Output Packets, Output Packet No Route, Reassembly Required, Reassembly Successful, Reassembly Failures, Datagrams Successfully Fragmented, Datagrams Failing Fragmentation, Fragments Created ICMP Statistics (jeweils Received / Sent) Messages, Errors, Destination Unreachable, Time Exceeded, Parameter Problems, Source Quenchs, Redirects, Echos, Echo Replies, Timestamps, Timestamp Replies, Address Masks, Address Mask Replies 38
NETSTAT: was ist los auf meinem IP-Stack? [2v2] TCP Statistics: Active Opens, Passive Opens, Failed Connection Attempts, Reset Connections, Current Connections, Segments Received, Segments Sent, Segments Retransmitted UDP Statistics Datagrams Received, No Ports, Receive Errors, Datagrams Sent Interface Statistics (jeweils Received / Sent) Bytes, Unicast Packets, Non-Unicast Packets, Discards, Errors, Unknown Protocols 39
It will not connect Failed If using names, try with IP address instead OK Failed Try using ping to access any IP node on same network Is a hosts file being used or DNS DNS OK Hosts Ping this machine OK Failed Something wrong with TCP/IP software Is routing being used? Yes No Is service available on Host? (netstat a) Check its configuration No Has the correct address been configured for DNS? Yes No Correct it Check local IP address, especially the network portion Yes Wrong Change address Yes Probably a resource problem on the host Look at inetd.conf configuration of host Is DNS working? Yes No Correct DNS failure Use netstat i (or equivalent) to check network drivers Failed Is router (default gateway) configured? No Is the DNS configuration correct? No OK Check network connection Check configuration of drivers Yes Ping router Add router address (default gateway) Failed Yes Did you use the correct name and domain? Correct it OK Is remote host configured for a default gateway? Yes Check router Router trouble Configure default gateway in the R. Hörmanseder KV tables Betriebssysteme: are correct remote IPv4 host Teil 2 40 No IP Test-Flowchart aus Buch TCP/IP von Washburn & Evans