Computer Networks IP and Routing
Network Interconnections Data Link Layer Delivery of frames on the same LAN Extend reach using switches/bridges and hubs Limitations Solution? Cannot address heterogeniety Ethernet, Token ring, FDDI, PPP, HDLC, ATM... Broadcast food Managing all nodes as single network is not scalable Internet Interconnect diferent networks
Internet Protocol (IP) Layer 3 of TCP/IP stack (Internet Layer) Heterogenity Common network layer (IP) irrespective of layer 2 Best-efort service model Scalability Packets can get lost, delayed, duplicated, dropped Assumes any DLL underneath (homework: check RFC 1149) Hierarchical addressing Efcient Routing between routing elements
The Internet Network Layer Image source: Kameswari, CS348 Spring 2009
IP Datagram Format Image source: Kameswari, CS348 Spring 2009
IP Fragmentation and Reassembly MTUs of diferent network links are diferent MTU: maximum transmission unit Ethernet 1500 bytes Token Ring 4500 bytes Solution for Layer 3 datagrams?... Fragmentation + Reassembly
IP Fragmentation and Reassembly One to many Reassembly at destination Use of bits in header
Fragmentation Example Ofset is mod 8 Fragmentation on 8-byte boundaries
Addressing Each host has a layer 3 (IP) address Why? Hosts already have layer 2 addresses... 48-bit Ethernet MAC address Address space Flat addressing N nodes N addresses Hierarchical addressing advantage?
IP Addressing 32-bit address Consists of two parts Network Host Network on which a host is connected Unique id of host on a network Mask Unique bits that determine a network
Address Classes Diferent classes of networks (addresses) Class A: 0, network (7), host (24) Class B: 10, network (14), host (16) Class C: 110, network (21), host (8) Class D: 1110, 28 bits (group) Class E: 1111, 28 bits (reserved) Private addresses Class A: 10.0.0.0 through 10.255.255.255 Class B: 172.16.0.0 to 172.31.0.0 Class C: 192.168.0.0 to 192.168.255.0 127.0.0.1: loopback address
Address Classes Diferent classes of networks (addresses) Class A: 0, network (7), host (24) Class B: 10, network (14), host (16) Class C: 110, network (21), host (8) Class D: 1110, 28 bits (group) Class E: 1111, 28 bits (reserved)
Example: Class C Networks
Datagram Forwarding/Routing Every datagram consists of src, dest IP addr. With network and host info Network part uniquely identifes on Internet All hosts that share network part are connected to same physical network Router: on the edge of the network Connects at least two networks
Action at Router If (matching network address) on any interface Deliver packet to destination on network If network address in routing table Deliver packet to NextHop router Else Deliver packet to default router
Action at Host If src and dest have same network address Deliver packet directly Both hosts on same network Else Deliver packet to default router
Addressing+Packet Delivery At Layer 3 <src, dest, data> Sent to lower layer (DLL) What does DLL do next?...
ARP ARP: Address Resolution Protocol DLL service IP to MAC address mapping
ARP ARP: Address Resolution Protocol DLL service IP to MAC address mapping Protocol (broadcast based) Broadcast query with target IP address Host with IP address responds Host maintains ARP cache IP:Mac cache Times out after a fnite time (15 secs)
ARP Protocol Details ARP frame format Transmitted as Ethernet Payload Ethernet type set to ARP
How to get an IP address?
IP Address Confguration Manual Ad-hoc Issues? DHCP Dynamic Host Confguration Protocol Auto on-demand IP lease Plug-n-play Application-layer protocol
DHCP Advantages Central repository of IP addresses Can reuse Lease time adds efciency Use MAC-flter to allocate IPs No IP for unverifed hosts (users)
ICMP Internet Control Message Protocol Layer 3 communication for Error reporting Echo request/reply (router heartbeats) ICMP above IP layer ICMP packets carried as IP Payload Service feld in IP set to ICMP ICMP packets contain Type, code 8 bytes of IP packet responsible for ICMP message
ICMP Types and Codes
ICMP Usage Examples Ping Send an ICMP message with type=8 and code=0 ICMP echo request Destination host (if up) Responds to echo with response Type=0, Code=0 (for icmp message) Can also measure time for echo request-response Gives estimate of delay on network
Traceroute Program to determine route from source to destination Exploits the TTL feld On TTL expiry, router sends an ICMP message to host
Re-look at IP Address Space Is 32-bit enough? 4 billion hosts, how many networks? Are class categories optimal? Network with 2 hosts (Class C) Network with 256 hosts (Class B)
Re-look at IP Address Space One network: one network id + host range At router: one entry per network If same ISP has 200 Class C addresses?
Subnetting Subnet: sub-network in a network 3-level hierarchy instead of 2 Subnet number/mask for each subnet is same Host: IP address + Subnet mask
CIDR Classless Inter-domain Routing Abolishes class-based categorization
CIDR Classless Inter-domain Routing Abolishes class-based categorization Balance address usage efciency and routing table entries /X notation specify number of bits for network 2 to 32 bits 128.112.128/21 ISP can subdivide Longest-prefx match rule
Network Address Translation (NAT)
NAT in Action
NAT Debats +ves -ves
NAT Debate +ves Do not need address range from ISP Can change local IP distribution scheme easily Can change ISP easily No direct IP for nodes behind frewall (security) -ves No direct IP for nodes behind frewall Breaks end-to-end argument Port is for process, not for host IPv6