Network Layer Goals Content r Understand Internet r

  • Slides: 37
Download presentation
Network Layer Goals: Content: r Understand Internet r IP addressing network layer concepts r

Network Layer Goals: Content: r Understand Internet r IP addressing network layer concepts r Understand Internet routing r Understand Internet network layer protocols r Getting packet from r r source to destination Internet Protocol (IP) ICMP Intra- & Inter-AS routing Multicast routing Network Layer 1

The Internet Network layer Host, router network layer functions: Transport layer: TCP, UDP Network

The Internet Network layer Host, router network layer functions: Transport layer: TCP, UDP Network layer IP protocol • addressing conventions • datagram format • packet handling conventions Routing protocols • path selection • RIP, OSPF, BGP routing table ICMP protocol • error reporting • router “signaling” Link layer Physical layer Network Layer 2

IP Addressing r IP address: 32 -bit identifier for host, router interface: connection between

IP Addressing r IP address: 32 -bit identifier for host, router interface: connection between host/router and physical link m m m routers typically have multiple interfaces host may have multiple interfaces IP addresses associated with interface, not host or router 223. 1. 1. 1 223. 1. 1. 2 223. 1. 1. 4 223. 1. 1. 3 223. 1. 2. 1 223. 1. 2. 9 223. 1. 3. 27 223. 1. 2. 2 223. 1. 1. 1 = 11011111 00000001 223 1 1 Network Layer 1 3

IP Addressing r IP address: m network part (high order bits) m host part

IP Addressing r IP address: m network part (high order bits) m host part (low order bits) r What’s a network ? (from IP address perspective) m device interfaces with same network part of IP address m can physically reach other without intervening router 223. 1. 1. 1 223. 1. 1. 2 223. 1. 1. 4 223. 1. 1. 3 223. 1. 2. 1 223. 1. 2. 9 223. 1. 3. 27 223. 1. 2. 2 LAN 223. 1. 3. 2 network consisting of 3 IP networks (for IP addresses starting with 223, first 24 bits are network address) Network Layer 4

IP Addresses class A 0 network B 10 C 110 D 1110 1. 0.

IP Addresses class A 0 network B 10 C 110 D 1110 1. 0. 0. 0 to 127. 255 host network 128. 0. 0. 0 to 191. 255 host network multicast address host 192. 0. 0. 0 to 239. 255 240. 0 to 247. 255 32 bits What is POSTECH’s network address? What is your research lab’s subnet address? Network Layer 5

Getting a packet from source to dest. routing table in A Dest. Net. next

Getting a packet from source to dest. routing table in A Dest. Net. next router Nhops 223. 1. 1 223. 1. 2 223. 1. 3 IP packet: header source dest fields IP addr data A r packet remains unchanged, as it travels source to destination r addr fields are of interest here B 223. 1. 1. 4 1 2 2 223. 1. 1. 1 223. 1. 1. 2 223. 1. 1. 4 223. 1. 1. 3 223. 1. 2. 9 223. 1. 3. 27 223. 1. 2. 2 E 223. 1. 3. 2 Network Layer 6

Getting a packet from source to dest. header data fields 223. 1. 1. 1

Getting a packet from source to dest. header data fields 223. 1. 1. 1 223. 1. 1. 3 Dest. Net. next router Nhops 223. 1. 1 223. 1. 2 223. 1. 3 Starting at A, given IP packet addressed to B: r look up net. address of B r find B is on same net. as A using subnet mask r link layer will send packet directly to B inside link-layer frame m B and A are directly connected A B 223. 1. 1. 4 1 2 2 223. 1. 1. 1 223. 1. 1. 2 223. 1. 1. 4 223. 1. 1. 3 223. 1. 2. 9 223. 1. 3. 27 223. 1. 2. 2 E 223. 1. 3. 2 Network Layer 7

Getting a packet from source to dest. header data fields 223. 1. 1. 1

Getting a packet from source to dest. header data fields 223. 1. 1. 1 223. 1. 2. 2 Dest. Net. next router Nhops 223. 1. 1 223. 1. 2 223. 1. 3 Starting at A, dest. E: r look up network address of E r E on different network A, E not directly attached routing table: next hop router to E is 223. 1. 1. 4 link layer sends packet to router 223. 1. 1. 4 inside linklayer frame packet arrives at 223. 1. 1. 4 continued…. . A 223. 1. 1. 4 223. 1. 1. 1 m r r B 1 2 2 223. 1. 1. 4 223. 1. 1. 3 223. 1. 2. 9 223. 1. 3. 27 223. 1. 2. 2 E 223. 1. 3. 2 Network Layer 8

Getting a packet from source to dest. header data fields 223. 1. 1. 1

Getting a packet from source to dest. header data fields 223. 1. 1. 1 223. 1. 2. 2 Arriving at 223. 1. 1. 4, destined for 223. 1. 2. 2 r look up network address of E r E on same network as router’s interface 223. 1. 2. 9 m router, E directly attached r link layer sends packet to 223. 1. 2. 2 inside link-layer frame via interface 223. 1. 2. 9 r packet arrives at 223. 1. 2. 2!!! Dest. next network router Nhops interface 223. 1. 1 223. 1. 2 223. 1. 3 A B - 1 1 1 223. 1. 1. 4 223. 1. 2. 9 223. 1. 3. 27 223. 1. 1. 1 223. 1. 1. 2 223. 1. 1. 4 223. 1. 1. 3 223. 1. 2. 9 223. 1. 3. 27 223. 1. 2. 2 E 223. 1. 3. 2 Network Layer 9

IP packet format IP protocol version number header length (bytes) “type” of data max

IP packet format IP protocol version number header length (bytes) “type” of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to 32 bits type of ver head. len service length fragment 16 -bit identifier flgs offset time to upper Internet layer live checksum total datagram length (bytes) for fragmentation/ reassembly 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, typically a TCP or UDP segment) E. g. timestamp, record route taken, specify list of routers to visit. Network Layer 10

IP Fragmentation and Reassembly r network links have MTU (max. transfer unit) largest possible

IP Fragmentation and Reassembly r network links have MTU (max. transfer unit) largest possible link-level frame. m different link types, different MTUs r large IP packet divided (“fragmented”) within net m one packet becomes several packet m “reassembled” only at final destination m IP header bits used to identify, order related fragments fragmentation: in: one large packet out: 3 smaller packets reassembly Network Layer 11

IP Fragmentation and Reassembly length ID fragflag offset =4000 =x =0 =0 One large

IP Fragmentation and Reassembly length ID fragflag offset =4000 =x =0 =0 One large packet becomes several smaller packets length ID fragflag offset =1500 =x =1 =0 length ID fragflag offset =1500 =x =1 =1500 length ID fragflag offset =1000 =x =0 =3000 Network Layer 12

ICMP: Internet Control Message Protocol q Internet Control Message Protocol (ICMP), RFC 792 q

ICMP: Internet Control Message Protocol q Internet Control Message Protocol (ICMP), RFC 792 q The purpose of ICMP messages is to provide feedback about problems in the IP network environment q Delivered in IP packets q ICMP message format Ø 4 bytes of ICMP header and optional message Network Layer 13

ICMP Functions r To announce network errors m If a network, host, port is

ICMP Functions r To announce network errors m If a network, host, port is unreachable, ICMP Destination Unreachable Message is sent to the source host r To announce network congestion m When a router runs out of buffer queue space, ICMP Source Quench Message is sent to the source host r To assist troubleshooting m ICMP Echo Message is sent to a host to test if it is alive used by ping r To announce timeouts m If a packet’s TTL field drops to zero, ICMP Time Exceeded Message is sent to the source host - used by traceroute Network Layer 14

ICMP Problems r ICMP has also received bad press from denial of service (Do.

ICMP Problems r ICMP has also received bad press from denial of service (Do. S) attacks and because of the number of sites generating monitoring traffic r ICMP messages may be blocked (i. e. , dropped) by firewall or processed at low priority by router r As a consequence some ISPs disable ICMP even though this potentially causes poor performance and does not comply with RFC 1009 (Internet Gateway Requirements) r In spite of these limitations, ICMP is still most widely used in active network measurements Network Layer 15

ICMP Messages Type 0 3 3 3 4 8 9 10 11 12 Code

ICMP Messages Type 0 3 3 3 4 8 9 10 11 12 Code 0 0 1 2 3 6 7 0 0 0 description echo reply (ping) dest. network unreachable dest host unreachable dest protocol unreachable dest port unreachable dest network unknown dest host unknown source quench (congestion control - not used) echo request (ping) route advertisement router discovery TTL expired bad IP header Network Layer 16

Routing in the Internet r The Global Internet: A hierarchy of Autonomous Systems (ASs)

Routing in the Internet r The Global Internet: A hierarchy of Autonomous Systems (ASs) (enterprise ASs interconnected through ISP’s ASs) r Two level routing: Intra-AS: each enterprise is responsible for its intranet routing policy Inter-AS: uses the standard routing protocol (e. g. , BGP) Network Layer 17

Intra-AS Routing r Also known as Interior Gateway Protocol (IGP) r Most common IGPs:

Intra-AS Routing r Also known as Interior Gateway Protocol (IGP) r Most common IGPs: m m m RIP: Routing Information Protocol (IETF) OSPF: Open Shortest Path First (IETF) IGRP: Interior Gateway Routing Protocol (Cisco) Network Layer 18

RIP (Routing Information Protocol) r Distance vector type scheme r Included in BSD-UNIX Distribution

RIP (Routing Information Protocol) r Distance vector type scheme r Included in BSD-UNIX Distribution in 1982 r Distance metric: # of hops (maximum 15 hops) r Distance vector: exchanged every 30 sec via a Response Message (also called Advertisement) r Each Advertisement contains up to 25 destination nets r IETF RFC 1058 - http: //www. ietf. org/rfc 1058. txt Network Layer 19

RIP Example D’s Table before A’s Advertisement Dest. Net. next router Nhops Routers labeled

RIP Example D’s Table before A’s Advertisement Dest. Net. next router Nhops Routers labeled A, B, C, D, … Networks labeled 1, 10, 20, 30, . . . 1 20 30 10. . . A B B -. . . 2 2 7 1. . . A’s Advertisement Dest. Net. next router Nhops 30 1 10. . . C --. . . 4 1 1. . . D’s table after A’s advertisement Dest. Net. next router Nhops 1 20 30. . . A B A. . . 2 2 5. . . Network Layer 20

RIP: Link Failure and Recovery r If no advertisement heard after 180 sec, neighbor/link

RIP: Link Failure and Recovery r If no advertisement heard after 180 sec, neighbor/link is assumed to be dead r Routes via the neighbor are invalidated; new advertisements sent to neighbors r Neighbors in turn send out new advertisements if their tables changed r Link failure info quickly propagates to the entire net Network Layer 21

RIP Table processing r RIP routing tables managed by an application process called routed

RIP Table processing r RIP routing tables managed by an application process called routed (daemon) r advertisements encapsulated in UDP packets (reliability not required; advertisements are periodically repeated) Network Layer 22

RIP Table example q To get routing table on Unix/Win, type netstat -rn q

RIP Table example q To get routing table on Unix/Win, type netstat -rn q e. g. , a Router RIP table: Destination -------127. 0. 0. 1 192. 168. 2. 193. 55. 114. 192. 168. 3. 224. 0. 0. 0 default m m m Gateway --------127. 0. 0. 1 192. 168. 2. 5 193. 55. 114. 6 192. 168. 3. 5 193. 55. 114. 6 193. 55. 114. 129 Flags ----UH U U UG Ref ---0 2 3 0 Use ------26492 13 58503 25 0 143454 Interface ----lo 0 fa 0 le 0 qaa 0 le 0 3 attached class C networks (LANs) via fa 0, le 0 and qaa 0 Router only knows routes to attached LANs default is the default gateway “to go up” Route multicast address: 224. 0. 0. 0 1 st entry: Loopback interface (for debugging) Learn to use Netstat by examples: http: //www. cs. unh. edu/cnrg/linux. Project/resource/netstat. Cookbook. htm Network Layer 23

OSPF (Open Shortest Path First) r “open”: publicly available protocol (IETF) r uses the

OSPF (Open Shortest Path First) r “open”: publicly available protocol (IETF) r uses the Link State (LS) algorithm, i. e. , m LS packet dissemination; m topology map at each node; m route computation using the Dijkstra’s algorithm r OSPF advertisement carries one entry per neighbor router (gives link state) r Advertisements disseminated to the ENTIRE AS (via flooding) Network Layer 24

OSPF “advanced” features (not in RIP) r Security. All OSPF messages are authenticated (to

OSPF “advanced” features (not in RIP) r Security. All OSPF messages are authenticated (to prevent malicious intrusion); TCP connections used r Multiple same-cost paths allowed (only one path must be chosen to carry all traffic in RIP) r Multiple cost metrics for different TOS for each link (e. g. , satellite link cost set “low” for best effort; high for real time) r Integrated uni- and multicast support. Multicast OSPF (MOSPF) uses the same topology database as OSPF r Hierarchical OSPF in single AS (large routing domain) Network Layer 25

Hierarchical OSPF r An OSPF AS: Two level hierarchy (local area and backbone) m

Hierarchical OSPF r An OSPF AS: Two level hierarchy (local area and backbone) m m Link state advertisements do not leave respective areas Nodes in each area have detailed area topology; they only know direction (shortest path) to networks in other areas r “Internal routers” perform intra- AS routing only r “Area Border routers” route packets to other areas r “Backbone routers” run an OSPF routing alg. limited to the backbone r “Boundary routers” connect to other ASs Network Layer 26

IGRP (Interior Gateway Routing Protocol) r CISCO proprietary; successor of RIP (mid 80’s) r

IGRP (Interior Gateway Routing Protocol) r CISCO proprietary; successor of RIP (mid 80’s) r Distance Vector, like RIP r Several cost metrics (delay, bandwidth, reliability, load, etc. ) r Uses TCP to exchange routing updates r Routing tables exchanged only when costs change r Loop free routing achieved by using a Distributed Updating ALgorithm (DUAL) m In DUAL, after a distance increase, the routing table is frozen until all affected nodes have learned of the change r http: //www. cisco. com/en/US/tech/tk 365/technologies_white_p aper 09186 a 00800 c 8 ae 1. shtml Network Layer 27

Inter-AS Routing r BGP (Border Gateway Protocol): the de facto standard r Each Border

Inter-AS Routing r BGP (Border Gateway Protocol): the de facto standard r Each Border Gateway broadcasts to neighbors (peers) the entire path (i. e. , sequence of AS’s) to destination r For example, gateway X may store the following path to destination Z: Path (X, Z) = X, Y 1, Y 2, Y 3, …, Z Network Layer 28

Border Gateway Protocol (BGP) r Now, suppose Gwy X sends its path (X, Y

Border Gateway Protocol (BGP) r Now, suppose Gwy X sends its path (X, Y 1, Y 2, Y 3, …, Z) to peer Gwy W may or may not select the path offered by Gwy X, because of cost, policy or loop prevention reasons r If Gwy W selects the path advertised by Gwy X, then: Path (W, Z) = W, Path (X, Z) Note: path selection based not so much on cost (e. g. , # of AS hops), but mostly on administrative and policy issues (e. g. , do not route packets through competitor’s AS) Network Layer 29

Border Gateway Protocol (BGP) r Peers exchange BGP messages using TCP r BGP defines

Border Gateway Protocol (BGP) r Peers exchange BGP messages using TCP r BGP defines 4 types of messages: m OPEN: opens a TCP connection to peer and authenticates sender m UPDATE: advertises new path (or withdraws old) m KEEPALIVE: keeps connection alive in absence of UPDATES; also serves as ACK to an OPEN request m NOTIFICATION: reports errors in previous msg; also used to close a connection r IETF RFC 1771 - http: //www. ietf. org/rfc 1771. txt Network Layer 30

Why Intra- and Inter-AS routing different? (1/2) r Policy: m Inter: concerned with policies

Why Intra- and Inter-AS routing different? (1/2) r Policy: m Inter: concerned with policies (eg, which provider to select/avoid) m Intra: under same administrative control, so, policybased routing is less important r Scaleability m Inter: ability of routing alg. and table to scale for routing among large numbers of networks m Intra: scalability is less of a concern within an AS. A large AS can be divided into two ASs, e. g. , “areas” in OSPF Network Layer 31

Why Intra- and Inter-AS routing different? (2/2) r Performance: m Inter: routing is policy-oriented;

Why Intra- and Inter-AS routing different? (2/2) r Performance: m Inter: routing is policy-oriented; quality of routes is secondary. Also, it is difficult to propagate performance metrics efficiently (latency, privacy, etc. ). m Intra: focused on performance metrics; needs to keep costs low. r We need BOTH! Network Layer 32

Multicast Routing r Multicast: delivery of a packet to a group of receivers r

Multicast Routing r Multicast: delivery of a packet to a group of receivers r Multicasting is becoming increasingly popular in the Internet (e. g. , video on demand, IPTV, multi-player online games) r Multiple unicast vs. multicast Network Layer 33

Multicast Group Address r M-cast group address “delivered” to all receivers in the group

Multicast Group Address r M-cast group address “delivered” to all receivers in the group r Internet uses Class D (240. 0 to 247. 255) for m-cast r M-cast address distribution, etc. managed by IGMP (Internet Group Management Protocol) Network Layer 34

IGMP Protocol (RFC 2236) r IGMP (Internet Group Management Protocol) operates between router and

IGMP Protocol (RFC 2236) r IGMP (Internet Group Management Protocol) operates between router and local hosts, typically on a LAN r Router queries the local hosts for m-cast group membership info r Router “connects” active hosts to m-cast tree via m- cast protocol r Hosts respond with membership reports: actually, the first host which responds (at random) speaks for all r Host issues “leave-group” msg to leave; this is optional since router periodically polls anyway Network Layer 35

IGMP message types IGMP Message type membership query: general membership query: specific membership report

IGMP message types IGMP Message type membership query: general membership query: specific membership report leave group Sent by router Purpose query for current active multicast groups router query for specific m-cast group host wants to join group host leaves the group Network Layer 36

Summary You now hopefully have: r a good understanding of the Internet network protocols

Summary You now hopefully have: r a good understanding of the Internet network protocols and issues r IP addressing, format & issues r Intra-AS routing protocols r r r RIP OSPF IGRP r Inter-AS routing r BGP r Multicast routing r IGMP Network Layer 37