1 computer communication & networks lecture 19 network layer: ip and address mapping waleed...
TRANSCRIPT
![Page 1: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/1.jpg)
1
Computer Communication & Networks
Lecture 19
Network Layer: IP and Address Mapping
http://web.uettaxila.edu.pk/CMS/coeCCNbsSp09/index.asp
Waleed [email protected]
![Page 2: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/2.jpg)
2
Network Address Translation (NAT)
![Page 3: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/3.jpg)
3
Addresses for private networks
![Page 4: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/4.jpg)
4
A NAT Implementation
![Page 5: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/5.jpg)
5
Addresses in a NAT
![Page 6: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/6.jpg)
6
NAT Address Translation
![Page 7: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/7.jpg)
7
Five-column translation table
![Page 8: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/8.jpg)
8
An ISP and NAT
![Page 9: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/9.jpg)
9
Network Layer
![Page 10: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/10.jpg)
10
Network Layer Topics to CoverLogical Addressing
Internet Protocol
Address Mapping
Delivery, Forwarding, Routing
![Page 11: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/11.jpg)
11
Internetworking In this section, we discuss internetworking,
connecting networks together to make an internetwork or an internet.
![Page 12: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/12.jpg)
12
Network layer in an Internetwork
![Page 13: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/13.jpg)
13
IPv4 The Internet Protocol version 4 (IPv4) is the
delivery mechanism used by the TCP/IP protocols.
![Page 14: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/14.jpg)
14
IPv4 datagram format
![Page 15: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/15.jpg)
15
IP Packet Format
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol IP Header Checksum
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Data
![Page 16: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/16.jpg)
16
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Current IP Protocol Version is 4, called IPv4
![Page 17: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/17.jpg)
17
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Length of IP Header in number of 32 bit words including options. Maximum header size is 60 bytes.
![Page 18: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/18.jpg)
18
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
The type-of-service field is composed of a 3-bit precedence field. (Which are largely ignored in current routers).4 TOS bits and an unused bit that must be zero.
![Page 19: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/19.jpg)
19
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
4 TOS bits are: minimize delay, maximize throughput, maximize reliability, and minimize monetary cost. Only one of these bits can be turned on. All 4 bits set to 0 means normal service.
![Page 20: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/20.jpg)
20
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Total length of IP datagram in bytes. It is a 16 bit field. Largest size of an IP datagram is 65635 bytes. Maximum header size is 60 bytes. Link layer MTU may restrict this size further.
![Page 21: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/21.jpg)
21
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Identification field uniquely identifies each datagram sent by a host. It is normally incremented by one each time a host sends a datagram. Very useful for fragmentation and reassembly.
![Page 22: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/22.jpg)
22
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
flags field also used for fragmentation and reassembly.
![Page 23: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/23.jpg)
23
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Fragmentation offset used for fragmentation and reassembly.
![Page 24: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/24.jpg)
24
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Time-to-live or TTL field sets an upper limit on how man routers a datagram can go through. Every router decrements TTL by 1 before sending it forward. If TTL reaches 0 the datagram is dropped and an ICMP message is sent to the host application.
![Page 25: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/25.jpg)
25
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Identifies the protocol that sent the datagram. The protocol (today) can be ICMP, IGMP, TCP, UDP
![Page 26: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/26.jpg)
26
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
The header checksum is calculated over the IP header only. TCP, UDP etc protect their own data and header by a checksum.
![Page 27: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/27.jpg)
27
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
•Security handling used for military purposes (remember ARPANET was funded by US Defense),
![Page 28: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/28.jpg)
28
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
•Security handling used for military purposes (remember ARPANET was funded by US Defense), •record route (each router on the way adds its address),
![Page 29: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/29.jpg)
29
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
•Security handling used for military purposes (remember ARPANET was funded by US Defense), •record route (each router on the way adds its address), •time stamp (each router on the way adds its address and time stamp),
![Page 30: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/30.jpg)
30
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
•Security handling used for military purposes (remember ARPANET was funded by US Defense), •record route (each router on the way adds its address), •time stamp (each router on the way adds its address and time stamp), •loose source routing, strict source routing.
![Page 31: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/31.jpg)
31
IP Header Checksum
Version HLen TOS Length
Identification Flags Fragment Offset
TTL Protocol
Source IP Address
Destination IP Address
Options (variable) Pad (variable)
0 4 8 16 19 31
Options field always ends at a 32 bit boundary. Padding added as needed.
![Page 32: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/32.jpg)
32
An IPv4 packet has arrived with the first 8 bits as shown:01000010
The receiver discards the packet. Why?
SolutionThere is an error in this packet. The 4 leftmost bits (0100) show the version, which is correct. The next 4 bits (0010) show an invalid header length (2 × 4 = 8). The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.
Example
![Page 33: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/33.jpg)
33
In an IPv4 packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet?
SolutionThe HLEN value is 8, which means the total number of bytes in the header is 8 × 4, or 32 bytes. The first 20 bytes are the base header, the next 12 bytes are the options.
Example
![Page 34: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/34.jpg)
34
Maximum transfer unit (MTU)
MTUs for some networks
![Page 35: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/35.jpg)
35
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte
datagram MTU = 1500 bytes
1480 bytes in data field
offset =1480/8
![Page 36: 1 Computer Communication & Networks Lecture 19 Network Layer: IP and Address Mapping Waleed Ejaz](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c02b1a28abf838cd8d1c/html5/thumbnails/36.jpg)
36
Example: Fragmenting a Packet A packet is to be forwarded to a network with MTU of 576
bytes. The packet has an IP header of 20 bytes and a data part of 1484 bytes. and of each fragment.
Maximum data length per fragment = 576 - 20 = 556 bytes. We set maximum data length to 552 bytes to get multiple of 8.
Total Length
Id MF Fragment Offset
Original packet 1504 x 0 0
Fragment 1 572 x 1 0
Fragment 2 572 x 1 69
Fragment 3 400 x 0 138