Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

35
Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications

Transcript of Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Page 1: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

NETS 3303

ICMP and applications

Page 2: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Outcome

• Learn about role of ICMP• Protocol specifics• Know about applications that use ICMP

Page 3: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Outline• intro

– encapsulation/stack position– basic ideas– header format

• message types• redirects• ping• Traceroute• IP Mobility intro

Page 4: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Encapsulation

ICMP transmitted within IP datagram so that it is routeable(unlike arp)

Page 5: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Protocols

Page 6: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

ICMP Idea• considered part of IP• functionality includes:

– error messages (ttl exceeded, destination unreachable, router is out of memory, can’t fragment packet)

– network management (ping/traceroute)– end host configuration (router advert, netmask)

• error messages go from router/end host to original ip src, not between intermediate hops– don’t know route

Page 7: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

ICMP Ideas• error messages typically sent at IP layer, received by sending IP/UDP/TCP, latter may forward to application

• ICMP error messages never generated due to:– ICMP error message (loop)– broadcasts/multicasts

• Why? prevent broadcast storms• error contains offending IP header + 1st 8 bytes of IP data (note tcp/udp ports)

Page 8: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Header

checksum covers icmp header/data, not ip header

Page 9: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

ICMP requests (not all)

Page 10: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

continued

Page 11: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

ICMP redirect• limited dynamic routing technique• only done on same link• situation:

– 1. assume dumb host with 1 default routing table entry

– 2. two routers on same link, one is default, one is route to net X

– 3. dumb host sends pkt to net X via default router

– 4. default router sends ICMP redirect with correct router address to dumb host

Page 12: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Redirect contd.• note: router detects redirect because it discovers that packet is being forwarded back out input i/f

• default router also forwards original packet correctly

• dumb host changes its routing table to reflect newly learned route to other net

• route added is HOST route in BSD system because we lack subnet mask knowledge

Page 13: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Picture

Page 14: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Dest unreachable

• Host or router cannot deliver a datagram

• Return IP header first 8 bytes• Codes

– 0 Network unreachable– 1 Host unreachable– 2 Protocol unreachable– 3 Protocol unreachable– Etc.

Page 15: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Source Quench

• No flow control in IP (data rate)

• Source quench alerts sender of– A packet was discarded– Slow down transmission rate

• Returned is IP header plus 8 bytes of data

Page 16: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

TTL Exceeded

• If TTL value 0, discard packet and issue ICMP time exceeded, code 0

• If fragments not received within a certain time limit, discard fragments and issue ICMP time exceeded, code 1

Page 17: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Parameter problem

• If the IP header format wrong– Issue ICMP parameter problem

•Code 0 faulty header field, pointer field in ICMP addresses start byte of problem in IP header

•Code 1 required part of option is missing

Page 18: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

ping - ICMP echo request/reply

• ping program useful diagnostic tool, uses ICMP echo request/reply packets

• Linux implementation uses “raw” sockets - i/f directly to ip layer, bypass transports

• older ping would send 1 pkt per second• some newer pings require -s to do that and only do one ping (“joebob is alive”)

Page 19: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Ping• ping adds identifier/sequence number fields to packets

• id field, unix pid as raw socket can’t tell how to demux packets to apps, app gets all copies, must demux itself

• sequence # allows you to see if packets disappeared

• ping will also do roundtrip timing

Page 20: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

More ping

• so what do you learn?– timing info, does it take too long ?– are packets being lost (why? didn’t tell you)

– you can route (!!!)– end system’s tcp/ip stack is working at least

• echo reply sent by end system’s ICMP, you don’t know that you can telnet there...

Page 21: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Ping example• $ ping cse.ogi.edu

PING cse.ogi.edu (129.95.20.2): 56 data bytes64 bytes from 129.95.20.2 icmp_seq=0 time=8ms64 bytes from 129.95.20.2 icmp_seq=1 time=8ms64 bytes from 129.95.20.2 icmp_seq=2 time=20ms

---cse.ogi.edu PING statistics ---3 packets transmitted, 3 packets received, 0% loss

round-trip (ms) min/avg/max = 8/12/20

Page 22: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Traceroute

• % traceroute north.pole.com• traceroute (a command) allows you to determine the routers from one end to another

• uses ICMP ttl exceeded and (UDP port unreachable OR ICMP echo reply) messages to do the job

Page 23: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Traceroute example• % traceroute cse.ogi.edu (from sirius.cs.pdx.edu)traceroute to cse.ogi.edu (129.95.20.2), 30 hops max ...

1. pdx-gwy (131.252.20.1) 3 ms 4 ms 3 ms2. 198.104.197.58 (198.104.197.58) 7 ms 4 ms 8 ms3. portland1-gw.nwnet.net (198.104.196.193) 6 ms 5 ms 5 ms

4. ogi-gw-nwnet.net (198.104.196.129) 8 ms 7 ms 7 ms

5. cse.ogi.edu (129.95.20.2) 14 ms 7 ms 9 msnote: try from usyd to unsw or some other uni in the Sydney area. how many hops? how long?

Page 24: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Traceroute algorithm• ttl = 1 (to 1st router)

while we haven’t got UDP port unreachablesend raw/ip packet with ttl == 1get responseif time exceeded note roundtrip timeelse if UDP port unreachablequit

print outputttl++

Page 25: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Address mask

• If host does not know its netmask, issue Address mask request

• Router on network replies with mask

• Can be unicast or broadcast• Often used at boot strapping

Page 26: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Router solicitation

• Host wants to learn about network topology issues ICMP RS message

• Routers reply with a router advertisement

• Preference level 0 means default router

Page 27: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Packet-pair

• Problem, what is the bandwidth of the links between me and destination?

• Use packet-pair to find bottleneck link speed

Page 28: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Algorithm• Issue two packets back-to-back

• On each link write time will space packets

• Remote host might compact again

• Read time between packets on return path

tt

probesizeBW

endend 12−

=

Page 29: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Packet-pair

Page 30: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

Pathchar• Combine packet-pair with traceroute• Algorithm

Set TTL to 1While host not reachedIssue lots of packet-pair probesMeasure link speedlink delay related to previous resultTTL++

end

Page 31: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

IP Final frontier, Mobility

• Once a socket opened, address cannot change– Change address – lose connection– Change place of attachment – lose routing

• One solution MobileIP RFC2002

Page 32: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

MobileIP

• MIP allows hosts to migrate to foreign networks

• Communication handled by Home Agent in home network

• Helper routers in foreign network Foreign Agents

Page 33: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

MIP

Home Network

Home Network

Foreign Network

Foreign Network

HA

FA12

3

Page 34: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

IP Tunneling

IP

Router

IP IP

Page 35: Björn Landfeldt School of Information Technologies NETS 3303 ICMP and applications.

Björn LandfeldtSchool of Information Technologies

IP Tunnelling

IP

FA

IP IP