270 likes | 417 Views
NETWORKING (2). We have LANs an WLANs, what are these “nodes” that connect them?. Hubs – connect a LAN to another LAN Simply repeat packet Highest layer: data link layer Bridges – connect different types of networks
E N D
We have LANs an WLANs, what are these“nodes” that connect them? • Hubs – connect a LAN to another LAN • Simply repeat packet • Highest layer: data link layer • Bridges – connect different types of networks • Translate a packet from one format into another, e.g., ethernet to optical (FDDI) • Highest layer: data link layer (multiple) • Switches – connect and route between two LANs • Routing algorithms • Highest layer: network layer • Routers – connect and route between two networks • Routing algorithms • Highest layer: network layer • Tunneling – encapsulate and send an unimplemented protocol’s packets through from network layer to network layer • IPv6 packets can be tunneled through the IPv4 network
How do peer layers talk? MAC/Data Link layer – match the MAC addresses (48 bits) Network Layer – e.g., IP match the IP address (32 bits) Transport Layer – e.g., TCP: match the port number (8 bits) Application Application message Transport port TCP header Network TCP IP header MAC Ethernet header IP Ethernet frame
Who discovers these addresses forthe destination? • Port number – from the IP address (+ a standard port number) • IP address – from the resource name/URL (through the DNS) • Ethernet address – from the IP address (through ARP)
Address Resolution between IP and Underlying Networks • Most hosts are attached to a LAN by an interface board that only understands LAN addresses. For example, every Ethernet board is equipped with a 48-bit Ethernet address. • The boards send and receive frames based on 48-bit Ethernet addresses. They know nothing about the 32-bit IP addresses. • Address Resolution Protocol (ARP) maps the IP addresses onto data link layer addresses (e.g., Ethernet).
ARP Example Routers have multiple network Interface cards/devices
ARP • Suppose host 1’s IP layer (192.31.65.7) gets a packet from its transport layer destined for • 192.31.65.5 (host 2)? • Host 1’s IP layer broadcasts an ARP packet onto the Ethernet asking: • ``Who owns IP address 192.31.65.5?'' • Host 2 responds with its Ethernet address (E2). • The IP layer on host 1 builds an Ethernet frame addressed to E2, puts the IP packet • in the payload field, and transmits it on the Ethernet. • The Ethernet board of host 2 detects this frame and causes an interrupt, to deliver the packet to • the IP layer on host 2. • Thus, the packet is transmitted from host 1’s IP layer to host 2’s IP layer
ARP • The performance of ARP can be improved by caching the broadcast results. • Host 1 can include its IP to Ethernet mapping the ARP packet.
ARP • Suppose host 1’s IP layer (192.31.65.7) gets a packet from its transport layer with • destination address set to 192.31.63.8 (host 4)? • Host 1’s IP layer broadcasts an ARP packet onto the Ethernet asking: • ``Who owns IP address 192.31.63.8?'' • Router F1 responds with its Ethernet address (E3). • The IP layer on host 1 transmits an Ethernet frame addressed to F1 • The E3 Ethernet board of router F1 receives the frame and delivers it to the IP layer on F1 • F1’s IP layer knows from the destination address of 192.31.63.8 in the packet that it has to • be next sent to 192.31.60.7 (router F3). • F1’s IP layer sends an ARP on the FDDI ring for IP address 192.31.60.7 (router F3). • F3 replies. • F1’s IP layer transmits an FDDI frame (containing the packet) addressed to F3 • The FDDI board of F3 receives the frame, and delivers it to the IP layer. • F3 knows from the destination address of 192.31.63.8 in the packet that it has to • be next sent out on the interface 192.31.63.3 • F3 does an ARP on the EE Ethernet for IP address 192.31.63.8 • Host 4 responds with E6 • F3 transmits the packet inside an Ethernet frame addressed to E6, and it reaches host 4’s IP layer
Address Assignment • Static • Dynamic: DHCP • RFC 2131 • Broadcasts a DHCP Discovery • Servers respond with DHCP Offer • Client accepts one and sends DHCP Request • Assigning server sends DHCP Acknowledgement • Other servers release address back into pool
Zero Configuration (RFC 3927) • Does not require a DHCP address • Each host selects a random IP address from the range 169.254.1.0 to 169.254.254.255 • On starting a new connection, a host probes to ensure that no duplicate addresses share the same local subnet • Hosts can defend their addresses using ARP • ZeroConf addresses are link-local • Service discovery through mDNS/DNS-SD or uPNP
“Knows” – How? • Routing Algorithms! • In the Network layer
Routing Algorithms • Programmed in the network layer • determine the next hop given the destination IP address • determine the route for each packet as it travels through the net • dynamically update routing information to reflect congestion, changes and failures. • Two approaches: • link-state (e.g., OSPF) • Every node knows status of each “link” in the network • distance-vector (e.g., RIP) • Every node knows the next-hop for each possible LAN Information maintained as a table Tables updated either • Proactively – periodically, or • Reactively – when a neighbor link status changes
Distance Vector Routing • Also termed as distributed Bellman-Ford algorithm or Ford-Fulkerson algorithm, included in RIP (routing information protocol), AppleTalk, and Cisco routers. • Each router maintains a table indexed by each router in the subnet and giving the best known distance to each router and which link to use next to get there. • Once every T seconds each router sends to each neighbor the table.
Normal Distance Vector Routing • In normal Distance Vector routing, each node maintains a routing table: Example table at A: A B C D
Normal Distance Vector Routing • Computed using Distributed Bellman-Ford: • Each node periodically broadcasts routing table • For each routing table entry received, compare best known route with newinformation To D: 3 hops via B E 2 X X A B C D E D is 1 hop away
Routers 1 B 2 A C 4 3 5 E D 6 Hosts or LANs To Link Cost A 1 1 C 2 1 D 4 2 E 4 1 B local Distance Vector Routing Routing Table for A Routing Table for B To Link Cost B 1 1 C 1 2 D 3 1 E 1 2 A local To Link Cost A 2 2 B 2 1 D 5 2 E 5 1 C local Routing Table for C
Pseudo-Code for RIP • Send: Each t seconds or when Tl changes, send Tl on each non-faulty outgoing link. • Receive: Whenever a routing table Tr is received on link n: • for all rows Rr in Tr { • if (Rr.link not equal n) { • Rr.cost = Rr.cost + 1; • Rr.link = n; • if (Rr.destination is not in Tl) add Rr to Tl; • // add new destination to Tl • else for all rows Rl in Tl { • if (Rr.destination = Rl.destination and • (Rr.cost < Rl.cost or Rl.link = n)) Rl = Rr; • //Rr.cost < Rl.cost : remote node has better route • // Rl.link = n : remote node is more authoritative • } • } • }
Link State Routing • Each router must • Discover the neighbors and learn their network addresses • When a router is booted, it learns who its neighbors are by sending a special Hello packet on each point-to-point link. • The router on the other end sends back a reply. • Measure the delay or cost to each of its neighbors • A router sends a special Echo packet over the link that the other end sends back immediately. By measuring the round-trip time, the sending router gets a reasonable delay estimate. • Construct a packet telling all it has just learned.
Link State Routing • A router broadcasts a link-state-advertisement (LSA) packet periodically or upon topology change.
Link State Routing • Broadcast the LSA packet to all other routers in the subnet. • Each packet contains a sequence number that is incremented for each new LSA packet sent. • Each router keeps track of all the (source router, sequence) pairs it sees. When a new LSA packet comes in, it is checked against the pairs. If the new packet is new, it is forwarded on all the links except the one it arrived on. • The age of each packet is included and is decremented once per time unit. When the age hits zero, the information is discarded. • Compute the shortest path to every other router with Dijkstra’s algorithm.
Internet Routing Internet routers communicate using the Border Gateway Protocol (BGP): • Destinations are prefixes: • Example: 128.2.0.0/16 (CMU) • Routes go through ISPs (Autonomous Systems) • Each ISP is uniquely identified by a number: • Example: 25 (UC Berkeley) • Each route includes a list of traversed ISPs: • Example route from UC Berkeley to CMU:9 ← 5050 ← 11537 ← 2153 ←
Sample BGP Routing Table • Routing table at a UC Berkeley router:
Sample Operation of BGP • Routing table at a UC Berkeley router: A
Routings from A Routings from B Routings from C To Link Cost To Link Cost To Link Cost A local 0 A 1 1 A 2 2 B 1 1 B local 0 B 2 1 C 1 2 C 2 1 C local 0 D 3 1 D 1 2 D 5 2 E 1 2 E 4 1 E 5 1 Routings from D Routings from E To Link Cost To Link Cost A 3 1 A 4 2 B 3 2 B 4 1 C 6 2 C 5 1 D local 0 D 6 1 E 6 1 E local 0 Routing Tables