network layer computer networks - epn.ba · computer networks dr. georgios k. theodoropoulos 2001...

19
Computer Networks Dr. Georgios K. Theodoropoulos 2001 Network Layer/1 School of Computer Science The University of Birmingham Computer Networks The Network Layer Computer Networks Dr. Georgios K. Theodoropoulos 2001 Network Layer/2 School of Computer Science The University of Birmingham Network Layer Services: connection oriented vs. connectionless Creating an Internetwork - Subnet implementation Network Layer Protocols: Routed vs Routing Routed (or routable): can be routed over an internetwork - Protocols that provide support for the network layer. E.g. IP, IPX/SPX and AppleTalk. Routing: determine the paths that routed protocols follow to their destinations. Other issues related to the Network Layer, which however, will NOT be discussed within this module: – QoS Error handling – Tunneling Packet fragmentation and re-assembly – Firewalls Congestion & flow control

Upload: others

Post on 26-May-2020

2 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/1School of Computer ScienceThe University of Birmingham

Computer Networks

The Network Layer

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/2School of Computer ScienceThe University of Birmingham

Network Layer• Services: connection oriented vs. connectionless

• Creating an Internetwork - Subnet implementation

• Network Layer Protocols: Routed vs Routing

– Routed (or routable): can be routed over aninternetwork - Protocols that provide supportfor the network layer. E.g. IP, IPX/SPX andAppleTalk.

– Routing: determine the paths that routedprotocols follow to their destinations.

• Other issues related to the Network Layer, whichhowever, will NOT be discussed within thismodule:

– QoS

– Error handling

– Tunneling

– Packet fragmentation and re-assembly

– Firewalls

– Congestion & flow control

Page 2: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/3School of Computer ScienceThe University of Birmingham

Service Paradigms• Two types of services may be supported

(provided) by a network– Connection-oriented (circuit switching)

e.g. like the telephone system.Historically WANs• 3 steps: establish, use, release the

connection• reliable (delay due to

acknowledgement) vs unreliable• Messages travel and arrive in order

– Connectionless (datagrams - packetswitching) e.g. like the postal system.Historically LANs• No fixed connection, messages travel

independently and may arrive in anyorder.

• Typically unreliable (butacknowledgements may beemployed)

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/4School of Computer ScienceThe University of Birmingham

Services

Page 3: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/5School of Computer ScienceThe University of Birmingham

Services

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/6School of Computer ScienceThe University of Birmingham

Datagrams

0

132

01 3

2

013

2

Switch 3 Host B

Switch 2

Host A

Switch 1

Host C

Host D

Host EHost F

Host G

Host H

Page 4: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/7School of Computer ScienceThe University of Birmingham

Subnet Implementation• OSI Layer 3 devices: Routers• Multi-layer Switches• WAN Technologies

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/8School of Computer ScienceThe University of Birmingham

An Example Network

Page 5: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/9School of Computer ScienceThe University of Birmingham

Routing Algorithms• Desirable properties: correctness, simplicity,

robustness, stability, fairness vs. optimality

• Metrics: bandwidth, delay, load, reliability, hopcount, ticks (~ 55 msec), cost

• Centralised vs distributed

• Static vs adaptive (dynamic)

• Basic Algorithms

– Dijkstra

– Bellman-Ford

– Link State Routing

– Hybrid

• Hierarchical Routing: interior vs exterior protocols

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/10School of Computer ScienceThe University of Birmingham

Static Routing• Static route knowledge is administered

manually by a network administrator whoenters it into a router's configuration. Theadministrator must manually update thisstatic route entry whenever an internetworktopology change requires an update.

• Static routing enables you to specify theinformation you want to reveal aboutrestricted networks.

• When a network is accessible by only onepath (point-to-point or circuit switchedlink), a static route to the network can besufficient. This type of network is called astub network.

Page 6: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/11School of Computer ScienceThe University of Birmingham

Dynamic Routing• Dynamic routing is done by means of two

basic router functions:

– maintenance of a routing table

– timely distribution of knowledge, in the form ofrouting updates, to other routers

• Dynamic routing relies on a routingprotocol to share knowledge among routers.A routing protocol defines the set of rulesused by a router when it communicates withneighboring routers. e.g.:

– how to send updates

– what knowledge is contained in these updates

– when to send this knowledge

– how to locate recipients of the updates

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/12School of Computer ScienceThe University of Birmingham

Dijkstra’s Shortest PathAlgorithm

• Centralized & static : Each node hasinformation regarding link costs among thenetwork nodes and executes the algorithm todetermine the cheapest route to each othernode.

Define S as a set of nodes. Initially Scontains node A.

Define Cost(X) as the cost of the cheapestroute from A to X using only nodes from S(X excepted). Initially, Cost(X) is thecost of a link from A to X. If no suchlink exists, then Cost(X) is infinity. Forthose nodes linked to A define Prior(X)=A

Do{

Determine the set of nodes W not in S, butconnected to a node in S. Choose a node Xin W for which Cost (X) is a minimum. AddX to S. For each V not in S, defineCost(V)=min{Cost(V),Cost(X)+cost of linkfrom X to V}. If Cost(V) is changed definePrior(V)=X

}

while not all nodes in S.

Page 7: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/13School of Computer ScienceThe University of Birmingham

Dijkstra’s Algorithm

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/14School of Computer ScienceThe University of Birmingham

Bellman-Ford RoutingAlgorithm

• Dynamic & Distributed

• Each router maintains a routing table(distance vector) giving the best knowndistance to each destination and the logicaladdress of the first router on the path toeach network contained in the table

• Periodic copies of a router’s entire routingtable is passed to its directly connectedneighbouring routers to communicatetopology changes. Routers do NOT haveknowledge of the exact topology of aninternetwork.

Page 8: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/15School of Computer ScienceThe University of Birmingham

Bellman-Ford Algorithm

For each neighbour insert the entry (node,link cost) in the current routing table

While true do

for each neighbour N do

{

Receive info from N’s routing table

for each node Z in N’s routing table do

if Z is not in the current routingtable

insert the pair(N, current cost to N+ N’s cost to Z)in it

else

if the current cost to N+N’s cost toZ < current cost to Z

replace the current cost to Z withthe current cost

to N+N’s cost to Z

specify N s the new first nodealong a route to Z

}

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/16School of Computer ScienceThe University of Birmingham

Bellman-Ford Algorithm

Page 9: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/17School of Computer ScienceThe University of Birmingham

Bellman Ford: The count-to-infinity Problem

• Problem: link cost increases take a longtime to be reported (count-to-infinity)

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/18School of Computer ScienceThe University of Birmingham

Bellman Ford: The count-to-infinity Problem

• Maximum “cost”: when the cost value exceedsthe maximum value, the network involved isconsidered unreachable.

• Hold-down timers: A timer is started when arouter receives an update from neighbour Xthat a network is now inaccessible. Beforetimer expires: if update X, or from a differentneighbour Y with a better metric than before,that the network is again accessible, the hold-down timer is removed. Updates from Y with apoorer metric are ignored - more time for theknowledge of a disruptive change to propagatethrough the entire network.

• Split horizon: If node X knows of a route to Dvia neighbour N, it does not send thisinformation to N! No guarantee that thismethod will work on all cases.

Page 10: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/19School of Computer ScienceThe University of Birmingham

Link State Routing• Algorithm:

– Gather information on the status of each link toeach neighbour

• ECHO packets to measure bandwidthand/or queuing delays

– Construct a link state packet (link stateadvertisements - LSA) for each link

• periodically or upon the occurrence of anevent that changes the picture

– Send them to each neighbour (flooding)

• packets are numbered and timestamped todeal with loops

– Upon receiving a link state packet, forward itto all neighbours and also use it to construct thelocal routing table and the topological database

– Use information in the routing table to findshortest path, e.g. Dijkstra

• Problem: processing, memory and bandwidthrequirements

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/20School of Computer ScienceThe University of Birmingham

Link State Routing

Page 11: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/21School of Computer ScienceThe University of Birmingham

Distance Vector vs LinkState

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/22School of Computer ScienceThe University of Birmingham

Hierarchical Routing• As networks grow, routing packet traffic

and routing tables grow proportionally. Asolution is to have some routers do therouting for others: Hierarchical routing

– The routers are divided into groupscalled domains or regions. Each regionmay be regarded as a separate andindependent network.

– Each router has info about how to routepackets within its own region.

– Each region has one or more designatedrouters that determine routes betweenregions.

– large regions are further divided intosubregions etc.

Page 12: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/23School of Computer ScienceThe University of Birmingham

Hierarchical Routing

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/24School of Computer ScienceThe University of Birmingham

Routing in TCP/IP• Typically an internetwork is viewed as consisting

by:– 3 types of connections and networks:

• point-to-point• multiaccess networks with broadcasting

(LANs)• multiaccess networks without broadcasting

(WANs)– 4 classes of routers: Internal, Area border,

Backbone, AS boundary• Interior gateway protocols (within ASs)

– IGRP Interior Gateway Routing Protocol, Cisco,distance vector

– RIP, Routing Information Protocol, UNIX BSDsystems - the most common IGP in the Internet,distance vector

– EIGRP, Enhanced Interior Gateway RoutingProtocol, Cisco, hybrid

– OSPF, Open Shortest Path First, link state• The exterior protocol (between ASs)

– Border Gateway Protocol, fundamentallyBellman-Ford

Page 13: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/25School of Computer ScienceThe University of Birmingham

Routing in the Internet

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/26School of Computer ScienceThe University of Birmingham

The Internet Protocol• The most popular routed protocol: the glue that

holds the internet together

– Addressing and Subnetting

– Control protocols

• ARP - Address Resolution Protocol, RARP(reverse Address resolution protocol) (IP ↔MAC address)

• ICMP Internet Control message protocol)

– Routing Protocols

Page 14: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/27School of Computer ScienceThe University of Birmingham

Addressing (IP)• IP is the most popular implementation of a

hierarchical network addressing scheme.• Addresses are 32 bits and are expressed as dotted-

decimal numbers - four octets (bytes - bits in thesebytes, from left to right, have decimal values of128, 64, 32, 16, 8, 4, 2, 1. Added together, theytotal 255).

• Two parts:– Network: identifies the network to which a

device is attached.– Host: The host portion of an IP address

identifies the specific device on that network• Hosts on a network can only communicate directly

with devices that have the same network ID. Theymay share the same physical segment, but if theyhave different network numbers, they usuallycannot communicate directly with each other (onlyvia a router).

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/28School of Computer ScienceThe University of Birmingham

IP Addresses

• 5 classes, 3 commercially used

Page 15: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/29School of Computer ScienceThe University of Birmingham

IP Address Classes• Class A. When written in a binary format, the

first (leftmost) bit of a Class A address isalways 0. An easy way to recognize whether adevice is part of a Class A network is to look atthe first octet of its IP address, which willrange from 0-126. (127 reserved for loopbackand diagnostics.) 224 - 2 = 16,777,214,possible IP addresses to devices that areattached to its network

• Class B. The first 2 bits of a Class B addressare always 10. Class B IP addresses alwayshave values ranging from 128 to 191 in theirfirst octet. 216 - 2= 65,534 possible IPaddresses to devices that are attached to itsnetwork

• Class C. The first 3 bits of a Class C addressare always 110. Class C IP addresses alwayshave values ranging from 192 to 223 in theirfirst octet. 28 -2 = 254 possible IP addresses todevices that are attached to its network

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/30School of Computer ScienceThe University of Birmingham

Subnetting• Allow a network to be split into several parts for

internal use but still act like a single network to theoutside world. These smaller divisions are calledsubnetworks (subnets). Why split?

– A primary reason for using subnets is to reducethe size of a broadcast domain.

– Address flexibility: Many (internal) networkswith a single Class A/B/C address.

• How? Borrow bits from the original host portionand designate them as the subnet field.

• Remember!!!:– Each network has an IP address– Each router interface has an IP address

Page 16: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/31School of Computer ScienceThe University of Birmingham

Subnetting: Network Masks• The subnet mask (formal term: extended network

prefix), is not an address, but determines which partof an IP address is the network field and which partis the host field. A subnet mask is 32 bits long andhas 4 octets, just like an IP address.

• To determine the subnet mask for a particularsubnetwork IP address follow these steps.– Express the subnetwork IP address in binary form.– Replace the network and subnet portion of the

address with all 1s.– Replace the host portion of the address with all 0s.– As the last step convert the binary expression back

to dotted-decimal notation.

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/32School of Computer ScienceThe University of Birmingham

Subnetting: Network Masks

Page 17: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/33School of Computer ScienceThe University of Birmingham

Subnetting• The minimum number of bits that can be

borrowed is 2 (why? 0 or 1)• The maximum number of bits that can be

borrowed an be any number that leaves at least 2bits remaining, for the host number.

• Each borrowed bit increases the number ofsubnets by a power of 2 (the number of possiblesubnets doubles).

• Each time another bit from the host field isborrowed, the number of host addresses that canbe assigned decreases by a power of 2 (gets cutin half).

• Example: Subnet mask 255.255.255.0 associatedwith the Class B address 130.5.2.144. (8 bitsborrowed for subnetting): packet routed to subnet130.5.2.0 rather than to just network 130.5.0.0

• Q: In a Class C network 199.5.12.0 with subnetmask 255.255.255.224, to which subnet wouldhost 199.5.12.97 belong (subnet 0, 1, 2, 3, 4ornone of the these) (hint: 97 = 01100001 binary)

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/34School of Computer ScienceThe University of Birmingham

ARP• A data packet must contain both a destination MAC

address and a destination IP address. After devicesdetermine the IP addresses of the destinationdevices, they add the destination MAC addresses tothe data packets (Encapsulation!)

• Different techniques to determine the MACaddress: Address Resolution Protocol (ARP) one ofthem (RFC 826)

• Each computer on the network maintains its ownARP table which maps IP addresses to thecorresponding MAC addresses. ARP tables aresections of RAM memory, in which the cachedmemory is maintained automatically on each of thedevices.

Page 18: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/35School of Computer ScienceThe University of Birmingham

ARP (within a subnet)

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/36School of Computer ScienceThe University of Birmingham

ARP: CommunicationBetween Different Subnets

• Using the Default gateway: The IP address of theinterface on the router that connects to the networksegment on which the source host is located.Source compares IP address of receiver and if noton same subnet it sends the ARP request to thedefault gateway (using MAC address of router).

• Proxy ARP. Router is configured to respond toARP requests for remote networks

• In either case, router then forwards the packet in aframe destined to the remote router (in this exampleusing FDDI MAC address)

Page 19: Network Layer Computer Networks - epn.ba · Computer Networks Dr. Georgios K. Theodoropoulos 2001 ... restricted networks. • When a network is accessible by only one path (point-to-point

Computer Networks Dr. Georgios K. Theodoropoulos

2001

Network Layer/37School of Computer ScienceThe University of Birmingham

Assigning IP Addresses• There are essentially two methods for assigning IP

addresses

– Static addressing: each individual device isconfigured manually with an IP address.

– Dynamic addressing:

• Reverse ARP (RARP, RFC 903). Problem:RARP server required on each network(routers do not forward MAC broadcasts)

• BOOTP (RFC, 951,1048,1084): Uses UDP(Layer 4) messages which are forwarded byrouters.