Network Layer

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 22

Network Layer Lecture # 2

MAHS

Hierarchical Routing
Our routing study thus far - idealization all routers identical network flat not true in practice Why? scale: with 200 million destinations:
cant store all dests in

administrative autonomy
internet = network of

routing tables! routing table exchange would swamp links!

networks each network admin may want to control routing (cost metrics, etc.) in its own network
4: Network Layer 4b-2

Hierarchical Routing
Organization:

gateway routers
special
run intra-AS routing

aggregate routers into regions, called autonomous systems (AS) routers in same AS run same routing protocol

routers in (on the edge of) an AS

intra-AS routing (i.e., within an AS) protocol routers in different AS can run different intraAS routing protocol

protocol with all other routers in AS also responsible for routing to destinations outside AS run inter-AS routing (i.e., between AS) protocol with other gateway routers

4: Network Layer

4b-3

Intra-AS and Inter-AS routing


C.b b d A A.a A.c a b c a B

B.a
c

Gateway routers:

perform inter-AS routing amongst themselves perform intra-AS routing with other routers in their AS
network layer

inter-AS, intra-AS routing in gateway A.c

data link layer

physical layer

4: Network Layer

4b-4

Intra-AS and Inter-AS routing


C.b
b A.a a Inter-AS routing between A and B A.c B.a a c Host h2 b

a Host h1

d c b A Intra-AS routing within AS A

Intra-AS routing within AS B

Well examine specific inter-AS and intra-AS

Internet routing protocols shortly (section 4.5)


4: Network Layer 4b-5

IP datagram format
IP protocol version number header length (4-byte multiples) DS codepoint, ECN max number remaining hops (decremented at each router) upper layer protocol to deliver payload to (RFC 1700, 3232) 32 bits head. type of length ver len service fragment 16-bit identifier flgs offset upper time to Header layer live checksum 32 bit source IP address 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. total datagram length (bytes) for fragmentation/ reassembly

how much overhead with TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead

data (variable length, typically a TCP segment, a UDP segment, or an ICMP message)

4: Network Layer

4b-6

IP Fragmentation & Reassembly


network links have MTU (Max.

Transfer Unit) size - largest possible link-level frame. different link types, different MTUs large IP datagram is divided (fragmented) within network one datagram becomes several datagrams reassembled only at the final destination IP header bits are used to identify and order related fragments

fragmentation: in: one large datagram out: 3 smaller datagrams

reassembly

4: Network Layer

4b-7

IP Fragmentation and Reassembly


bytes* ID More bit offset =3980 =x =0 =0 One large datagram becomes several smaller datagrams bytes* ID More bit offset =1480 =x =1 =0 bytes* ID More bit offset =1480 =x =1 =1480 bytes* ID More bit offset =1020 =x =0 =2960
* This is the number of data bytes in the IP datagram. The IP length field would show this + 20. Why?

Example 4000 byte datagram MTU = 1500 bytes

Note: Offset is actually specified as number of 8-byte (64-bit) units. 4: Network Layer 4b-8

DHCP: Dynamic Host Configuration Protocol


Goal: allow host to dynamically obtain its IP address from network server when it joins a network

DHCP overview: host broadcasts DHCP discover msg DHCP server responds with DHCP offer msg host requests IP address: DHCP request msg DHCP server sends address: DHCP ack msg

Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an on Support for mobile users who want to join network (more shortly)

4: Network Layer

4b-9

DHCP client-server scenario


A
223.1.1.1 223.1.1.2 223.1.1.4 223.1.1.3 223.1.3.1

DHCP server
223.1.2.9

223.1.2.1

223.1.2.2 223.1.3.27 223.1.3.2

arriving DHCP client needs address in this network

4: Network Layer 4b-10

DHCP client-server scenario


DHCP server: 223.1.2.5
DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654

arriving client

DHCP offer
src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request

time

src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs

4: Network Layer 4b-11

NAT: Network Address Translation


rest of Internet local network (e.g., home network) 10.0.0/24
10.0.0.4 138.76.29.7 10.0.0.3 10.0.0.1 10.0.0.2

network have same single source NAT IP address: 138.76.29.7, different source port numbers

All datagrams leaving local

Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)

4: Network Layer 4b-12

NAT: Network Address Translation


Motivation: local network uses just one IP address as

far as outside word is concerned: no need to be allocated range of addresses from ISP: - just one IP address is used for all devices can change addresses of devices in local network without notifying outside world can change ISP without changing addresses of devices in local network devices inside local net not explicitly addressable, visible by outside world (a security plus).

4: Network Layer 4b-13

NAT: Network Address Translation


Implementation: NAT router must:

outgoing datagrams: replace (source IP address, port #) of

every outgoing datagram to (NAT IP address, new port #) . . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr.

remember (in NAT translation table) every (source IP address,


port #) to (NAT IP address, new port #) translation pair

incoming datagrams: replace (NAT IP address, new port #) in


dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table

4: Network Layer 4b-14

NAT: Network Address Translation


2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table NAT translation table WAN side addr LAN side addr

138.76.29.7, 5001 10.0.0.1, 3345

1: host 10.0.0.1 sends datagram to 128.119.40, 80

S: 10.0.0.1, 3345 D: 128.119.40.186, 80

S: 138.76.29.7, 5001 D: 128.119.40.186, 80

1
10.0.0.4
S: 128.119.40.186, 80 D: 10.0.0.1, 3345

10.0.0.1
10.0.0.2

138.76.29.7

3: Reply arrives dest. address: 138.76.29.7, 5001

S: 128.119.40.186, 80 D: 138.76.29.7, 5001

10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
4: Network Layer 4b-15

NAT: Network Address Translation


16-bit port-number field: 60,000 simultaneous connections with a single LAN-side address! Reserved address space (rfc 1918) NAT is controversial: routers should only process up to layer 3 violates end-to-end argument

address shortage should instead be solved by IPv6


4: Network Layer 4b-16

NAT possibility must be taken into account by app designers, eg, P2P applications

Intra-AS Routing
Also known as Interior Gateway Protocols (IGP)

Most common IGPs:

RIP: Routing Information Protocol (legacy, RIPv2 still in use) OSPF: Open Shortest Path First (common) EIGRP: Enhanced Interior Gateway Routing Protocol (proprietary Cisco Systems)

4: Network Layer 4b-17

RIP ( Routing Information Protocol)


Distance vector algorithm

Included in BSD-UNIX Distribution in 1982 RFC 1058 (version 1), RFC 2453 (version 2)
Distance metric: # of hops (max = 15 hops) Can you guess why? Distance vectors: exchanged every 30 seconds via

Response Message (also called advertisement) Each advertisement: routing info for maximum of 25 destination nets within the AS Uses UDP transport, port 520
4: Network Layer 4b-18

Problems/limitations with RIP


Good for small systems, but doesnt scale

well Count-to-infinity problem poisoned reverse only Comparatively slow convergence


1979 RIP version 1

1988 IETF initiates work on replacement 1990 OSPF became new standard 1990s RIP version 2

4: Network Layer 4b-19

OSPF (Open Shortest Path First)


open: publicly available Uses Link State algorithm LS packet dissemination Topology map at each node Route computation using Dijkstras algorithm

However. OSPF advertisement carries only one entry per neighbor router Advertisements disseminated to entire AS (via flooding) Sent as payload in IP datagram
4: Network Layer 4b-20

EIGRP (Enhanced Interior Gateway Routing Protocol)


CISCO proprietary; successor of RIP (mid 80s)

uses Distance Vector, like RIP


several cost metrics (delay, bandwidth, reliability,

load etc) uses TCP (!) to exchange routing updates Loop-free routing via a distributed update routing algorithm (called DUAL) based on diffused

computation

4: Network Layer 4b-21

Inter-AS routing

4: Network Layer 4b-22

You might also like