tik-110.350 computer networks - · pdf filetik-110.350 computer networks 1 2001-01-23...

27
1 Sanna Liimatainen [email protected] Tik-110.350 Computer Networks http://www.tml.hut.fi/Studies/Tik-110.350/ 1 2001-01-23 Tik - 110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen [email protected] Tik-110.350 Computer Networks http://www.tml.hut.fi/Studies/Tik-110.350/ 2 2001-01-23 Contents Internet Protocol (IP) – Address and routing of datagrams Internet Control Message Protocol (ICMP) Classless Inter-Domain Routing (CIDR) and Network Address Translation (NAT) Address Resolution Protocol (ARP) Dynamic Host Configuration Protocol (DHCP)

Upload: dokhanh

Post on 04-Feb-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

1

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

12001-01-23

Tik-110.350 Computer Networks

Lecture 2:

Internet Protocol

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

22001-01-23

Contents

• Internet Protocol (IP)– Address and routing of datagrams

• Internet Control Message Protocol (ICMP)

• Classless Inter-Domain Routing (CIDR) and Network Address Translation (NAT)

• Address Resolution Protocol (ARP)

• Dynamic Host Configuration Protocol (DHCP)

Page 2: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

2

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

32001-01-23

Internet Protocol (IP)

Comer’s

chapters4, 7 and 8 (3rd and 4th ed.)

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

42001-01-23

Repetition of IP

• Classfull addressing– Five classes of addresses

– Addresses are divided to netid (identifies the network) and hostid (a host in the network)

• Address specifies a connection to a network, not a computer

Page 3: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

3

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

52001-01-23

Internet Control Message Protocol (ICMP)

Comer’s

chapter 9 (3rd and 4th ed.)

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

62001-01-23

Repetition of ICMP

• Internet Control Message Protocol (ICMP)

• Connectionless system is unreliable

• Control and error information

• Router to router or router to host

• ICMP works over IP

Page 4: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

4

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

72001-01-23

Structure of ICMP message

• ”Header” contains – type (8 bits)

– code (8 bits)

– checksum (16 bits)

• Error message contains the begining of the packet which was causing problems

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

82001-01-23

Echo Request/Reply

• Ping program tests reachability of destination

• Traceroute traces the route to destination

TYPE (8 or 0) CODE (0) CHECKSUMIDENTIFIER SEQUENCE NUMBER

OPTIONAL DATA...

Page 5: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

5

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

92001-01-23

Destination unreachable

• code inidicates reason of unreachability, for example destination host unknown

TYPE (3) CODE (0-12) CHECKSUMUNUSED

INTERNET HEADER +FIRST 64 BITS OF DATAGRAM

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

102001-01-23

Congestion

• Datagrams cannot be delivered– A computer can send data too fast for the

network

– Single router is overloaded

TYPE (4) CODE (0) CHECKSUMUNUSED

INTERNET HEADER +FIRST 64 BITS OF DATAGRAM

Page 6: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

6

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

112001-01-23

Redirect

• Routers should know the correct route

• Redirect informs a sender that next time use the other route (not send to other router)

TYPE (5) CODE (0-3) CHECKSUMROUTER INTERNET ADDRESS

INTERNET HEADER +FIRST 64 BITS OF DATAGRAM

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

122001-01-23

Other errors

• Detecting loops– Time-to-live (TTL) reaches zero– Time Exceeded ICMP message– code tells if the TTL reaches zero or if a

fragment of the datagram has been lost

• Misformed IP packets– Parameter Problem message– Incorrect header checksum is not reported

Page 7: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

7

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

132001-01-23

Other uses of ICMP

• Clock synchronization– timestamp request/reply messages

• Subnet mask– address mask request/reply

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

142001-01-23

Summary & References

• ICMP is used for error detection – not error correction

• Many kind of messages

• Some can be security risks

• Comer chapter 9

Page 8: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

8

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

152001-01-23

Subnetting and Supernetting

Comer’s

chapter10 (3rd and 4th ed.)

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

162001-01-23

Techniques

• Transparent router scheme

• Proxy ARP

• Subnet addressing

• Point-to-point links

• CIDR

Page 9: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

9

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

172001-01-23

Subnetting

• Used locally in a network

• Fixed-length subnetting

• Variable-length subnetting– every subnetwork may have different subnet

length

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

182001-01-23

Subnet mask

• 1 = part of subnet prefix

• 0 = host identifier

• Binary notation

• Recommendation: use contiguous subnet masks

11111111 11111111 11111111 1100000011111111 11111111 00011000 01000000

Page 10: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

10

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

192001-01-23

Subnet Mask Representation

• Dotted decimal representation or

• 3-tuple { <network #>, <subnet #>, <host #> }

– For example, for B-class network with subnet mask 255.255.255.0:{ -1, -1, 0}

– For example, for network address 128.10: {128.10, -1, 0}

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

202001-01-23

Subnet routing & broadcasting

• Routing algorithm and routing table must be modified– Normal routing is based on network address

and next hop address– Now the subnet mask is also needed

• Broadcasting – even to several physical networks– to a specific subnet

Page 11: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

11

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

212001-01-23

Supernetting

• Running out of B-class networks– C-class network consist on only 254 hosts

– Routing tables grow

– How combine several C-class networks to act like one network?

– How to give only few IP-addresses to a customer?

• Classless Inter-Domain Routing (CIDR)

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

222001-01-23

Classless Inter-Domain Routing

• Contiguous IP network numbers can be advertised as a pair:– Network address of the first network

– Number of contiguous networks

• Giving a part of a (C-class) network

• Block of addresses is power of two

Page 12: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

12

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

232001-01-23

Routing with CIDR

• Router cannot distinguish prefix and suffix – Lookups from routing table

– Search by longest prefix (inefficient)

– Usually hierarchical data structures are used

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

242001-01-23

Summary

• Distribution of one large network– Subnetting and other technologies

• Classless addresses– Combining several network addresses

– Using part of a network address space

– CIDR

Page 13: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

13

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

252001-01-23

References

• Comer(note: more information in 4th ed. than in the 3rd ed.)

• Robert Hart: IP Sub-Networking Mini-Howto, March 1997 (GNU)

• RFC 950 - Internet Standard Subnetting procedure, August 1985

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

262001-01-23

Network Address Translation (NAT)

Comer’s

chapter20 (4th ed.)

Page 14: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

14

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

272001-01-23

Concept of Private Internet

• Allow connection with everybody

• But hide the internal datagram transmission

• Routers/firewalls deny access of outsiders to private network

• Private network can use arbitrary IP addresses

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

282001-01-23

Network Address Translation (NAT)

• IP-addresses can be mapped from one realm to another

• Transparent communication with external and private network– To hide private network

– To hide invalid IP-addresses

• Works if application protocols does not use IP-addresses

Page 15: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

15

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

292001-01-23

NAT Translation Table

• Manual initialization– permanent mapping

• Outgoing datagrams– sent datagrams– most widely used– outsider cannot begin communication

• Incoming name lookups– modifications to DNS

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

302001-01-23

Port-Mapped NAT

• Network Address Port Translation (NAPT)

• NAT table contains also port numbers– Private IP-address

– Private port

– NAT port

– External IP-address

– External port

Page 16: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

16

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

312001-01-23

Interaction with Other Protocols

• NAT and ICMP– Which ICMP messages are forwarded?

– Echo request must be forwarded to correct host

– Why? Destination unreachable

• NAT and applications– Does not work if application uses IP-addresses

– or data in the packets must be changed

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

322001-01-23

Summary & References

• Comer: “Network Address Translation technology provides transparent IP-level access to the Internet from a host with a private address.”

• Comer chapter 20

• RFC 2663 - IP Network Address Translator (NAT) Terminology and Considerations, August 1999

Page 17: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

17

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

332001-01-23

Address Resolution Protocol (ARP)

Comer’s

chapter5 (3rd and 4th ed.)

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

342001-01-23

Repetition of ARP

• Address Resolution Problem

• Two kind of physical network addresses: small & flexible and long & fixed

• Address Resolution Protocol works in broadcast networks

• IP-address - hardware address pair is saved in ARP cache

Page 18: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

18

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

352001-01-23

Advantages and Disadvantages

• Advantages– Computers work independently

– If the target does not response, it is down

– No need for reliable transmission

• Disadvantage– Delay caused by cache

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

362001-01-23

ARP Message Format

PROTOCOL TYPE

HLEN PLEN OPERATION

SENDER HA

SENDER IP

TARGET HA

TARGET IP

HARDWARE TYPE

0 16 32 47

Page 19: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

19

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

372001-01-23

Sending an ARP Packet

• Check ARP cache– If physical address is known, send packet

• Send a broadcast request– Queue for outgoing packets

– Retransmission if necessary

• Setting timer for ARP cache entries – If the destination goes offline or crashes

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

382001-01-23

Handling of Incoming Packets

• Receiver– Response to the query if the physical address

corresponds the machines physical address

– Save addresses to cache

• Sender– Create cache entry / match with a cache entry

– Handle additional queries of same address

Page 20: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

20

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

392001-01-23

Summary & References

• ARP is used to find out physical address of a machine that corresponds an IP-address

• ARP works in one physical network

• Comer

• RFC 826 - An Ethernet Address Resolution Protocol, November 1982

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

402001-01-23

Dynamic Host Configuration Protocol (DHCP)

Comer’s

chapter23 (4th ed.)

chapter 21 (3rd ed.)

Page 21: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

21

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

412001-01-23

Purpose

• Physical network address– hardware dependent

• IP-address– independent of machine’s hardware address

• How all kind of machines can find out their IP-addressesand other network settings?

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

422001-01-23

History: RARP

• Reverse Address Resolution Protocol (RARP)

• Machine without disk can find out its IP-address

• Based on ARP

• Main drawback: uses the physical network directly

Page 22: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

22

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

432001-01-23

History: BOOTstrap Protocol

• Application layer protocol

• Uses UDP and IP – before knowing machines own IP-address

– on top of untrusted path

• Two phase protocol:– First get information about network

– Then get memory image with other protocol, for example, TFTP

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

442001-01-23

Example Network

Internet

router.example.net

DHCP server

Remember toreed the coursebook.

DHCP clients

laptop.example.net

server.example.net

terminal.example.netcomputer.example.net

Page 23: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

23

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

452001-01-23

DHCP

• Tree types of address assignment– Manual configuration

– Automatic configuration

– Dynamic configuration

• Example of configuration file with different kind of address assignment (next slide)

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

462001-01-23

Exampleoption domain - name "example.net";

option domain - name- servers server.example.net;option broadcast - address 10.0.1.255;

option routers router.example.net;

shared - network EXAMPLE {

option subnet - mask 255.255.255.248;default - lease - time 120000;

max- lease - time 720000;

subnet 10.0.1.1 0 netmask 255.255.255.248 {

range 10.0.1.11 10.0.1.12;}

host computer {hardware ethernet 00:01:5a:93:a7:e6;

fixed - address computer.example.net;}

}

Page 24: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

24

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

472001-01-23

Dynamic Address Allocation

• Server leases an address

• A certain period of time (server/administrator decides)

• Leases can be renewed

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

482001-01-23

Multiple Network Connections

• Computer that is connected to more than one network– Needs configuration information separately for

all its interfaces

• Network may contain relay agents– Forwards requests to server

– Several request from same computer may end up to same server.

Page 25: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

25

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

492001-01-23

State Machine of DHCP Client

INITIALIZEHost boots

dhcpdiscover

REQUEST

REBIND

BOUND

RENEWSELECT

dhcpoffer

Select/dhcprequest

dhcpack

dhcpnackdhcpnackorLease expires

dhcpack dhcpack50% time/dhcprequest

87.5% time/dhcprequest

cancel/dhcpreleaseFig. 23.4 in Comer

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

502001-01-23

DHCP Message Format

OP HTYPE HLEN HOPS TRANSACTION ID

SECONDS FLAGSCLIENT IP ADDRESSYOUR IP ADDRESS

SERVER IP ADDRESSROUTER IP ADDRESS

CLIENT HARDWARE ADDRESS ...SERVER HOST NAME ...

BOOT FILE NAME ...OPTIONS...

0 8 16 24 31

Page 26: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

26

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

512001-01-23

Summary

• DHCP is used to distribute IP-addresses for computers and diskless terminals– Automatically or dynamically

• DHCP does not interact with DNS– Names must be handled separately

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

522001-01-23

References

• Comer: chapters 6 and 23• RFC 903 – A Reverse Address Resolution

Protocol, 1984• RFC 951 - Bootstrap Protocol (BOOTP), 1985• RFC 1534 - Interoperation Between DHCP and

BOOTP, 1993• RFC 2131 – Dynamic Host Configuration Protocol,

1997• RFC 2606 - Reserved Top Level DNS Names,

1999

Page 27: Tik-110.350 Computer Networks -  · PDF fileTik-110.350 Computer Networks   1 2001-01-23 Tik-110.350 Computer Networks Lecture 2: Internet Protocol Sanna Liimatainen

27

Sanna [email protected]

Tik-110.350 Computer Networkshttp://www.tml.hut.fi/Studies/Tik-110.350/

532001-01-23

Summary

• This lecture – Concludesthe Internet Protocol facts

– Handledmany kind of address translations between layers and networks (from ARP to NAT)

– Tells how IP-addresses can be distributed (from RARP to DHCP)