CSE3213 17 NetLayer IP F2010
CSE3213 17 NetLayer IP F2010
CSE3213 17 NetLayer IP F2010
1. 2. 3. 4. 5.
Introduction Router Architecture Network Layer Protocols in the Internet IPv4 IP Addressing and Subnetting
Introduction
Network Layer supervises host-to-host packet delivery hosts
could be separated by several physical networks
data-link layer provides node-to-node delivery, transport
network
Introduction (cont.)
Example [ network layer duties in the Internet, at the SOURCE ]
find interface from which packet must be sent
encapsulate packet from upper layer, i.e. add header: 1) add universal source and destination address; 2) add fields for error control, etc.
verify whether destination address is host address if so, routing is not needed
make sure packet is of correct size for datalink layer, i.e. protocol
Introduction (cont.)
Example cont. [ network layer duties in the Internet, at a ROUTER ]
check if packet has reached its final destination or needs to be forwarded (TTL!) + header error checking !!!
Introduction (cont.)
Example cont. [ network layer duties in the Internet, at the DESTINATION ]
if packet has been fragmented, wait until all fragments have arrived, reassemble them, and then deliver the reassembled packet to transport layer
1. 2. 3. 4. 5.
Introduction Router Architecture Network Layer Protocols in the Internet IPv4 IP Addressing and Subnetting
Router Architecture
input ports / interfaces (see pp. 10) interconnection (switching) fabric (see pp. 11) output ports / interfaces (see pp. 12) routing processor (switch controller) general-purpose processor in charge of
1) executing routing protocol 2) maintaining routing information and forwarding tables, etc.
(cont.)
10
physical layer: bit-level reception data-link layer: decapsulation, error checking, etc. network layer: decentralized switching / packet forwarding = decide to which output line to forward each packet based on packet header
looks up output port using forwarding table in
input line card memory (table is created and updated by routing processor)
Decentralized switching prevents creating a processing bottleneck Decentralized switching prevents creating a processing bottleneck at a single point within the router. at a single point within the router.
11
input port, stored in memory, then send to appropriate output port slow
via a bus: datagram is sent directly from bus
input port to output port via a shared bus does not scale well
(packets are send serially so buss speed needs to be N-times input line speed)
12
network layer: 1) buffering required when datagrams arrive from fabric at rate faster than output line transmission rate 2) buffer management decide when and which packets to drop if there is not enough memory to store all incoming packets 3) scheduling / packet classification decide which packet, of those queued, to send out next
packet scheduling plays crucial role in
data-link layer: encapsulation, address mapping, etc. physical layer: bit-level forwarding
13
1. 2. 3. 4. 5.
Introduction Router Architecture Network Layer Protocols in the Internet IPv4 IP Addressing and Subnetting
14
IP main protocol, responsible for best effort host-to-host delivery ARP maps IP address of next hop to its MAC/physical address (used when passing packets to lower data-link layer) RARP maps MAC/physical address to IP address (used at diskless machines for IP address recovery) ICMP used by hosts and routers to handle unusual situations such as IP packet-header errors, unreachable hosts and networks, etc. IGMP used by host and routers to achieve efficient network-layer multicasting Routing Protocols responsible for routing table maintenance
15
Network layer
forwarding table
16
1. 2. 3. 4. 5.
Introduction Router Architecture Network Layer Protocols in the Internet IPv4 IP Addressing and Subnetting
IP Protocol
Internet Protocol (IP) host-to-host network-layer delivery protocol
for the Internet with following properties
connectionless service each packet is handled
17
IP Protocol Versions
IPv4 version currently in wide use (1981) IPv6 new version of IP protocol created to correct
IP Datagram Fields
18
routing and delivery data length determined by Maximum Transmission Unit (MTU) of link layer protocol (theoretically between 20 to 65536 bytes)
19
4-bit field specifies IP protocol version of the datagram (IPv4 or IPv6) different version of IP use different datagram formats by looking at version number router can determine how to interpret remainder of datagram
Header Length
in 4-byte words
when there are no options header length is 20 HLEN = 5
Differentiated Service 8-bit field allows different types of datagrams to be distinguished from each other (formerly Service Type)
based on their associated / requested QoS
high throughput, or reliability
Although each TOS bit has a special meaning, only one bit can be set to 1 in each datagram. 0000 normal type of service 0001 minimize cost 0010 maximize reliability 0100 maximize throughput 1000 minimize delay
20
including header
16 bits maximum size = 65,535 bytes some physical networks are not able to encapsulate a datagram
of 65,535 bytes, so datagram must be fragmented to be able to pass through those networks
some physical networks have restriction on minimum size of
data that can be encapsulated in a frame, so datagram must be padded (e.g. Ethernet min size of data 46 bytes)
IP packet
3 fields used in fragmentation Identifier, Flags, Fragmentation Offset IPv6 does not allow fragmentation at routers
since it is time consuming operation if an IPv6 packet is too big, it is simply dropped and an ICMP message is sent back to the source
21
1) datagram does not circulate/loop forever, or 2) to limit its journey (e.g. LAN only: TTL = 1)
Protocol
while port number is glue that binds transport & application layer
values: 1 ICMP, 2 IGMP, 6 TCP, 17 UDP, 89 OSPF
22
1) divide header into 16-bit (2-byte) sections checksum field itself is set to 0 2) sum all sections using 1s complement arithmetic
Each intermediate router must: 1) verify / recompute checksum on every incoming packet 2) compute checksum for every outgoing packet
Error detection / correction is not the responsibility of network-layer. Why is, then, IP willing to perform error detection on IP headers?!
23
Options
options type / code total length of options fields (including the first three bytes) in bytes options fields occupied so far; i.e. byte number of first empty, or to be used, entry
options header
R1 R2
R3
24
(c) Strict Source Route option used by source to predetermine route for datagram
source provides a list of IP addresses (sequence of routers) that datagram must (is allowed) to visit on its way to destination
(d) Loose Source Route option similar to (c), but it is more relaxed each router in the list must be visited, though datagram can visit other routers as well
25
IP Datagram Fragmentation
26
Maximum Transfer Unit maximum amount of data that link-layer frame can carry = hard limit on IP datagram (MTU)
length
MTU differs from one data-link layer protocol
to another
(a) Token Ring (4 Mbps): MTU = 4,464 bytes (b) Ethernet: MTU = 1,500 bytes (c) PPP: MTU = 296 bytes
Hard limit on IP datagram size is not a problem. Hard limit on IP datagram size is not a problem. What is a problem is that each of the links along the route between sender What is a problem is that each of the links along the route between sender and receiver can use different link-layer protocols, and receiver can use different link-layer protocols, and each of these protocols can have different MTUs. and each of these protocols can have different MTUs.
27
reassembly
host or any other router in the path; however reassembly of datagram is done only by destination host! parts of a fragmented datagram may take different routes !!!
once fragmented datagram may be further
fragment gets its own header with most fields repeated, but some changed
host or router that fragments datagram must change values of three fields: flags, fragmentation offset and total length
28
29
fragments
identification number helps destination in reassembling datagram
all fragments with same identification value should be assembled into one datagram
Flags
3-bit field
1st bit is reserved 2nd bit is called do not fragment bit fragment if its value is 1, machine must NOT fragment datagram if fragment cannot pass through physical network router discards packet and sends ICMP error message back to source host 3rd bit is called more fragment bit fragment if its value is 1, datagram is not last fragment there are more fragments after this one if its value is 0, this is last or only fragment
30
divisible by 8
Example [ fragmentation ]
Example 4000 byte datagram MTU = 1500 bytes length ID fragflag offset =4000 =x =000 =0 =0 One large datagram becomes several smaller datagrams length ID fragflag offset =1500 =x =001 =1 =0 length ID fragflag offset =1500 =x =001 =185 =1 length ID fragflag offset =1040 =x =000 =370 =0
data
31
IP Datagram Processing
Header-adding module encapsulates the data from the transport-layer protocol by adding the IP header Processing module 1) checks if destination IP address = host IP address 2) decrements TTL by 1 (done only at router-nodes) Reassembly module orders and reassembles the fragments belonging to the same datagram. Reassembly table keeps track of received fragments Routing module finds the IP address of the next station along with the interface number to which the packet should be sent. Fragmentation module consults MTU table to find the MUT for the specific interface number.
32
Exercise
1. A packet has arrived with Flags M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented? 2. A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented? 3. A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment? 4. A packet has arrived in which the offset value is 100. What is the number of the first byte? Do we know the number of the last byte? 5. A packet has arrived in which the offset value is 100, the value of HLEN is 5 and the value of the total length field is 100. What is the number of the first byte and the last byte?
33