chapter 4 network layer departamento de tecnología electrónica computer networking some of these...

84
Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer Networking: A Top Down Approach , 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009.

Upload: harry-ward

Post on 25-Dec-2015

221 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Chapter 4Network layer

Departamento deTecnología Electrónica

Computer Networking Some of these slides are given as material with copyright from: Computer Networking: A Top Down Approach ,5th edition. Jim Kurose, Keith RossAddison-Wesley, April 2009.

Page 2: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-2

Chapter 4: Network LayerOur goals: understand principles behind Network Layer services:

Network Layer service models forwarding versus routing inside the router

Example: implementation on the Internet

Page 3: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-3

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP IP functioning

Page 4: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-4

Network Layer transport segment (T_PDUs)

from sending to receiving host

The sending side encapsulates T_PDUs into datagrams (N_PDU)

The receiving side delivers T_PDUs to transport layer

Network Layer protocols in every host, including routers

router examines header fields (N_PCI) in all the IP datagrams (N_PDU), that pass through it

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

networkdata linkphysical network

data linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

Page 5: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-5

Network Layer All layers from application to network are

implemented in software. Data Link and Physical are implemented in

hardware, known as network interface card or NIC.

Each interface implements a particular Data Link and Physical protocol, known as link technology, network technology or just technology.

Each interface has associated a link address, known as physical address or MAC address with 48 bits that identifies it. For example, 00:BF:3C:23:45:30

Application

Transport

Network

Data Link

PhysicalHardware

Software

NIC

More about physical addresses in the data link layer…

Page 6: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-6

Network Layer In general, end systems usually use only one network

interface, although may have several ones (e.g., ethernet and Wi-Fi).

Routers have several network interfaces. Each one is connected to other routers or end systems.

applicationtransportnetwork

linkphysical

network

link link link

physical physical physical

Page 7: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

link link link

physical physical physical

Network Layer 4-7

Network Layer Data Link Layer, through network interface, offers to Network

Layer a service of N_PDUs deliver between routers or end systems connected by physical media and devices that implements up to Data Link Layer.

Routers and end systems connected in this way are in the same broadcast domain.

applicationtransportnetwork

linkphysical

network

link link link

physical physical physical

applicationTransportnetwork

Linkphysical

Page 8: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-8

Addressing

Addressing enables identifying the devices that are connected to a network in a unique way.

This identification is known as layer 3 address or IP address in the TCP/IP architecture.

Every device having a network layer (end systems, routers…) has a layer 3 address.

Hierarchical addressing schemes are used. (Network.Host) Part of the N_PCI is used to identify the network - subnet - (Network

part) It is the same for all the devices inside the same network.

The other part of the N_PCI identify the device, inside the network – subnet -. (Host) Usually called host part.

Page 9: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-9

Two Key Network-Layer Functions

forwarding: move packets (N_PDUs) from the router’s input to the appropriate router output

routing: determine route taken by packets (N_PDUs) from source to dest.

routing algorithms

analogy:

routing: process of planning trip from source to dest

forwarding: process of getting through a crossroad.

Page 10: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-10

1

23

0111

value in arrivingpacket’s header (N_PCI)

routing algorithm

routing tableN_PCI output link

0100010101111001

3221

Interaction between routing and forwarding

More about routing table soon...

Q: Which interface will it be forwarded for?

Page 11: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-11

Connection setup

3rd important function in some network architectures: ATM, frame relay, X.25

before interchanging N_PDUs, two end hosts and the several routers establish a virtual connection, known as virtual circuit (VC) routers get involved (allocating resources)

network vs transport layer connection service: network: between two transport entities and network

layer of hosts and routers in the path are involved transport: between two application processes

Page 12: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-12

Network service model

Q: What service model for “channel” transporting T_PDUs from sender to receiver?

Example: services for individual T_PDUs:

guaranteed delivery guaranteed delivery with

less than 40 msec delay

Example: services for a flow of T_PDUs:

in-order T_PDU delivery guaranteed minimum

bandwidth to flow restrictions on changes in

inter-T_PDU spacing

Page 13: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-13

Network Layer service models

NetworkArchitecture

Internet

ATM

ATM

ServiceModel

best effort

CBR

ABR

Bandwidth

none

constantrateguaranteedMinimum

Loss

no

yes

No

Order

no

yes

Yes

Timing

no

yes

No

Congestionfeedback

no (inferredvia loss)nocongestionyes

Guarantees ?

CBR: Constant bit rateABR: Available bit rate

Page 14: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-14

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 15: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-15

Network Layer connection and connection-less service datagram network (packet switching) provides

network-layer connectionless service VC network (circuit switching) provides network-

layer connection service analogous to the transport-layer services, but:

service: host-to-host no choice: network provides only one type of service implementation: in hosts and in network core

Page 16: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-16

Virtual circuits

There are three phases: call setup N_PDUs flow Call ending

each N_PDU carries VC identifier inside N_PCI (not destination host address) every router on source-dest path maintains “state” for each passing connection link, router resources (bandwidth, buffers) may be allocated to VC (dedicated

resources = predictable service)

“source-to-dest path behaves much like telephone circuit” performance-wise network actions along source-to-dest path

Page 17: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-17

VC implementationa VC consists of:

1. path from source to destination2. VC numbers, one number for each link along path3. entries in forwarding tables in routers along path that indicates

the path and the VC number to use in every case. N_PDUs belonging to VC carries VC number (rather than

dest address) VC number can be changed on each link.

12 22 32

1 23

VC number

interfacenumber

Page 18: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-18

Virtual circuits: signaling protocols

used to setup, maintain and close VC used in ATM, frame-relay, X.25 not used in today’s Internet

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Initiate call 2. incoming call3. Accept call4. Call connected

5. Data flow begins 6. Receive data

Page 19: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-19

Datagram networks no call setup at Network Layer routers: no state about end-to-end connections

no network-level concept of “connection” N_PDUs forwarded using destination host address

N_PDUs between same source-dest pair may take different paths

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send N_PDU 2. Receive N_PDU

Page 20: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-20

Datagram or VC network: why?Internet (datagram) data exchange among computers

“elastic” service, no strict timing req.

“smart” end systems (computers) can adapt, perform control,

error recovery simple inside network,

complexity at “edge” many link types

different characteristics uniform service difficult

ATM (VC) evolved from telephony human conversation:

strict timing, reliability requirements

need for guaranteed service

“dumb” end systems telephones complexity inside network

Page 21: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-21

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 22: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Router interfaces Technology used in each interface in the same

router is independent. Por example, the edge router in a domestic network

usually has an Ethernet/WI-FI interface and an ADSL interface.

Router interfaces are identified by A letter depending on the technology and

• E.g.: E:Ethernet 10 Mbps, Fa:Fast Ethernet, Gi:Gigabit Ethernet, To: Token Ring, Se:Serial…

A number to distinguish interfaces with the same technology

• E.g.: E0, E1, Fa0, Fa1, Se0..

E0

E1

Se0

Network Layer 4-22

Page 23: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Router and Logic Networks (I) End systems or other routers may be connected to any

interface of a router. It is necessary to use the appropiate transmission media. It is possible to use other devices that implements up to Data Link

Layer. For example, switches, access points or hubs. All of them are in the same broadcast domain, that is, they process all

frames (L_PDUs) that have a physical destination address (or multicast) inside the L_PCI.

In general, they all belong to the same logic network.• They share the same network identifier in the IP address.

Network Layer 4-23

1.- A broadcast physical address is for identifing a group of network interfaces.2.- IP addresses are hierarchical. The bits that make them up have two parts: one identifies the logical network (network identifier); and the other one identifies the end system or the router. (host identifier) In general, we can say that IP address =NetworkX.HostY. More soon…

notes

Page 24: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Router and Logic Networks (II) Every interface in a router belongs to a a different logical

network. They have different IP addresses.

• The part that identifies the network will be different, e.g., Net1, Net2,… Every interface in a router is in a different broadcast

domain. A router is not a transparent device.

End systems must know some router’s IP address. • E.g., it is necessary to know which the Ethernet or WI_FI interface IP

address of the edge router. Routers must know IP addresses of routers, in order to forward

N_PDUs (directly connected routers).

Network Layer 4-24

Page 25: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Example

Net 1Net 1 Net2Net2

Physical Physical

Router

SUP.

NET.

Link

Physical

SUP.

NET.

Link

Physical

Link Link

Q. How many broadcast domains are there? Q. How many logical networks are there? What happens if we assign Net1.Host3 and Net1.Host4 the network identifier Net3? Q. If Net1.Host1 wants to send data to Net2.Host2, who is the network layer delivering the N_PDU that encapsulates this data to? Which source and destination are appearing in that N_PDU? Q. Which source IP address is carrying the N_PDU (in its N_PCI) that the end system Net2.Host2 is receiving?

Net1.Host1

Net2.Host1

Net2.Host2

Net1.Host2

Net1.Host3

NETWORK

Net1.Host4

Net2.Host3 Net2.HostN

Network Layer 4-25

Net1.Host5

Net1.HostN

P0 P1

Page 26: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table (I) The two key functions of the network layer use a routing

table (RT). Routing : in order to modify its content. Forwarding : in order to know which is the target interface to

forward a N_PDU to get to its destination. End systems and routers have a routing table. In the forwarding process, RT entries are used to know

the next hop in the path. RT entries are used to know the path to follow in the

forwarding process. At least, the following info appears:

Network Layer 4-26

Network Next hop Interface

Network identifier 3-layer address of the next hop router Output network interface

Page 27: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table (II) Q. How RT entries are filled?

A1. Automatically• When assigning an IP address to a network layer device, an entry is added for the

logical network to where the device belongs. A2. Manually

• By using management commands , it is possible to fill reachable networks in the RT. A3. Dinamically

• By the use of routing protocols. They implement some algorithms that set the best path towards a particular logical network.

• It is specific for routers.• Typical Internet routing protocols:

– RIP– OSPF– BGP

Besides, in the RT, a special entry is usually included: it is known as default route. The default route is used in case there isn’t any specific entry for a particular logical network. A reserved network identifier is used.

Network Layer 4-27

Page 28: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table use When the Network Layer has a N_PDU to send, the only

necessary information in the N_PCI to guess next hop is the destination IP address.

The Network Layer looks for a matching entry in the RT. The Network identifier for the destination network must be the same as the Network identifier in the RT. In case there is an entry in the RT, the router delivers the

N_PDU (without modifying source and destination IP in the N_PCI) to the next hop through the indicated interface.

• If destination is in the same network, known as directly connected, router delivers the N_PDU through the indicated interface.

If not, router discards N_PDU.• That network is not reachable by the Network Layer.

Network Layer 4-28

Page 29: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table example

NET 2NET 2

Net1.Host1

Net2.Host1

Net2.Host2

Net1.Host2

Net1.Host3

Net2.Host3 Net2.HostN

Network Layer 4-29

…Net1.HostN

E0 E1

RT Router 1

Network Next hop Interface

RT Host Net1.Host1

Network Next hop Interface

NET 1NET 1Router 1¿?

E2

NET 3NET 3

Net3.Host1 Net3.HostN-1

Net3.HostN

¿?

Router 2

E2

E0

E1

Page 30: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table functioning

Every device implementing a network layer takes its own decisions, based on the information kept in its routing table.

Not all the network devices have the same information in their routing tables.

The Routing information about a route does not provide routing information about the return route.

Network Layer 4-30

Page 31: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Example

NET 2NET 2

Router 1Net1.Host1

Net2.Host1

Net2.Host2

Net1.Host2

Net1.Host3

Net2.Host3 Net2.HostN

Network Layer 4-31

…Net1.HostN

E0 E1

RT Router 1

Net. Next hop Interface

Net1 - E0

Net3 - E2

Net4 - E1

Net2 Net4.Host1 E1

NET 1NET 1

NET 3NET 3

Net3.Host1 Net3.HostN-1

Net3.HostN

Router 2

E2

E0 E1

Net4.Host2

Net4.Host1

RT Router 2

Net. Next hop Interface

Net4 - E0

Net2 - E1

Net3 Net4.Host2 E1

Q1. Is it possible that Net1.Host3 sends N_PDUs to Net3.Host1? and viceversa?

Q2. Is it possible that Net1.Host3 sends N_PDUs to Net2.Host2? and viceversa?

Page 32: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-32

Buffering It allows routers to store arriving N_PDUs before

processing them. It allows routers to store N_PDUs before being

transmitted by any interface. When buffering?

Heuristic rule (RFC 3439): the average space in a buffer should be equal to RTT times the interface bandwidth (R)

• e.g., assuming RTT=250msec and R = 10 Gbps, the buffer needed in the interface is 109x0,25 = 2,5 Gbit

If taking into account the average TCP flows (N) going through the interface , the following is recommended:

RTT R.N

Buffer =

Page 33: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-33

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 34: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-34

The Internet Network Layer

routingtable

IP protocol (RFC 791)•addressing conventions•Datagram (N_PDU) format•Forwarding N_PDU

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

There are several Network protocols that work in host and routers. Routing protocols are only in the routers. Not all the routing

protocols work in the Network Layer.

ARP protocol• Matching physical addr and IP addr

Routing protocols•path selection•RIP, OSPF, BGP

Page 35: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-35

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 36: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-36

IP datagram format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifier

header checksum

time tolive

32 bit source IP address

IP protocol versionnumber

IP Header Length (IP_PCI) in 32 bits words

(4 bytes)

max numberremaining hops

(decremented at each router) (1 byte)

forfragmentation/reassembly

total datagram (IP_PDU)length (bytes)

Multiplexion/Demultiplexion

IHL type ofservice

“type” of N_UD flgs fragment offset

protocol

32 bit destination IP address

Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.

how much overhead (PCI) with TCP?

20 bytes of TCP 20 bytes of IP = 40 bytes + app

layer overhead (A_PCI)

how much overhead (PCI) with TCP?

20 bytes of TCP 20 bytes of IP = 40 bytes + app

layer overhead (A_PCI)

IP_PCI

IP_UD

Page 37: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-37

IPv4 Fragmentation & Reassembly (I) network links have a MTU (Maximum

Transfer Unit) - largest possible link-level frame (L_SDU or N_PDU). different link technology types,

different MTUs If IP_PDU size > transmitting interface

MTU, large IP_PDU divided (“fragmented”) within network one IP_PDU becomes several

IP_PDUs with appropriate size (< original IP_PDU)

“reassembled” only at final destination (destination Network Layer) IP header bits used to identify,

and order related fragments

fragmentation: in: one large IP_PDUout: 3 smaller IP_DPUs

reassembly

Page 38: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-38

IPv4 Fragmentation & Reassembly (II)

IP_PCI is used for fragmentation: identifier, flags and fragment offset. IP_PCI flags field has three bits, “0DfMf“, where:

• Df (Don´t fragment): if set to 1, indicates that fragmentation is not allowed.

• Mf (More fragments): if set to 1, indicates there are more fragments. There are no more fragments (or there was no fragmentation) if it is set to 0.

Identifier is used for labelling an IP_PDU and distinguishing it from the rest. All the fragments of a IP_PDU have the same identifier.

Segment offset is used to knowing the fragment order (measured in bytes)

Page 39: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-39

How fragmentation works When the Network Layer fragments:

It Checks bit Mf:• If it was set to 0, it must set it to 1 in all the fragments but the last one, which

is set to 0.• otherwise, all fragments have bit MF set to 1.

Fragment offset indicates the relative position of the fragment IP_UD (measured in 8 bytes blocks). It is zero for the first fragment only. The reason for using 8 byte blocks is that the field is 13 bits width and IP_PDUs are up to 216 bytes length.

The number of bytes of IP_UD for all the fragments (but the last one) must be a multiple of 8.

• The maximum number of bytes of the IP_UD is: (MTU – length in bytes of the IP_PCI).

– If (MTU – length in bytes of the IP_PCI) is not a multiple of 8, some link capability is wasted.

Page 40: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-40

How reassembly works If destination Network Layer receives an IP_PDU with the

bit MF set to 1, it knows that the IP_UD is not complete (it has received a fragment). The Network layer has to wait until receiving all the IP_PDUs with the same identifier Network Layer knows that it is finished when there is not any

gap between the segment offset of the received IP_PDUs (fragments).

Reassembly consists of ordering IP_PDUs by segment offset. IP_UD of each fragment is taken, put in order (indicated

by fragment offset) and delivered in a IP_SDU to the upper layer when it is reassembled.

Page 41: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Example

MTU 3000 bytes

MTU 3000 bytes

MTU1500 bytes

MTU1500 bytes

IDENTIFIER= 111

IHL= 5

LENGTH= 2020

FLAG = 0, DF=0, MF=0

Offset = 0

TTL= 5

Protocol = 1

IDENTIFIER= 111

IHL= 5

LENGTH= 1500

FLAG = 0, DF=0, MF=1

Offset = 0

TTL= 4

Protocol = 1

IDENTIFIER= 111

IHL= 5

LENGTH= 540

FLAG = 0, DF=0, MF=0

Offset = 185

TTL= 4

Protocol = 1Network Layer 4-41

Page 42: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-42

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 43: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

IPv4 addressing Known as IP address or IPv4 address

32 bits (4 bytes) with a hierarchical addressing scheme:

Number of bits for network id and for host depends on the addressing scheme.

Notation in a IPv4 address: 32 bits address

11001000001010001000000000100000 Grouped in bytes

11001000 00101000 10000000 00100000 Each byte in decimal and separated by a dot.

200.40.128.32 Manual or dynamic setup

End systems has to set its IP address and the gateway IP address. Routers have an IP address for every interface.

Network ID (NET) Host

Network Layer 4-43

Page 44: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Types of IPv4 addresses Three types of IPv4 addresses:

Unicast: For sending IP_PDUs to a single destination. All routers and end systems must have assigned at least one

IP address of this type. Broadcast: For sending IP_PDUs to all devices (hosts

and routers) in the same logical network. Every logical network has an IP address of this type.

Multicast: For sending IP_PDUs to a group of devices (hosts and routers) in the same or different logical network. All devices of the same group must have the same address

of this type.

Network Layer 4-44

Page 45: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

127 Any digitLoopback address Used to check the network layer in a device.

Network All 0sNetwork address Identifier for the logic network

(used by RT)

Network All 1sDirectedIdentifies all devices in a network.

All 1sLimited Identifies all devices in the same network of the source

All 0sTwo meanings

This host: Used as source IP address when this host doesn’t have any (e.g. device without configuration).

Identifier for any network

(Default route in RT)

Special addresses

Network Layer 4-45

Broadcast

Page 46: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

IPv4 addressing scheme

To fix which part of the IPv4 address is used for identifying the network and which part is used for identifying the host is used: Classful addressing

Obsolete. Classless addressing

Used currently.

Network Layer 4-46

Page 47: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Classful addressing (I) It uses first byte of IP address to fix which part is for

network and which is for host. There are 5 classes:

Class A

Class B

Class C

Network Host Host Host

Network Network Host Host

Network Network Network Host

1st byte 2nd byte 3rd byte 4th byte

Class D

Unicast

Multicast

Class E Experimental

Network Layer 4-47

0 – 1260xxxxxxx

128 – 19110xxxxxx

192 – 223110xxxxx

224 - 239 1110xxxx

240 – 2541111xxxx

Page 48: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-48

Example of classful addressing

223.1.1.1

223.1.1.2

223.1.1.3 223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

Class C; last byte identifies the host, the rest of bytes identifies the network. Q. How many as maximum is it possible to identify in every logical network?

Network223.1.1.0

Network223.1.1.0

Network223.1.2.0

Network223.1.2.0

Network223.1.3.0

Network223.1.3.0

223.1.1.4 223.1.2.9

E0 E1

E2

Network identifierDirected broadcast

223.1.1.255

223.1.3.255

223.1.2.255

IP_PDU to 223.1.2.255

IP_PDU to 255.255.255.255Limited broadcast

RT Router

Network Next hop Interface

223.1.1.0 - E0

223.1.2.0 - E1

223.1.3.0 - E2

RT Host 223.1.1.3

Network Next hop Interface

223.1.1.0 - E

0.0.0.0 223.1.1.4 E

Page 49: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Classful addressing summary Network 1.0.0.0 – 126.0.0.0.- Class A.

Network 0 is not used. 0.0.0.0 is the address used if a device with network layer is not

configured. 0.0.0.0 is used for identifing any network.

It appears in the entry of the routing table that represent the default route.

Network 127 has a special use: internal communication. 27 – 2 networks with 224 -2 available addresses for devices

128.0.0.0 – 191.255.0.0.- Class B. 214 networks of 216 -2 hosts

192.0.0.0 – 223.255.255.0.- Class C. 221 networks with 28 -2 availabe addresses for devices

Network Layer 4-49

Network Next hop Interface

0.0.0.0 223.1.3.27 E0

Example of default route RT

Page 50: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Classless addressing (I)

Network Layer 4-50

Page 51: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Classless addressing (II) Prefix notation is not usually used when configuring network-layer

devices. /x is replaced by a netmask or subnet mask.

It uses the same notation as IPv4 address, where First X bits are set to 1. Last 32-X bits are set to 0.

For example, a device with host prefix 160.234.0.25/16 is configured by: IP address: 160.234.0.25 Netmask: 255.255.0.0

0.0.0.0/0 is the identifier for any network.

Network Layer 4-51

Network Next hop Interface

0.0.0.0/0 160.1.3.27 E0

Example default route RT

Network Next hop Interface

0.0.0.0 – 0.0.0.0 160.1.3.27 E0

Example default route RTPrefix notation

Netmask notation

Network idenfier - netmask

Page 52: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Classless addressing (III) This addressing scheme is known as CIDR (Classless

InterDomain Routing) (RFC 4692). It allows assigning IPv4 address blocks, depending on the

actual needs. They are known as CIDR blocks. Not many IPv4 addresses are “wasted”. Example: a company needs 2000 IPv4 addresses.

With classfull addressing, it needs a whole class B network. 216-2002 addresses are wasted.

With CIDR a network prefix X.X.X.X/21, it would be enough.

Network Layer 4-52

Page 53: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-53

Example of classless addressing

223.1.4.1/22

223.1.1.4/22

223.1.4.3/22 223.1.8.2/22

223.1.8.1/22

223.1.12.2/22223.1.12.1/22

223.1.12.27/22

Q. What is the Subnet mask to configure these devices? Q. How many network-layer devices as maximum is it possible to identify in every logical network?

Network223.1.4.0/22

Network223.1.4.0/22

Network223.1.8.0/22

Network223.1.8.0/22

Network223.1.12.0/22

Network223.1.12.0/22

223.1.4.4/22 223.1.8.9/22

E0

E2

Network identifierDirected Broadcast

223.1.7.255

223.1.15.255

223.1.11.255E1

RT Router

Network Next hop Interface

223.1.4.0/22 - E0

223.1.8.0/22 - E1

223.1.12.0/22 - E2

RT Host 223.1.3.2/22

Network Next hop Interface

223.1.12.0/22 - E

0.0.0.0/0 223.12.3.27 E

To know which is the right path to the destination IP addr, the AND logic operation between the netmask of a particular RT entry and the destination IP addr is held. If the network identifier matches the correspondent entry in the RT, that is the route to take.

note

IP_PDU to 223.1.8.2

Page 54: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Subnets It allows to address smaller logical networks from a CIDR

block, fitting to the number of IP addresses needed. Every subnet may have different number of network-layer

devices. To create subnets, some bits are “borrowed” from the bits

that identify the host, in order to identify the subnetwork. Given a network prefix with x bits to identify the network and 32-

x bits to identify the host, if n bits are borrowed, with n<32-x-1, then: 2n subnets with 232-n-x -2 available IP addresses are created. Where x+n is the number of bits that identify the network inside

every subnet.

Network Layer 4-54

Page 55: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Subnet examples Let network identifier be 200.23.16.0/23

If 1 bit is borrowed, two subnets are created:

If 1 bit is borrowed again from one of them, e.g. 200.23.16.0/24, two new subnets would be created.

So from the CIDR block 200.23.16.0/23 three subnets have been created: 200.23.16.0/25 and 200.23.16.128/25 with 27-2 available addresses and 200.23.17.0/24 with 28-2 available addresses.

Network Layer 4-55

11001000 00010111 00010000 00000000

Networkpart

Hostpart

Networkpart

Hostpart

11001000 00010111 00010000 00000000 200.23.16.0/2411001000 00010111 00010001 00000000 200.23.17.0/24

Networkpart

Hostpart

11001000 00010111 00010000 00000000 200.23.16.0/2511001000 00010111 00010000 10000000 200.23.16.128/25

Page 56: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-56

Subnets advantages

200.23.16.0/23

200.23.17.0/23

200.23.30.0/23

Fly-By-Night-ISP

Company 0

Company 7

Internet

Company 2

...

...

They allow adding routes in routing tables.When subnets are created from a CIDR block), if all those subnets are reachable by the same interface, they can be summarised by the original network prefix.

194.13.17.1/30194.13.17.2/30

E0E1

RT Internet

Network Next hop Interface

223.1.16.0/20 194.13.17.1 E0

… … …

The search in the routing table carries out by starting with entries beginning by the network prefix /32 and it ends with /0. The next hop will be the entry that has more bits in common with the destination IP addr from the IP_PDU.

note

Page 57: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-57

How CIDR blocks are assigned? Currently, there are no available blocks.

The last one was assigned in February 2011. Why have they run out?

• Mobile devices.• Non-efficient use of the available address space.• Internet user demography.

ISPs distribute among their clients the assigned CIDR blocks that they have. They do not usually assign fixed IPs any more.

If there are not any available IPv4 addresses, how are devices identified? Private addressing and NAT IPv6

• Progresive migration.

Page 58: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Private addressing In 1996, a set of addresses were reserved. They are called

private addresses (RFC 1918): They belong to a reserved IP address range to be used only in

private networks (these IP addresses must not appear in the network core of the Internet).

For example, to address a non-public Intranet, a laboratory, a domestic network.... Reserved range:

“Class” Address range CIDR identifier

A 10.0.0.0 –10.255.255.255 10.0.0.0 /8

B 172.16.0.0 – 172.31.255.255 172.16.0.0 /12

C 192.168.0.0 – 192.168.255.255 192.168.0.0 /16

Network Layer 4-58

Page 59: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Private addressing and NAT Private addresses and NAT (Network Address Translation, RFC 3022)

are used to allow a network with a private IP addresses accessing to the Internet.

NAT is usually implemented in routers.

10.0.0.1

10.0.0.2

10.0.0.3

10.0.0.4138.76.29.7

Local network(e.g., domestic network)

Rest of the

Internet

IP_PDUs with source or destination inside this network have network addresses from network 10.0.0/24 as source or destination (as always)

All outgoing IP_PDUs have the same source IP address: 138.76.29.7.

InternetInternet Network10.0.0/24

Network10.0.0/24

Network Layer 4-59

Page 60: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-60

Chapter 4. Overview

4. 1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 61: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-61

ICMP: Internet Control Message Protocol (RFC 792)

Used by end systems and routers to communicate network-layer information Error report: host unreachable,

(or network, or port, or protocol) Works over IP (network layer):

ICMP_PDUs (known as ICMP messages) are encapsulated in IP_PDUs (IP datagrams).

ICMP messages: Echo request/Reply (used by ping

command) TTL Exceeded (used by tracert

command)

Internet InternetA B

ICMP

IP

ICMP

IP

..

Echo Request

Echo Reply

193.1.23.4 195.7.3.24

Ping 195.7.3.24

Internet InternetA

BICMP

IP

ICMP

IP

..

TTL Exceeded

193.1.23.4

195.7.3.24

tracert 195.7.3.24

Echo Request

193.1.23.1

TTL=1

Page 62: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-62

Chapter 4. Overview

4.1 Introduction4.2 Virtual circuit and datagram networks4.3 Router in datagram networks4.4 IP: Internet Protocol

Datagram format IPv4 addressing Basic ICMP Functioning

Page 63: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

IPv4 operation (I) It is necessary that network-layer devices are configured

and have their routing table filled: There are two mechanisms to configure end systems:

Manually: using the operative system interface. At least IP address., subnet mask and default gateway (edge router) must

be configured IP Address for one or several DNS servers

It is not necessary to know all the IP addresses. Dynamically: using some kind of protocol, e.g. DHCP (Dynamic Host

Configuration Protocol). Configuration is carried out automatically for a period of time. It is possible

to release and renew the configuration. In routers, it is necessary to configure only IP and subnet mask

for every interface.

Network Layer 4-63

Page 64: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

IPv4 operation (II) It is necessary that network-layer devices are configured

and have their routing table filled: End systems require, as minimum, two entries (included

automatically): One for the logical network the end system belongs to (does not need

next hop). Default route, whose next hop is the edge router.

Routers require one entry for every reachable network: Introduced manually (static).

E.g: default route. Learned dynamically by a routing protocol. As minimum, table includes directly connected networks, that is, the

networks directly accessed by their interfaces (automatic).

Network Layer 4-64

Page 65: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

eBefore requesting the IP_PDU to be sent to the data link layer, a mapping IP addr/MAC addr is needed. This is done by means of the ARP protocol. More in next chapter…

Before sending an IP_PDU, IP protocol checks if there is any entry in the RT for the destination network: If there is not any coincident entry, the IP_PDU will not be sent. If there is a coincident entry, the IP_PDU will be sent through the

interface indicated in the RT entry. It uses data link layer services to send it to:

the destination, if it is directly connected. the device (router) whose IP address matches the one in the RT.

In the end systems it is the interface of the edge router, in most cases.

IPv4 operation (III)

note

Network Layer 4-65

Page 66: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

When receiving an IP_PDU, network layer checks if the destination network matches one of the configured ones: If it matches, the network layer processes the IP_PDU. If it does not match, then:

if it is an end system, the network layer discards the IP_PDU. If it is a router, the network layer forwards it, if it knows how to reach

the destination network: Checks and modify, if appropriate, the TTL value of the IP_PDU header.

If it is 1, it discards the IP_PDU (it does not forward it). otherwise, it decreases the TTL value in 1.

Repeat the actions that network layer does to send a IP_PDU.

IPv4 operation (IV)

Network Layer 4-66

Page 67: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-67

Example of sending IP_PDUs

E0

E2

E1

223.1.8.2/22

Note: Interfaces aren’t shown in RTs.

223.1.2.0/24223.1.2.0/24

223.1.3.0/24223.1.3.0/24

223.1.1.0/24223.1.1.0/24

223.1.16.0/22223.1.16.0/22

223.1.0.0/24223.1.0.0/24

223.1.8.0/22223.1.8.0/22

R2R1

R3 R4223.1.8.27/22

223.1.8.1/22

E0

E2

E1

E0

E1

E0

E1

INTERNETINTERNETE2

223.1.1.1/24

223.1.1.2/24

223.1.3.1/24 223.1.3.2/24

223.1.0.2/24

223.1.0.1/24

223.1.2.1/24 223.1.2.2/24

223.1.16.2/22

223.1.16..1/22

223.1.16.25 /22

223.1.64.1/18

RT Host 223.1.3.2/22

Network Next hop

223.1.8.0/22 -

0.0.0.0/0 223.1.8.27

RT Router 3

Network Next hop

223.1.8.0/22 -

223.1.1.0/24 -

223.1.2.0/24 -

223.1.3.0/24 223.1.1.1

223.1.16.0/22 223.1.1.1

0.0.0.0/0 223.1.2.2

RT Router 4

Network Next hop

223.1.64.0/18 -

223.1.0.0/24 -

223.1.2.0/24 -

223.1.3.0/24 223.1.1.1

223.1.16.0/22 223.1.0.2

223.1.8.0/22 223.1.0.2

0.0.0.0/0 223.1.96.255

RT Router 1

Network Next hop

223.1.3.0/24 -

223.1.1.0/24 -

223.1.2.0/24 223.1.1.1

223.1.8.0/22 223.1.1.1

223.1.16.0/22 223.1.3.2

0.0.0.0/0 223.1.3.2

RT Router 2

Network Next hop

223.1.3.0/24 -

223.1.0.0/24 -

223.1.16.0/22 -

223.1.1.0/24 223.1.3.1

223.1.8.0/22 223.1.3.1

0.0.0.0/0 223.1.0.1

To: 223.1.8.1

1.- From 223.1.8.2 to 223.1.8.12.- From 223.1.8.1 to 223.1.16.1Q. What is the TTL value that is received by 223.1.16.1 inside the IP_PDU?

To: 223.1.16.1

Page 68: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

PROBLEMS AND EXERCISES

Computer Networking – Chapter 4: The Network layer

Departamento deTecnología Electrónica

Network Layer 4 - 68

Page 69: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr1: Fragmentation

Network Layer 4-69

Consider a router that has received a IP_PDU with 2400 bytes from one of its interfaces. It must forward it through a 700 bytes MTU interface. How many IP_PDUs is the router forwarding to its output interface? Indicate values for fragment identifier, flags, fragment offset, and length of every IP_PDU.

Page 70: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr2: Classful addressing

Network Layer 4-70

Next figure shows a router interconnecting two networks. Answer the questions assuming that classful addressing is used:

a) What is the available address range and the broadcast address for each network? What is the routing table of the router like? And the routing table of an end system in each network? Give an example of a possible configuration of the router interfaces and of the end systems A and B.

b) Suppose that an end system in network 150.0.0.0 sends an IP_PDU whose destination address is 192.0.0.255. Who in the destination network is receiving the IP_PDU?

c) Suppose that an end system in network 192.0.0.0 sends an IP_PDU whose destination is 255.255.255.255. Who in the destination network is receiving the IP_PDU?

Page 71: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr3: Classless addressing

Network Layer 4-71

Suppose that the CIDR block 200.1.0.0/24 was assigned to a company. Every subnet must have 20 connected end systems.a)How many subnets could you create inside this company?b)Which subnet mask, broadcast address and available IP address range does every subnet have?c)Would you change your answer if there were 30 end systems per subnet?

Page 72: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr4: Classless addressing

Network Layer 4-72

Consider a router that interconnects three subnets: subnet 1, subnet 2, and subnet 3. Suppose that all the interfaces in these subnets must be subnets of 223.1.17.0/24. Subnet 1 is required to have up to 63 end systems; Subnet 2, up to 95 end systems; and Subnet 3, up to 16 end systems. Check out if it is possible to address these three subnets.

Page 73: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr5: NAT, interface configuration

Network Layer 4-73

Next figure shows a public institution network that accesses to the Internet via router R2. Answer these questions:

a) How many end systems, as maximum, is it possible to connect to every subnet in this

institution?b) Is it necessary that router R2 implements NAT?c) Suppose R2 does not implement NAT. Which network prefix would appear in the routing table

in a router in the Internet, e.g. RI, to identify that institution?d) Could this institution address a new subnet? How many end systems could there be connected,

as maximum?e) Suppose that the interface E0 of R2 has the next configuration: IP address=223.14.15.1,

netmask=255.255.255.252. All the end systems have to be able to access to the Internet and communicate to other end systems inside the institution. Indicate the configuration for interfaces of the routers R1 and R2, the minimum content of their routing tables and the minimum content of an end system in each subnet.

Page 74: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr6: Addressing

Network Layer 4-74

Next figure shows a public institution network that accesses to the Internet via router R2. Answer these questions:

a) If classful addressing was used, how many networks would be necessary? Which class should be used for a minimum address waste?

b) Would it be possible to address all the subnets of the institution with a CIDR block 200.1.1.0/25? In that case, assign the right network address for every institution subnet.

c) Would it be possible to connect a new subnet with 13 PCs through a free interface of R1? In that case, indicate the content of the routing table of R2 for a minimum number of entries. (Interface E0 of R2 has the following configuration: IP addr=223.14.15.1, netmask=255.255.255.252. All PCs of this institution are able to access to the Internet).

d) Would you change your answer for question c) if the subnet connects to a free interface of R2 instead to R1?

Network-212 PCs

Network-212 PCs Network-1

12 PCs

Network-112 PCs

Network-312 PCs

Network-312 PCs

Network50 PCs

Network50 PCs

InternetInternet

E0

E1

E3

E2R1

E1

E0

R2

Page 75: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr7: NAT

Network Layer 4-75

Figure shows two companies, X and Y, that access to the Internet through a router that implements NAT. A and B are web servers that are on the Internet . All the devices are configured correctly, and classless addressing is used. Answer reasonably to these questions:

Page 76: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr7: NAT

Network Layer 4-76

a) Is it possible that a PC of the Company X, e.g., the one that has IP address 172.16.1.2, opens a web page from server A in its browser? In that case, indicate source and destination IP address for the IP_PDUs received by the server, and for the IP_PDUs received by the client. Otherwise, explain what the problem is.

b) Is it possible that a PC of the Company Y, e.g. the one that has IP address 147.156.1.2, opens a web page from server A in its browser? In that case, indicate source and destination IP address for the IP_PDUs received by the server, and for the IP_PDUs received by the client. Otherwise, explain what the problem is.

c) Is it possible that a PC of the Company X, e.g. the one that has IP address 172.16.1.2, opens a web page from server B in its browser? In that case, indicate source and destination IP address for the IP_PDUs received by the server, and for the IP_PDUs received by the client. Otherwise, explain what the problem is.

d) Is it possible that a PC of the Company Y, e.g. the one that has IP address 147.156.1.2, opens a web page from server B in its browser? In that case, indicate source and destination IP address for the IP_PDUs received by the server, and for the IP_PDUs received by the client. Otherwise, explain what the problem is.

Page 77: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr8: Addressing

Network Layer 4-77

Figure shows the network topology of a company, where hosts access to the Internet through a router (1) that supports NAT. Router 1 is connected to the networks 150.214.141.0/24 and 192.168.1.0/24 through two different interfaces. Router RTX is on the Internet and it is not part of the company network. Classless addressing (CIDR) is used.

a) How many broadcast domains are there in the company network? b) Provide an address assignment for this network taking into account that you have to leave as maximum

vacant address as possible, for future extensions. Subnet A is required to have 125 PCs and subnet B is required to have 61 PCs.

i. Indicate, reasonably, IP address and netmask for all the interfaces in routers 1,2 and 3.ii. Which address range is remaining available for future extensions? Using all address the obtained

space, indicate the network prefixes that allow the most number of hosts.c) Indicate, reasonably, the minimum content of the routing tables for all three routers (1, 2 y 3), so that all the

PCs in the company may interchange datagrams and are connected to the Interne. The less traffic as possible must be generated.

d) Regarding router RTX, is it necessary to include any entry in the routing table to address the company? Indicate why and, if it is the case, a possible IP address for next hop.

Page 78: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr9: IP configuration

Network Layer 4-78

Consider the network showed in the figure. It has access to the Internet, uses classless addressing, and all the routers interfaces are configured as it is shown in the table (note: not all of them are shown).

a) Indicate, reasonably, IP address and netmask for interfaces E1 and E2 of router R2.b) Indicate, reasonably, if the following IP addresses are correct in the described context:

i. IP addr = 150.214.0.0 and netmask = 255.255.254.0 for a PC in network Alpha. ii. IP addr = 150.214.0.255 and netmask = 255.255.254.0 for a PC in network Alpha.iii. IP addr = 150.214.2.5 and netmask = 255.255.252.0 for a PC in network Bravo.iv. IP addr = 150.214.1.2 and netmask = 255.255.254.0 for a PC in network Bravo.

c) Indicate, reasonably, the minimum content of the routing tables of router R2 and the exterior router (Rext), connected to interface E0 of R2.

d) Imagine that routers R0, R1 and R2 are replaced by a switch that interconnects networks Alpha and Bravo directly to the exterior router (Rext). That would make Alpha and Bravo being in the same broadcast domain. Which changes in the configuration of routers are necessary to keep connectivity (among PCs and to the Internet). NOTE: Parameter “IP address” in nodes of Alpha and Bravo cannot be modified.

Router (Interface) Prefix notation configuration

R0 (E0) 150.214.0.1/23R0 (E1) 150.214.128.2/30R1 (E0) 150.214.2.1/23R1(E1) 150.214.128.5/30R2(E0) 150.214.128.9/30

Rext (E1) 190.100.100.2/30

Page 79: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Pr10: Fragmentation

Network Layer 4-79

Consider a router connecting two broadcast domains, 1 and 2. In each domain, there is only one logical network. Broadcast domain 1 has an MTU=1500 bytes and broadcast domain 2 has an MTU = 760 bytes. PcA is in broadcast domain 1. It is running a process in port 49789. This process implements the client side of an application-layer protocol called X. In the same domain, PcB is running a process in the port 51345, implementing the server side of the X protocol. If UDP in PcA receives a send request from port 49789 of an A_PDU of 1472 bytes, for the port 51345 in PcB, determine reasonably:

a) How many UDP_PDU and IP_PDU are UDP and IP receiving, respectively, in PcB? And which size, in bytes, are they?

b) Would you change your answer if PcB was in broadcast domain 2? Why? (Note: In this case, PcB has been configured correctly in the corresponding logical network in the broadcast domain)

Page 80: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Chapter 4: Summary Network Layer characteristics in

datagram networks. It works the same in hosts and routers

Using routing tables. IP protocol:

How it fragments and reassemblies. How devices are addressed. How it sends and receives IP_PDU. How it uses routing tables.

Next: Leaving network

core and logical network (Network Layer)

Incoming to physical network (broadcast domain)

Network Layer 4-80

Page 81: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Network Layer 4-81

Page 82: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table example

NET 2NET 2

Net1.Host1

Net2.Host1

Net2.Host2

Net1.Host2

Net1.Host3

Net2.Host3 Net2.HostN

Network Layer 4-82

…Net1.HostN

E0 E1

RT Router 1

Network Next hop Interface

Net1 - E0

Net2 - E1

RT Host Net1.Host1

Network Next hop Interface

Net1 - E

Net2 Net1.Host2 E

NET 1NET 1Router 1¿?

E2

NET 3NET 3

Net3.Host1 Net3.HostN-1

Net3.HostN

¿?

Router 2

E2

E0

E1

Page 83: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table example

NET 2NET 2Router 1

Net1.Host1

Net2.Host1

Net2.Host2

Net1.Host2

Net1.Host3

Net2.Host3 Net2.HostN

Network Layer 4-83

…Net1.HostN

E0 E1

RT Router 1

Network Next hop Interface

Net1 - E0

Net2 - E1

Net4 - E2

Net3 Net4.Host1 E2

RT Host Red1.Host1

Network Next hop Interface

Net1 - E

Net2 Net1.Host2 E

Net3 Net1.Host2 E

Net4 Net1.Host2 E

NET 1NET 1

NET 3NET 3

Net3.Host1 Net3.HostN-1

Net3.HostN

Router 2

E2

E0

E1

Net4.Host2

Net4.Host1

Page 84: Chapter 4 Network layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer

Routing table example

NET 2NET 2Router 1

Net1.Host1

Net2.Host1

Net2.Host2

Net1.Host2

Net1.Host3

Net2.Host3 Net2.HostN

Network Layer 4-84

…Net1.HostN

E0 E1

RT Router 1

Network Next hop Interface

Net1 - E0

Net2 - E1

Net4 - E2

Net3 Net4.Host1 E2

RT Host Red1.Host1

Network Next hop Interface

Net1 - E

Default Red1.Host2 E

NET 1NET 1

NET 3NET 3

Net3.Host1 Net3.HostN-1

Net3.HostN

Router 2

E2

E0

E1

Net4.Host2

Net4.Host1