0% found this document useful (0 votes)
4 views

Lecture 6 - Internet Layer

Uploaded by

bananafromcsp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lecture 6 - Internet Layer

Uploaded by

bananafromcsp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Lecture 6:

Internet Layer

Reading 5.1. and 5.6 in


Computer Networks, Tanenbaum

1
Contents
 Internet Protocol
 IP address and IP packet format
 ICMP- Protocol for control message

2
Introduction about IP
Concepts
Store and forward principles
Characteristic of IP

3
Network layer and Internet
protocol
 Role of network layer: Transferring data between distant nodes
 Two main functionalities of Network layer
 Routing: Determine the path for transferring data from the source
to the destination nodes  Role of routing protocol.
 Forwarding: Transferring data from the an incoming port to an
outgoing port of a node (router) according to the path defined
above  Role of routed protocol: Internet Protocol (IP)

application
application
TCP/UDP
TCP/UDP
IP
IP
data link 1. Send data 2. Receive data data link
physical
physical

4
Network layer and Internet
protocol
 Layer 2 devices allow to connect limited
number of close hosts
 When hosts are far from each other,
intermediates nodes with forwarding and path
finding functionality is needed  Router
 Finding routes
 Forwarding data according to destination Network
layer address

5
IP principles
 Elements
 host = end system;
 subnetwork = a collection of hosts that are connected by layer-2
devices
 Host of the same subnetwork have similar addresses: a common
prefix
 Routers: intermediate nodes interconnect subnetworks:
 Packet forwarding
 direct: inside a subnetwork hosts communicate directly without
routers, layer-2 device (switch) delivers packets to hosts
 indirect: between subnetworks one or several routers forward
packets based on
 structured address space
 routing tables: aggregation of entries
6
IP Routing and forwarding

IP packet Ver IHL TOS Packet length


Identification Flag Fragment Offset

TTL Protocol Header Checksum

Source IP address
payload IP header Destination IP address

Host
Router

• Where to forward the


packet? Router

• Routing according to
destination address
Router
• Host with similar address 7
should be in the same region Host
IP forwarding
 Routing table
 Each router have a routing table telling where to forward a packet

 Rule for sending packets (hosts, routers)


§ if the destination IP address has the same prefix as
one of my interfaces, send directly to that interface
§ otherwise send to a router as given by the IP routing
table
8
IP characteristics
 Not reliable / fast
 Sending data in “best effort” manner
 No mechanism to recover error data at the
receiver
 When necessary, leave the upper layer (TCP) to
ensure the data reliability.
 Packets are processed independently one of
the other.

9
IP address
IP address classes
CIDR – Classless Inter-Domain routing
Subnet and netmask
Special IP addresses

10
IP address (IPv4)
 IP address: A 32-bit
223.1.1.1
number identifying
uniquely a network 223.1.1.2
223.1.2.1

interface 223.1.1.4 223.1.2.9

 Interface: 223.1.1.3 223.1.3.27


223.1.2.2
 router’s typically have
multiple interfaces
 host may have multiple
223.1.3.1 223.1.3.2
interfaces
 IP addresses associated
with interface, not host,
router
223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1
11
IP address (IPv4)
 For routing purpose, IP  a 223.1.1.1
address of interfaces in
223.1.2.1
the same subnetwork 223.1.1.2
223.1.1.4 223.1.2.9
have the same prefix.
 What’s a subnetwork? 223.1.1.3 223.1.3.27
223.1.2.2
(from IP address perspective)
 device interfaces with same
prefix
223.1.3.1 223.1.3.2
 can physically reach each
other without intervening
router (using layer 2
A subnetwork
technology only)
12
Dot notation

Example:
203.178.136.63 o
259.12.49.192 x
133.27.4.27 o
8 bits
0 – 255 integer

Use 4 x 8 bits describing a 32 bits address

3417476964
1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0

203 178 143 100 13


Host address, network
address
 IP address contains two parts
 Host ID – identify a host in a network
 Network ID – identify a network
Network ID Host ID

1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0

203 178 143 100

 How to know which bits belong to network ID or host


ID parts?
 Use classful IP address
14
 Use classless IP address– CIDR
Classify IP addresses
8bits 8bits 8bits 8bits

Class A 0 7bit H H H
Class B 1 0 6bit N H H
Class C 1 1 0 5bit N N H
Class D 1 1 1 0 Multicast
Class E 1 1 1 1 Reserve for future use

# of network # of hosts
Class A 128 2^24
Class B 16384 65536
15
Class C 2^21 256
Exercise
 Determine which classes do these IP
addresses belong to:
 10.10.10.9
 192.168.70.5
 129.60.4.7

16
Limitation of classful IP address
 Inefficient use of addressing space
 Hard classification of addressing space into classes (A, B,
C, D, E) makes it is difficult to use all the address space

Solution…
 CIDR: Classless Inter Domain Routing
 Network ID part will have variable length.
 Length of Network ID part is specified in Network mask
 Address notation: a.b.c.d/x, where x (mask) the number of
bit of Network ID part.
17
Network mask
 Network mask divides the IP address into two
parts
 Part corresponding to Host ID
 Part corresponding to Network ID
 IP addresses are assigned to hosts so that all
hosts in the same network have the same
Network ID part.
 Based on Network mask, it is possible to
 Identify the network where an IP address belongs to
 Calculate how many IP addresses available in the network
associated with the mask. 18
Presentation of network mask
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0

255 255 255 224

 255.255.255.224  Last byte may


 /27 be:
 0xFFFFFFe0 0 248
128 252
192 254
224 255
240
19
Calculation of network
address
Network part Host Part

203 . 178 . 142 . 130


IP Address 11001011 10110010 10001110 10000010

255 . 255 . 255 . 224


Netmask (/27) 11111111 11111111 11111111 11100000

AND
27 (bit)
203 . 178 . 142 . 128
11001011 10110010 10001110 10000000

Network address 203.178.142.128/27


20
Calculation of network size

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0

255 255 255 192


 Network size  In case of mask /26
 Power of 2  Bits for Host ID = 6 bits
6
2 =64 possible address:
 RFC1878 
 0 - 63

 64 - 127

 128 - 191

 192 – 255

 Including network
address and broadcast 21
address
Network address or host
address (1)

133 27 4 160
10000101000110110000010010100000

1 1111111111111111111111111000000

1 0000101000110110000010010000000
133 27 4 128

22
Network address or host
address (2)

133 27 4 160
10000101000110110000010010100000

1 1111111111111111111111111100000

1 0000101000110110000010010100000
133 27 4 160

23
Different significations of IP
address
 Network address
 IP address assigned to a network
 hostID contains all 0
 Host address
 IP address assigned to a network card
 Broadcast address
 Address used for sending data to all hosts in a
network
 All bit 1 in HostID part.
24
Exercice: IP address and
network mask
 Which of the following IP addresses are host
address, network address, broadcast address?
(1) 203.178.142.128 /25

(2) 203.178.142.128 /24

(3) 203.178.142.127 /25

(4) 203.178.142.127 /24

 Attn: With CIDR addressing, IP address should


always coming with a network mask

25
Subnet
 Subnet is a part of a
223.1.1.1
network
223.1.2.1
 Hosts of a subnet 223.1.1.2
communicate directly 223.1.1.4 223.1.2.9
without reaching to
223.1.2.2
layer 3. 223.1.1.3 223.1.3.27
 Usually is one
subnet
department of an
organization 223.1.3.1 223.1.3.2

 Design question: How


to assign addresses of
A network with 3 subnets.
a network to subnets
26
 Use a longer netmask
Example: Divide into 2 subnets

11001000 00010111 00010000 00000000


200. 23. 16. 0 /24

11001000 00010111 00010000 00000000


200. 23. 16. 0 /25
11001000 00010111 00010000 10000000
200. 23. 16. 128 /25

27
Principle
 Divide a IP range into sub-ranges of equal size
 Take some bits from HostID part to distinguish
subnets
 each subnet contains IP addresses with a fixed values
of subnet ID.
Network ID Host ID

subnetID

28
network ID of each subnet
Exercise: Dividing into
subnets
 Given IP addresses in the range 200.23.16.0/24
1) Need to organize into 8 subnets
 Address of each subnetwork? Mask? Number of
hosts/network
 200.23.16.0 /27
2) General question: Need to create N subnets.
Network address? Mask?
 Each network contains 14 hosts /28
 Each network contains 30 hosts /27
 Each network contains 31 hosts /26
29

 Each network contains 70 hosts /25


Answers
 200.23.16.0 /27  0000 0000
 200.23.16.32 /27  0010 0000
 200.23.16.64 /27  0100 0000
 200.23.16.96 /27  0110 0000
 200.23.16.128 /27  1000 0000
 200.23.16.160 /27  1010 0000
 200.23.16.192 /27  1100 0000
 200.23.16.224 /27  1110 0000
30
Addressing space of IPv4
 In theory
 All between 0.0.0.0 ~ 255.255.255.255
 Some special IP address (RFC1918)

10.0.0.0/8
Private address 172.16.0.0/12
192.168.0.0/16
Loopback address 127.0.0.0
224.0.0.0
Multicast address
~239.255.255.255

 Self assigned IP address: 169.254.0.0/16


31
Attention about IP
 Currently IPv4: 32 bits
 133.113.215.10 (IPv4)
 IPv6 is also widely used: 128bits
 2001:200:0:8803::53 (IPv6)
 Fix 64 first bit for subnet ID, 64 last bit belongs to
interface ID.
 Security feature is integrated

32
IP package

33
Header of IP
total datagram
length (words)
IP protocol version
number 32 bits
head.
header length ver DS length
len for
(bytes) fragment
16-bit identifier flgs fragmentation/
offset reassembly
QoS support time to upper header
live layer checksum
max number 32 bit source IP address
remaining hops
(decremented at 32 bit destination IP address
each router) E.g. timestamp,
Options (if any)
record route
data taken, specify
upper layer protocol (variable length, list of routers
to deliver payload to typically a TCP to visit.
or UDP segment)
34
IP header (1)
 Version (4 bits)
 IPv4
 IPv6
 Header length: 4bits
 In word unit (4 bytes)
 Min: 5
 Max: 60

35
IP header (2)
 DS (Differentiated Service : 8bits)
 Old name: Type of Service
 Used for QoS management by some router
 Diffserv

36
IP header (3)
 Length: total length including header (16 bits)
 In bytes unit
 Max: 65536
 16 bits Identifier– ID of the packet
 Used for identifying all fragments of the same packet when
it is fragmented
 Flag
 Fragmentation offset – offset of the first byte of
the fragment in its original packet

37
IP header (4)
 TTL, 8 bits – Time to live
 Maximum number of hops (router) the packet is allowed to
travel
 Max: 255
 Router decreases TTL 1 unit when processing a packet
 The packet will be destroyed when TTL reaches to 0
 Protocol – upper layer protocol
 Transport protocol (TCP, UDP,…)
 Other network layer protocols that are encapsulated in IP
packet (ICMP, IGMP, OSPF )

38
IP header (4)
 Checksum: to detect corruption in the header
of IPv4 data packets
 Source IP address
 32 bit, address of the sender
 Destination IP address
 32 bit, address of the receiver.

39
Packet fragmentation (1)
 Each link has a fixed
MTU (Maximum Phân mảnh:
transfering unit) in: 1 gói tin lớn
out: 3 gói tin nhỏ hơn
 Different media have
different MTU
 If IP packet > MTU, it Hợp nhất
should be
 Divided into small fragments
 Gathered at the destination

40
Packet fragmentation (2)
 Offset
 Position of the fragment in the original packet
 In 8 bytes units
0 1399
Offset = 0/8 = 0

0 1400 2800 3999 1400 2799


Offset = 1400/8 = 175

2800 3999
Offset = 2800/8 = 350

41
Internet Control Message Protocol

Packet format
Ping and Traceroute

42
Idea of ICMP (1)

 IP is unreliable, connectionless
 Lack of supporting and error control mechanism
 ICMP is used in network layer for providing
information exchange between sender and
receivers
 Error information: inform that a packet cannot reach
a host, a network or a port.

43
Idea of ICMP (2)

 Also in network layer but is “above” IP


 ICMP message is encapsulated in IP
 ICMP message: Type, Code, with 8 first bytes of the
error IP message

ICMP message

IP header ICMP message

44
IP header and Protocol field

Ver HLEN DS Total Length


Fragmentation
Protocol:
Identification Flags
offset 1: ICMP
TTL Protocol Header Checksum 2: IGMP
Source IP address 6: TCP
17: UDP
Destination IP address
89: OSPF
Option

45
ICMP message format
 Type: type of ICMP message
 Code: cause of error
 Checksum
 Rest of header varies according on type
0 78 15 16 31
Type Code Checksum

Rest of the header

Data

46
Some ICMP message types

3 Destination Unreachable
4 Source quench (nguồn giảm tốc độ)
Error-reporting
ICMP Message Type

5 Redirection
messages
11 Time exceeded
12 Parameter problem
8 or 0 Echo reply or request

Query 13 or 14 Time stamp request or reply


messages 17 or 18 Address mask request or reply

9 or 10 Router advertisement or solicitation

47
ICMP and debuging tools
 ICMP always works transparently for users
 Users can use ICMP by using some
debuging tools
 ping
 traceroute

48
Ping and ICMP
 ping
 Test a connection
 Sender sends packet “ICMP echo request”
 Receiver responses with “ICMP echo reply”
 Data field contains the time stamp when the
packet is sent
 For calculating RTT (round-trip time)

49
Ping: Example

C:\Documents and Settings\hongson>ping www.yahoo.co.uk

Pinging www.euro.yahoo-eu1.akadns.net [217.12.3.11] with 32 bytes of data:

Reply from 217.12.3.11: bytes=32 time=600ms TTL=237


Reply from 217.12.3.11: bytes=32 time=564ms TTL=237
Reply from 217.12.3.11: bytes=32 time=529ms TTL=237
Reply from 217.12.3.11: bytes=32 time=534ms TTL=237

Ping statistics for 217.12.3.11:


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 529ms, Maximum = 600ms, Average = 556ms

50
Traceroute and ICMP
 Sender send many packets to receiver
 First packet has TTL =1

 Second packet has TTL=2, …

 When packet number n arrives to nth router:


 Router destroys the packer

 Router send back an ICMP packet (type 11, code 0)


containing IP address of the router
 Based on the reply message, the sender can calculate RTT

51
Traceroute and ICMP
Termination condition
 When ICMP echo packet arrive to the destination

 When source receives ICMP “host unreachable”


(type 3, code 3)

3 probes 3 probes

3 probes

52
Traceroute: Example
C:\Documents and Settings\hongson>tracert www.jaist.ac.jp

Tracing route to www.jaist.ac.jp [150.65.5.208]


over a maximum of 30 hops:

1 1 ms <1 ms <1 ms 192.168.1.1


2 15 ms 14 ms 13 ms 210.245.0.42
3 13 ms 13 ms 13 ms 210.245.0.97
4 14 ms 13 ms 14 ms 210.245.1.1
5 207 ms 230 ms 94 ms pos8-2.br01.hkg04.pccwbtn.net [63.218.115.45]
6 * 403 ms 393 ms 0.so-0-1-0.XT1.SCL2.ALTER.NET [152.63.57.50]
7 338 ms 393 ms 370 ms 0.so-7-0-0.XL1.SJC1.ALTER.NET [152.63.55.106]
8 402 ms 404 ms 329 ms POS1-0.XR1.SJC1.ALTER.NET [152.63.55.113]
9 272 ms 288 ms 310 ms 193.ATM7-0.GW3.SJC1.ALTER.NET [152.63.49.29]
10 205 ms 206 ms 204 ms wide-mae-gw.customer.alter.net [157.130.206.42]
11 427 ms 403 ms 370 ms ve-13.foundry2.otemachi.wide.ad.jp [192.50.36.62]
12 395 ms 399 ms 417 ms ve-4.foundry3.nezu.wide.ad.jp [203.178.138.244]
13 355 ms 356 ms 378 ms ve-3705.cisco2.komatsu.wide.ad.jp [203.178.136.193]
14 388 ms 398 ms 414 ms c76.jaist.ac.jp [203.178.138.174]
15 438 ms 377 ms 435 ms www.jaist.ac.jp [150.65.5.208]

Trace complete.

53
Network address
translation

54
NAT: network address translation
NAT: all devices in local network share just one IPv4 address as
far as outside world is concerned
rest of local network (e.g., home
Internet network) 10.0.0/24

10.0.0.1
138.76.29.7 10.0.0.4

10.0.0.2

10.0.0.3

all datagrams leaving local network have datagrams with source or destination in
same source NAT IP address: 138.76.29.7, this network have 10.0.0/24 address for
but different source port numbers source, destination (as usual)
NAT: network address translation
 all devices in local network have 32-bit addresses in a “private” IP
address space (10/8, 172.16/12, 192.168/16 prefixes) that can only
be used in local network
 advantages:
 just one IP address needed from provider ISP for all devices
 can change addresses of host in local network without notifying
outside world
 can change ISP without changing addresses of devices in local
network
 security: devices inside local net not directly addressable, visible
by outside world
NAT: network address translation
implementation: NAT router must (transparently):
 outgoing datagrams: replace (source IP address, port #) of every
outgoing datagram to (NAT IP address, new port #)
• remote clients/servers will respond using (NAT IP address, new port
#) as destination address
 remember (in NAT translation table) every (source IP address, port #)
to (NAT IP address, new port #) translation pair
 incoming datagrams: replace (NAT IP address, new port #) in
destination fields of every incoming datagram with corresponding
(source IP address, port #) stored in NAT table
NAT: network address translation
NAT translation table
2: NAT router changes 1: host 10.0.0.1 sends
WAN side addr LAN side addr datagram to
datagram source address
from 10.0.0.1, 3345 to 138.76.29.7, 5001 10.0.0.1, 3345 128.119.40.186, 80
138.76.29.7, 5001, …… ……
updates table
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4 10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 128.119.40.186, 80 10.0.0.3
D: 138.76.29.7, 5001 3
3: reply arrives, destination
address: 138.76.29.7, 5001

Static vs dynamic NAT


- Simple NAT: One private IP for one public IP, fixed
- Dynamic NAT: an available public IP will be assigned for a private IP dynamically
Address resolution protocol

59
ARP: address resolution protocol
Question: how to determine interface’s MAC address, knowing its IP
address?
ARP table: each IP node (host,
ARP
router) on LAN has table
137.196.7.78
ARP
1A-2F-BB-76-09-AD • IP/MAC address mappings for
ARP some LAN nodes:
LAN < IP address; MAC address; TTL>
71-65-F7-2B-08-53
137.196.7.23
58-23-D7-FA-20-B0
137.196.7.14 • TTL (Time To Live): time after
ARP 0C-C4-11-6F-E3-98 which address mapping will be
137.196.7.88
forgotten (typically 20 min)
ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

A broadcasts ARP query, containing B's IP addr


Ethernet frame (sent to FF-FF-FF-FF-FF-FF)
1 • destination MAC address = FF-FF-FF-FF-FF-FF
• all nodes on LAN receive ARP query C Source MAC: 71-65-F7-2B-08-53
Source IP: 137.196.7.23
ARP table in A Target IP address: 137.196.7.14

IP addr MAC addr TTLTTL
A B
1
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

D
ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

ARP message into Ethernet frame


(sent to 71-65-F7-2B-08-53)
C Target IP address: 137.196.7.14
Target MAC address:
ARP table in A 58-23-D7-FA-20-B0

IP addr MAC addr TTLTTL
A B
2
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

2 B replies to A with ARP


response, giving its MAC address
D
ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

C
ARP table in A
IP addr MAC addr TTL TTL
137.196.7.14 58-23-D7-FA-20-B0 500 A B

71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

3 A receives B’s reply, adds B entry


into its local ARP table
D
Routing to another subnet: addressing
walkthrough: sending a datagram from A to B via R
 focus on addressing – at IP (datagram) and MAC layer (frame) levels
 assume that:
• A knows B’s IP address
• A knows IP address of first hop router, R (how?)
• A knows R’s MAC address (how?)

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Routing to another subnet: addressing
 A creates IP datagram with IP source A, destination B
 A creates link-layer frame containing A-to-B IP datagram
• R's MAC address is frame’s destination
MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Routing to another subnet: addressing
 frame sent from A to R
 frame received at R, datagram removed, passed up to IP

MAC src: 74-29-9C-E8-FF-55


IP src: 111.111.111.111
MAC dest: E6-E9-00-17-BB-4B
IP dest: 222.222.222.222
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP IP
Eth Eth
Phy Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F

Link Layer: 6-66


Routing to another subnet: addressing
 R determines outgoing interface, passes datagram with IP source A, destination B
to link layer
 R creates link-layer frame containing A-to-B IP datagram. Frame destination
address: B's MAC address MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Et
h
Ph
A y
B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F

Link Layer: 6-67


Routing to another subnet: addressing
 R determines outgoing interface, passes datagram with IP source A, destination B
to link layer
 R creates link-layer frame containing A-to-B IP datagram. Frame destination
address: B's MAC address MAC src: 1A-23-F9-CD-06-9B

 transmits link-layer frame MAC dest: 49-BD-D2-C7-56-2A


IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F

Link Layer: 6-68


Routing to another subnet: addressing
 B receives frame, extracts IP datagram destination B
 B passes datagram up protocol stack to IP

IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F

Link Layer: 6-69


Dynamic Host Configuration
Protocol

70
DHCP: Dynamic Host
Configuration Protocol
goal: host dynamically obtains IP address from network server when it
“joins” network
 can renew its lease on address in use
 allows reuse of addresses (only hold address while connected/on)
 support for mobile users who join/leave network

DHCP overview:
 host broadcasts DHCP discover msg [optional]
 DHCP server responds with DHCP offer msg [optional]
 host requests IP address: DHCP request msg
 DHCP server sends address: DHCP ack msg
DHCP client-server scenario
Typically, DHCP server will be co-
DHCP located in router, serving all
223.1.1.1 server subnets to which router is attached
223.1.2.1

223.1.2.5
223.1.1.2
223.1.1.4 223.1.2.9

223.1.1.3
223.1.3.27 arriving DHCP client needs
223.1.2.2 address in this network

223.1.3.1 223.1.3.2
DHCP client-server scenario
DHCP server: 223.1.2.5 DHCP discover Arriving client
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server!
yiaddrr:Here’s an IP
223.1.2.4
transaction
address youID:can
654 use
lifetime: 3600 secs
The two steps above can
DHCP request be skipped “if a client
src: 0.0.0.0, 68 remembers and wishes to
dest:: 255.255.255.255, 67
Broadcast: OK. I would reuse a previously
yiaddrr: 223.1.2.4
like totransaction
use this ID:IP655
address! allocated network
lifetime: 3600 secs address” [RFC 2131]

DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
lifetime: 3600 secs
DHCP: more than IP addresses
DHCP can return more than just allocated IP address on
subnet:
 address of first-hop router for client
 name and IP address of DNS sever
 network mask (indicating network versus host portion of address)
Extend using
DHCP Client DHCP Server
 Limit time  extend
 t = 0.5*T, client sends
DHCP Request to DHCP t = 0.5*T
Server to request
extension
 No DHCP ACK, then t =
Other Server
0.875*T, client sends the
t = 0.875*T
broadcast DHCP Request
 No DHCP ACK, while t =
T, client sends DHCP
Discover
t=T 75
DHCP Relay
 DHCP Server stays on another subnet  broadcast
packets will be forwared by routers
 DHCP Relay on routers

DHCP Client Router DHCP Server


DHCP Discover (broadcast) DHCP Discover (unicast)

DHCP Offer DHCP Offer

DHCP Discover (broadcast) DHCP Discover (unicast)

DHCP ACK/NAK DHCP ACK/NAK


76
Summary
 More on Network Layer
 Internet protocol
 IP address and IP packet format
 ICMP
 Ping
 Traceroute
 DHCP
 NAT
 ARP
77

You might also like