240 likes | 396 Views
Network Layer. IS250 Spring 2010 chuang@ischool.berkeley.edu. HTTP, FTP, NNTP, SMTP,. telnet,. TCP, UDP. IP. Wi-Fi. Ethernet. FDDI, SONET. coax, twisted pair, fiber,. wireless,. Network Layer. Application (layer 7): specific to application need
E N D
Network Layer IS250 Spring 2010 chuang@ischool.berkeley.edu
HTTP, FTP, NNTP, SMTP, telnet, ... TCP, UDP IP Wi-Fi Ethernet FDDI, SONET coax, twisted pair, fiber, wireless, ... Network Layer • Application (layer 7): specific to application need • Transport (layer 4): end-to-end delivery, congestion and flow control • Network (layer 3): addressing, routing • Data Link (layer 2): framing, error detection • Physical (layer 1): bits (0/1), voltages, frequencies, wires, pins, … John Chuang
L3 Outline • Addressing: • Internet Protocol (IP): address notation; address allocation; address translation • Packet switching: • Routing: BGP, OSPF, RIP • Packet forwarding: IP fragmentation, TTL, … • Extensions: • IP Multicast; QoS; Mobile IP; IPSec; … • Evolution: • IPv6 John Chuang
Internet Protocol • Supports two main functions: • Addressing • Packet switching (routing) • Allows packets to traverse multiple networks • hence the term “inter-networking” • Delivers packet to specified destination host • Best effortservice model • deliver as reliably and as soon as it can John Chuang
Guarantee latency for packets that are delivered Guarantee delivery, or notify source host if packet is not delivered Guarantee order of delivery Guarantee integrity of packet payload Maintain conversational context (each packet is independent) Specify process that should receive the packet at destination host IP Does Not: John Chuang
“Definition” of the Internet "Internet" refers to the global information system that -- • (i) is logically linked together by a globally unique address space based on the Internet Protocol (IP) or its subsequent extensions/follow-ons; • (ii) is able to support communications using the Transmission Control Protocol/Internet Protocol (TCP/IP) suite or its subsequent extensions/follow-ons, and/or other IP-compatible protocols; and • (iii) provides, uses or makes accessible, either publicly or privately, high level services layered on the communications and related infrastructure described herein. Resolution passed by the Federal Networking Council (FNC) October 24, 1995 John Chuang
IP Address • An IP address identifies a network interface, i.e., a connection between a computer and a network, not a specific computer. • A computer with multiple network interfaces (e.g., a router) must be assigned one IP address for each interface. • IP (version 4) addresses are 32 bits long • 232 = 4,294,967,296 unique IPv4 addresses • IPv6 addresses are 128 bits long • 2128 = 340,282,366,920,938,463,463,374,607,431,768,211,455 = 3.4*10^38 unique IPv6 addresses John Chuang
Dotted Decimal Notation • Represent each byte (8 bits) in decimal separated by dots 128 32 226 87 • Hostname: www.ischool.berkeley.edu • IP address: 128.32.226.87 0 8 16 24 31 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 1 0 1 1 1 Domain Name Service (DNS) performs translation John Chuang
Example of Dotted Decimal Notation • Four decimal values per 32-bit address • Each decimal number • Represents eight bits • Is between 0 and 255 John Chuang
IP Address • Divided into two parts • Prefix identifies network • Suffix identifies host • Global authority (IANA) assigns unique prefix to network • Local administrator assigns unique suffix to host John Chuang
Illustration of Router Addresses • Routers usually have multiple IP addresses • One address needed for each network interface • Address prefix identifies network John Chuang
Special Addresses (Reserved) John Chuang
Original Classes of Addresses • Initial bits determine class • Class determines boundary between prefix and suffix John Chuang
IP Addresses John Chuang
Classful Addresses and Network Sizes • Maximum network size determined by class of address • Class A large (mostly assigned or reserved) • Class B medium (mostly assigned) • Class C small John Chuang
IP Address Exhaustion • 32 bit address space not enough • Exacerbated by inefficient allocation of addresses • Several approaches to deal with problem: • Increase IP address length (IPv6) • Overcome inefficient address allocation • Subnetting • Classless inter-domain routing (CIDR) • Allow sharing of addresses • Network Address Translation (NAT) • Dynamic Address Allocation (DHCP) John Chuang
Subnetting • Problem: • Class A and class B address blocks have too many host ID’s allocated (tremendous waste of addresses) • Can we support multiple physical networks (subnets) within a single class A or class B address block? • Solution: External routing based on Network ID Internal routing based on Subnet ID • Significantly reduces the number of entries required in Internet routing tables. John Chuang
16 16 Network ID Host ID 8 8 Subnet ID Host ID Subnetting • Host ID portion is divided into subnet ID and host ID • Routers and hosts use a subnet mask to separate the subnet id from the host id. • Example: supporting 256 subnets within a class B network IP address (Class B) 16 8 8 IP address (Class B) Network ID Subnet ID Host ID 24 8 Subnet mask (255.255.255.0) 111111111111111111111111 00000000 John Chuang
Example: Router Operation with Subnet Mask Internet • Router R: • Receives incoming IP packet (128.32.226.87) • Applies subnet mask (255.255.255.0) via logical AND operation • Gets result (128.32.226.0) • Also applies subnet mask to its own addresses (one on each subnet) • Gets: 128.32.1.0, 128.32.226.0 • There is a match (128.32.226.0) • Router delivers to host on that network 128.32.0.1 R 128.32.226.1 128.32.1.1 128.32.1.0 128.32.226.0 128.32.1.87 128.32.226.87 128.32.0.0 John Chuang
Classless Inter-Domain Routing (CIDR) • Drops notion of fixed classes • Represent network address as: <address/prefix_size> • E.g., 65.0.0.0/8 or simply 65/8; 192.1.2.0/22 • Prefix_size is length of “network id” field (in bits) • CIDR allows arbitrary prefix size • Each network can be as large or small as needed (power of two) • Backward-compatible with network classes: • Class A networks have prefix size of 8 • Class B networks have prefix size 16 • Class C networks have prefix size 24 John Chuang
CIDR Example • Combining four class C networks • 192.1.4.0/24 • 192.1.5.0/24 • 192.1.6.0/24 • 192.1.7.0/24 • First two can be combined as: 192.1.4.0/23 • Last two can be combined as: 192.1.6.0/23 • All four can be combined as: 192.1.4.0/22 John Chuang
Network Address Translation • Network Address Translators (NATs) allow multiple hosts within a local network to share a single IP address • From outside perspective, the network appears as a single end host • Can use arbitrary IP address scheme within network • Typically: 10.0.0.0 or 192.168.0.0 • Most common implementation is actually Network Address and Port Translation (NAPT) • Maps internal <address, port> to external <address, port> where ports are transport layer (Layer 4) addresses • Incorporated into most residential gateway routers today • Controversial because it violates layering principle John Chuang
NAT Example: Outbound Source: David Maltz John Chuang
NAT Example: Inbound Source: David Maltz John Chuang