Introduction to Networks CSEN 404 Introduction to Networks Amr El Mougy Ali Saudi ** Slides are attributed to J. F. Kurose
Network layer transport segment from sending to receiving host application transport network data link physical network data link physical transport segment from sending to receiving host on sending side encapsulates segments into datagrams on receiving side, delivers segments to transport layer network layer protocols in every host, router router examines header fields in all IP datagrams passing through it application transport network data link physical Network Layer
Datagram networks no call setup at network layer routers: no state about end-to-end connections no network-level concept of “connection” packets forwarded using destination host address packets between same source-dest pair may take different paths application transport network data link physical application transport network data link physical 1. Send data 2. Receive data Network Layer
Two Key Network-Layer Functions forwarding: move packets from router’s input to appropriate router output routing: determine route taken by packets from source to dest. routing algorithms analogy: routing: process of planning trip from source to dest forwarding: process of getting through single interchange Network Layer
Forwarding in Datagram Networks Forwarding is based on a table of destination addresses at the routers IP addresses are 32-bits
Host, router network layer functions Transport layer: TCP, UDP IP protocol addressing conventions datagram format packet handling conventions Routing protocols path selection RIP, OSPF, BGP Network layer forwarding table ICMP protocol error reporting router “signaling” Link layer physical layer Network Layer
32 bit destination IP address IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live 32 bit source IP address IP protocol version number header length (bytes) max number remaining hops (decremented at each router) for fragmentation/ reassembly total datagram length (bytes) upper layer protocol to deliver payload to head. len type of service “type” of data flgs fragment offset upper layer 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. how much overhead with TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead Network Layer
IP Addressing: introduction IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link router’s typically have multiple interfaces host typically has one interface IP addresses associated with each interface 223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.2.2 223.1.1.3 223.1.3.27 223.1.3.1 223.1.3.2 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1 Network Layer
Subnets IP address: What’s a subnet ? subnet subnet part (high order bits) host part (low order bits) What’s a subnet ? device interfaces with same subnet part of IP address can physically reach each other without intervening router 223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.2.2 223.1.1.3 223.1.3.27 subnet 223.1.3.1 223.1.3.2 network consisting of 3 subnets Network Layer
Subnets 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 Recipe To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet. Subnet mask: /24 Network Layer
Subnets 223.1.1.2 223.1.1.1 223.1.1.4 How many? 223.1.1.3 223.1.9.2 223.1.7.0 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 Network Layer
IP addressing: CIDR CIDR: Classless InterDomain Routing subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in subnet portion of address 11001000 00010111 00010000 00000000 subnet part host 200.23.16.0/23
Original IPv4 Address Classes 32 bits (4 bytes) unique value for each host Address composed of 2 parts (2-level hierarchy): Prefix(network ID): identifies network to which host attaches Suffix(host ID): identifies host on that network
Special IP Addresses All 1’s: All 0’s: Broadcast address for same network as source All 0’s: Used for IP address assignment
Subnetting A class B address is divided into two parts: network part and local part Local part is further divided locally into: subnet and host parts Splitting is done internally, yet looks like a single network to the outside world Network
Subnet Mask Subnet mask needed to differentiate between different subnets Allows hosts to determine if another IP address is on the same subnet or the same network 1’s represent network part, 0’s represent host part
Classful addressing: Good or Bad? Pros: simple, easy to understand self-identifying Can determine boundary between prefix and suffix from the address itself No additional state needed to store boundary information Cons: limited address space 2^32 = 4G addresses, not enough? limited network size choices (3) Ex.: what if a class C net needs to grow beyond 255 hosts? moving to a new network requires changing IP address
Example An organization has 7 LANs as shown in the figure. The organization has a network address 193.166.124.x. Determine: The network address for each LAN. The IP addresses of the hosts (H1H6) and the routers shown in the figure. Note that LAN 7 has no hosts but requires IP addresses. The maximum number of hosts that can be connected to each of the first 6 LANs (LAN1 LAN 6).
Q6: Solution 7 networks 3 subnet bits and 5 host bits. Network address LAN 1: 193.166.124.32 LAN 2: 193.166.124.64 LAN 3: 193.166.124.96 LAN 4: 193.166.124.128 LAN 5: 193.166.124.160 LAN 6: 193.166.124.192 LAN 7: 193.166.124.224 Host address LAN 1: 193.166.124.1, 193.166.124.34 LAN 2: 193.166.124.33, 193.166.124.66 LAN 3: 193.166.124.65, 193.166.124.98 LAN 4: 193.166.124.97, 193.166.124.130 LAN 5: 193.166.124.129, 193.166.124.162 LAN 6: 193.166.124.161, 193.166.124.194 LAN 7: 193.166.124.193, 193.166.124.227 Number of hosts 2^5 = 32 -2 = 30 Transport Layer
IP addresses: how to get one? Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->network->configuration->tcp/ip- >properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server “plug-and-play”
Dynamic Host Configuration Protocol Host sends DHCP discovery using 0.0.0.0 as src IP and 255.255.255.255 as dest IP The DHCP server port number is 67 Server responds with an address offer yiaddr = 223.1.2.4 If the client accepts, then a Request/Ack transaction will follow