CS 457 – Lecture 10 Internetworking and IP Fall 2011
The Network layer • Transport layer: TCP, UDP • IP protocol • Routing protocols • addressing conventions • path selection • datagram format • RIP, OSPF, BGP • Network • packet handling conventions • layer Forwarding • ICMP protocol table • error reporting • router “signaling” • Link layer • physical layer
IP datagram format • IP protocol version • 32 bits • total datagram • number • length (bytes) • header length • type of • head. • ver • length • (bytes) • service • len • for • fragment • “type” of data • flgs • 16-bit identifier • fragmentation/ • offset • max number • upper • reassembly • time to • Internet • remaining hops • layer • live • checksum • (decremented at • 32 bit source IP address • each router) • 32 bit destination IP address • upper layer protocol • E.g. timestamp, • to deliver payload to • Options (if any) • record route • data • taken, specify • (variable length, • list of routers • typically a TCP • to visit. • or UDP segment)
IP Fragmentation & Reassembly • network links have MTU (max.transfer size) - largest possible link-level frame. – different link types, • fragmentation: different MTUs • in: one large datagram • large IP datagram divided • out: 3 smaller datagrams (“fragmented”) within net – one datagram becomes several datagrams • reassembly – “reassembled” only at final destination – IP header bits used to identify, order related fragments
IP Fragmentation and Reassembly Length ID Fragflag Offset =4000 =x =0 =0 • Example • 4000 byte • One large datagram becomes • several smaller datagrams datagram Fragflag Offset • MTU = 1500 Length ID =1 =0 =1500 =x bytes Fragflag Offset Length ID • 1480 bytes in =1 =185 =1500 =x data field • offset = Length ID Fragflag Offset • 1480/8 =1040 =x =0 =370
Addressing • Already have MAC layer addresses • Ethernet provides addresses • And so do other link layers • But can’t use Ethernet address at IP • Ethernet addresses are flat • Ethernet address assignment is not related to the network topology • Ethernet is not the only link layer!
IP Address (IPv4) • A unique 32-bit number (i.e., 4B addresses) • Identifies an interface (on a host, on a router, …) • Represented in dotted-quad notation 12 34 158 5 00001100 00100010 10011110 00000101
Scalability Challenge • Suppose hosts had arbitrary addresses – Then every router would need a lot of information – …to know how to direct packets toward the host 1.2.3.4 5.6.7.8 2.4.6.8 1.2.3.5 5.6.7.9 2.4.6.9 ... � • ... � host � host � host � host � host � host � LAN 2 � • LAN 1 � router � router � router � WAN � WAN � 1.2.3.4 1.2.3.5 forwarding table �
Grouping Related Hosts • The Internet is an “inter-network” – Used to connect networks together, not hosts – Needs a way to address a network (i.e., group of hosts) • ... � • ... � • host � • host � • host � • host � • host � • host � • LAN 2 � • LAN 1 � • router � • router � • router � • WAN � • WAN � • LAN = Local Area Network � • WAN = Wide Area Network �
Hierarchical Addressing: IP Prefixes • Divided into network & host portions (left and right) • 12.34.158.0/24 is a 24-bit prefix with 2 8 addresses – More on Hierarchy (CIDR) in next lectures 12 34 158 5 00001100 00100010 10011110 00000101 Network (24 bits) Host (8 bits)
IP Address and 24-bit Subnet Mask Address � 12 34 158 5 00001100 00100010 10011110 00000101 11111111 11111111 11111111 00000000 255 255 255 0 Mask �
Scalability Improved • Number related hosts from a common subnet – 1.2.3.0/24 on the left LAN – 5.6.7.0/24 on the right LAN 1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212 ... � ... � host � host � host � host � host � host � LAN 2 � LAN 1 � router � router � router � WAN � WAN � 1.2.3.0/24 5.6.7.0/24 • forwarding table �
Easy to Add New Hosts • No need to update the routers – E.g., adding a new host 5.6.7.213 on the right – Doesn’t require adding a new forwarding entry 1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212 ... � ... � host � host � host � host � host � host � LAN 2 � LAN 1 � router � router � router � host � WAN � WAN � 5.6.7.213 1.2.3.0/24 5.6.7.0/24 • forwarding table �
Avoiding Manual Configuration • Address Resolution Protocol (ARP) – Learn mapping between IP address and MAC address • Dynamic Host Configuration Protocol (DHCP) – End host learns IP address, DNS servers, and gateway ??? 1.2.3.7 1.2.3.156 ... � ... � host � DNS � host � DNS � host � host � 5.6.7.0/24 1.2.3.0/24 1.2.3.19 router � router � router �
Key Ideas in ARP and DHCP • Broadcasting: when in doubt, shout! – Broadcast query to all hosts in the local-area-network – … when you don’t know how to identify the right one • Caching: remember the past for a while – Store the information you learn to reduce overhead – Remember your own address & other host’s addresses • Soft state: eventually forget the past – Associate a time-to-live field with the information – … and either refresh or discard the information – Key for robustness in the face of unpredictable change
Broadcasting • Broadcasting: sending to everyone – Special destination address: FF-FF-FF-FF-FF-FF – All adapters on the LAN receive the packet • Delivering a broadcast packet – Easy on a “shared media” – Like shouting in a room – everyone can hear you – E.g., Ethernet, wireless, and satellite links
MAC Address vs. IP Address • MAC addresses – Hard-coded in read-only memory when adaptor is built – Like a social security number – Flat name space of 48 bits (e.g., 00-0E-9B-6E-49-76) – Portable, and can stay the same as the host moves – Used to get packet between interfaces on same network • IP addresses – Configured, or learned dynamically – Like a postal mailing address – Hierarchical name space of 32 bits (e.g., 12.178.66.9) – Not portable, and depends on where the host is attached – Used to get a packet to destination IP subnet
What’s Next • Read Chapter 1, 2, 3, and 4.1-4.3 • Next Lecture Topics from Chapter 4.2 and 4.3 – Routing • Homework – Due Thursday • Project 2 – You should be working on Project 2!
Recommend
More recommend