22
1 Prof. Shervin Shirmohammadi CEG 4185 2-1 Lecture 2: Internet Protocol (IP) Prof. Shervin Shirmohammadi SITE, University of Ottawa Prof. Shervin Shirmohammadi CEG 4185 2-2 Network Layer Provides the upper layers with independence from the data transmission and physical networking technologies. Responsible for sending data from source to destination. This includes the nodes in between (and therefore it is not end-to-end) Responsible for requesting network facilities, such as priority, bit-rate, etc… Responsible for routing.

Lecture 2: Internet Protocol (IP) - University of Ottawashervin/courses/ceg4185/lectures/Lecture02.pdf · 1 Prof. Shervin Shirmohammadi CEG 4185 2-1 Lecture 2: Internet Protocol (IP)

Embed Size (px)

Citation preview

1

Prof. Shervin Shirmohammadi CEG 4185 2-1

Lecture 2:

Internet Protocol (IP)

Prof. Shervin Shirmohammadi

SITE, University of Ottawa

Prof. Shervin Shirmohammadi CEG 4185 2-2

Network Layer• Provides the upper layers with

independence from the data

transmission and physical

networking technologies.

• Responsible for sending data

from source to destination.

– This includes the nodes in between

(and therefore it is not end-to-end)

• Responsible for requesting

network facilities, such as

priority, bit-rate, etc…

• Responsible for routing.

2

Prof. Shervin Shirmohammadi CEG 4185 2-3

Internetworking

Prof. Shervin Shirmohammadi CEG 4185 2-4

Routing• Autonomous System(AS): set of networks and routers operated by a single organization.

• Interior Router Protocol (IRP):passing routing information within and AS.

• Exterior Router Protocol (ERP):passing routing information

between different ASs.

3

Prof. Shervin Shirmohammadi CEG 4185 2-5

Routing Approaches

• Distance Vector Routing: each node exchanges information with its neighboring nodes; e.g. Routing Information Protocol (RIP).

• Link-state Routing: sends link costs of each of its network interfaces to all routers (not just neighboring). Typically used with a Dijkstera-based algorithm; e.g., Open Shortest Path First (OSPF).

• Path-vector Routing: router provides information about which networks can be reached by a given router and the ASs that must be crossed; e.g. Border Gateway Protocol (BGP).

Prof. Shervin Shirmohammadi CEG 4185 2-6

TCP/IP Protocol Suite vs. OSI

4

Prof. Shervin Shirmohammadi CEG 4185 2-7

OSI Pros and Cons

– Bad timing (too much detailed concept before actual applications)• Similar to ITU-T standards, it tries to design the

perfect world, which is either extremely difficult or not possible.

• Keep in mind: technology and human understanding of how things work (or should work) changes.

– Bad implementations/technology (mostly difficult to implement)

– Bad politics

– Advantages?

Prof. Shervin Shirmohammadi CEG 4185 2-8

TCP/IP Pros and Cons

– Service, interface, and protocol not distinguished.

– Not a general model.

– Host-to-network “layer” not really a layer.

– Advantages:• The Internet and its architecture have grown in

evolutionary fashion from modest beginnings, rather than from a Grand Plan.

• Others? “ Everything should be

made as simple as

possible, but not simpler.”

Albert Einstein

5

Prof. Shervin Shirmohammadi CEG 4185 2-9

Internet Architecture

• In a TCP/IP internet, IP routers provide interconnection among

physical networks.

• Computers/equipment that interconnect two or more networks

and pass packets from one to the other are called internet router.

user’s

view

the

inside

Prof. Shervin Shirmohammadi CEG 4185 2-10

Internet Protocol (IP)

• The most-widely used Internetworking

protocol.

• Purpose: to connect all networks together;

hence and internetworking protocol.

• IPv4 the most commonly used version

(covered in this course).

6

Prof. Shervin Shirmohammadi CEG 4185 2-11

Internetworking Requirements

• Design requirements: accommodate differences in constituting networks:

1. Different addressing schemes

2. Different maximum packet size

3. Different network access mechanism

4. Different timeouts

5. Different transmission modes (connection-oriented, connectionless)

6. Error control

7. Flow control

Prof. Shervin Shirmohammadi CEG 4185 2-12

IP Header

7

Prof. Shervin Shirmohammadi CEG 4185 2-13

1. Different Addressing Scheme

• Introduce IP address as a global address

• All hosts on the Internet must have a unique

IP address

– Exception: techniques such as IP-forwarding

allow private IP addresses that might be

duplicated somewhere else.

Prof. Shervin Shirmohammadi CEG 4185 2-14

IP Address Classes

8

Prof. Shervin Shirmohammadi CEG 4185 2-15

Address Range

Prof. Shervin Shirmohammadi CEG 4185 2-16

IP Addresses - Class A

• 32 bit global internet address

• Network part and host part

• Class A

– Start with binary 0

– All 0 reserved (0.x.x.x)

– 01111111 (127) reserved for loopback (127.x.x.x)

– Range 1.x.x.x to 126.x.x.x

• All allocated!

9

Prof. Shervin Shirmohammadi CEG 4185 2-17

IP Addresses - Class B

• Start 10

• Range 128.x.x.x to 191.x.x.x

• Second Octet also included in network

address

• 214 = 16,384 class B addresses (network part)

• All allocated!

Prof. Shervin Shirmohammadi CEG 4185 2-18

IP Addresses - Class C

• Start 110

• Range 192.x.x.x to 223.x.x.x

• Second and third octet also part of network address

• 221 = 2,097,152 addresses (network part)

• Only 28 = 256 hosts per network!

• Nearly all allocated

10

Prof. Shervin Shirmohammadi CEG 4185 2-19

Example of IP addresses

Prof. Shervin Shirmohammadi CEG 4185 2-20

Subnets and Subnet Masks• Allow arbitrary complexity of internetworked LANs within

organization.

• Insulate overall internet from growth of network numbers

and routing complexity.

• To rest of internet, site looks like single network.

11

Prof. Shervin Shirmohammadi CEG 4185 2-21

Subnets and Subnet Masks

• Each LAN is assigned subnet number.

• Host portion of address partitioned further into subnet

number and host number.

• Local routers route within subnetted network.

• Subnet mask indicates which bits are subnet number and

which are host number by doing a bitwise AND.

Prof. Shervin Shirmohammadi CEG 4185 2-22

Routing Using Subnets

12

Prof. Shervin Shirmohammadi CEG 4185 2-23

2. Different Maximum Size

• Problem: different networks have different

Maximum Transmission Unit (MTU) sizes. What

if a packet reaches a network and it exceeds the

network’s MTU?

• Solution:

– Use fragmentation to split large packets into smaller

ones.

– Use reassembly at the destination only to put the

fragments together and build the original packet.

Prof. Shervin Shirmohammadi CEG 4185 2-24

IP Fragmentation• IP re-assembles at destination only!

• Uses fields in header

– Data Unit Identifier (ID)• Identifies end system originated datagram

– Source and destination address

– Protocol layer generating data (e.g. TCP)

– Identification supplied by that layer

– Data length• Length of user data in octets

– Offset• Position of fragment of user data in original datagram

• In multiples of 64 bits (8 octets)

– More flag• Indicates that this is not the last fragment

13

Prof. Shervin Shirmohammadi CEG 4185 2-25

Fragmentation Example

Prof. Shervin Shirmohammadi CEG 4185 2-26

Dealing with Failure

• Re-assembly may fail if some fragments

get lost

• Re-assembly time out

– Assigned to first fragment to arrive

– If timeout expires before all fragments

arrive, discard partial data

14

Prof. Shervin Shirmohammadi CEG 4185 2-27

3. Different Network Access

• Solved by abstracting networking functions

in the Networking layer, and relying on

Data Link Layer for networking access.

• Routers handle the difference in network

access mechanism.

Prof. Shervin Shirmohammadi CEG 4185 2-28

IP Router Operation

15

Prof. Shervin Shirmohammadi CEG 4185 2-29

Address Mapping

• Sometimes, in order to reach a destination,

there is no need to go trough an IP router.

– E.g.?

• In that case, the physical address can be

used directly.

Prof. Shervin Shirmohammadi CEG 4185 2-30

ARP (Address Resolution Protocol)

16

Prof. Shervin Shirmohammadi CEG 4185 2-31

Reverse ARP

Prof. Shervin Shirmohammadi CEG 4185 2-32

4. Different Timeout

• Problem: different networks use different timeout

mechanisms.

• Solution: Introduce the concept of Datagram Lifetime.

• Datagrams could loop indefinitely

– Consumes resources

– Transport protocol may need upper bound on datagram life

• Datagram marked with lifetime

– Time To Live (TTL) field in IP

– Once lifetime expires, datagram discarded (not forwarded)

– Hop count

• Decrement time to live on passing through each router

17

Prof. Shervin Shirmohammadi CEG 4185 2-33

5. Different Transmission Modes

• Use a connectionless architecture

• Advantages

– Flexibility

– Robust

– No unnecessary overhead

• Disadvantages

– Not guaranteed delivery

– Not guaranteed order of delivery

– Reliability is responsibility of upper layers (e.g. TCP)

Prof. Shervin Shirmohammadi CEG 4185 2-34

6. Error Control

• Minimal error control, done only for the header

• Router should attempt to inform source if

packet discarded (using ICMP)

– e.g. for time to live expiring

• Not guaranteed delivery

• May inform high layer protocol

18

Prof. Shervin Shirmohammadi CEG 4185 2-35

7. Flow Control

• Allows routers and/or stations to limit rate of

incoming data

• Limited in connectionless systems

• Send flow control packets

– Requesting reduced flow

• e.g. ICMP

Prof. Shervin Shirmohammadi CEG 4185 2-36

IP Header

19

Prof. Shervin Shirmohammadi CEG 4185 2-37

Header Fields• Version (4 bits): currently 4

• Internet Header Length (4 bits)

– Minimum is 5, for 20 octets

– Header may include options and padding

• Type of Service (8 bits)

– rarely used, for differentiated services and congestion notification

• Total Length (16 bits) of datagram, in octets (header & data)

• Identification (16 bits)

– Sequence number

– Used with addresses and user protocol to identify datagram uniquely

• Flags (3 bits)

– Only 2 used; More bit, and Don’t Fragment bit

Prof. Shervin Shirmohammadi CEG 4185 2-38

Header Fields (…)

• Fragmentation offset ( 13 bits)

• Time to Live (8 bits)

• Protocol (8 bits)

– Next higher layer to receive data field at destination

• Header Checksum (16 bits)

– Re-verified and recomputed at each router

– 16 bit ones complement sum of all 16 bit words in header

• Source Address (32 bits)

• Destination Address (32 bits)

• Options (Security, timestamp, …)

• Padding, to fill to multiple of 32 bits long

20

Prof. Shervin Shirmohammadi CEG 4185 2-39

Data Field

• Carries upper-layer data.

• Integer multiple of 8 bits long (octet).

• Max length of datagram (header plus data)

is 65,535 octets.

Prof. Shervin Shirmohammadi CEG 4185 2-40

Internet Control Message Protocol

• Defined in RFC 792.

• Used for sending control messages between entities:

– end-hosts

– interim nodes

• No data is sent, only control messages (similar to signaling in POTS).

• Sent directly on top of IP.

• Has over 40 different messages

21

Prof. Shervin Shirmohammadi CEG 4185 2-41

Common ICMP Messages

Full list

Prof. Shervin Shirmohammadi CEG 4185 2-42

ICMP example: ping• ping is a utility to check whether a given node is alive

or not, and what the distance to it is.

• Named after the sound that a sonar makes.

• Uses timed ECHO_REQUEST and ECHO_REPLY

packets to probe the "distance" to the target machine.

22

Prof. Shervin Shirmohammadi CEG 4185 2-43

ICMP example: tracert• tracert is a utility to trace the route between two nodes on the

network. You can think of it as a set of ping commands, each with TTL set to 1 hop larger than the previous one.

• Starts by sending an ICMP Echo request message with destination’s IP address with TTL set to 1. The first node receiving the packet decrements the TTL and discards the message, sending an ICMP "TTL exceeded“ message to the sender. Receipt of this message allows the sender to identify which system is one link away.

• The sender repeats the above with TTL=2, 3, and so on, until it reaches the target destination. This gives a topological view ofthe network route from the sender to the destination.

• Things to consider:– Where alternate paths are possible, results may vary.

– Some Routers are configured to discard ICMP messages, while others process them but do not answer. Such routers hide the path of the network.