Transcript ICOM 6115

ICOM 6115 – Computer Networks
and the WWW
Manuel Rodriguez-Martinez, Ph.D.
Lecture 22
ICOM 6115
©Manuel Rodriguez-Martinez
Lecture Objectives
• Introduction to Global Internetworking
– Layer 3 – The Network Layer
• Store-and-Forward Service
– IP Protocol
• IP addressing
• ARP, ICMP
• DHCP
ICOM 6115
©Manuel Rodriguez-Martinez
IP Addresses
• Unique, Global identifier for a network card
– Machines with multiple card get multiple IPs
• e.g. routers
• IP address is a 32 bit number
– For simplicity, expressed in dotted-decimal
notation
• e.g. 128.34.5.92
Bits
32
128
ICOM 6115
34
0
5
©Manuel Rodriguez-Martinez
92
What are benefits of IP Addresses?
• Hierarchical structure
– Provide way to identify network and host
• Ethernet are flat
– Example: 135.134.9.20
• Host 20
• Network 135.134.9.0
• Routers need only to keep information
about network
– subnets
ICOM 6115
©Manuel Rodriguez-Martinez
IP Address Formats
ICOM 6115
©Manuel Rodriguez-Martinez
Special (Reserved) IP addresses
ICOM 6115
©Manuel Rodriguez-Martinez
Some Facts
• Class A addresses
– 7 bits for network, 24 bits for host
• 126 Class A network, with roughly 2^24 hosts
• Class B addresses
– 14 bits for network, 16 bits for host
• 64K hosts on a Class B network
• Class C addresses
– 21 bits for network, 8 bits for host
• 255 hosts a on a Class C network
ICOM 6115
©Manuel Rodriguez-Martinez
Issues: What’s in a forwarding table?
• A router cannot deal with 64K IP
addresses in a table
• Solution: Subnetting
– Use the host part to identify areas of the LAN
• Subnet
– All host on a given subnet share:
• Same network part of IP address
• Same subnet part of IP address
– Routers mainly store IP address of networks
and subnets
ICOM 6115
©Manuel Rodriguez-Martinez
Example a Campus with Subnets
ICOM 6115
©Manuel Rodriguez-Martinez
IP address with subnets
• MASK = Bit pattern that can be used to inspect certain bits
on a byte, word, or array of byte
• Subnet MASK – used to inspect the bits that indicate IP
Address of the subnet
Subnet mask is often written in dotted decimal notation
e.g. 255.255.252.0
Also written in terms of bit length: /22
ICOM 6115
©Manuel Rodriguez-Martinez
Examples
• Suppose we have the network address
– 130.50.0.0
• 10000010 00110010 00000000 00000000
• Let the subnet mask be: 255.255.252.0
• The structure of the mask is
• 11111111 11111111 11111100 00000000
• Subnets
• 130.50.4.0 - 11111111 11111111 00000100 00000000
• 130.50.8.0 - 11111111 11111111 00001000 00000000
• 130.50.12.0 - 11111111 11111111 00001100 00000000
ICOM 6115
©Manuel Rodriguez-Martinez
Sample LAN
ICOM 6115
©Manuel Rodriguez-Martinez
Forwarding Tables entries
ICOM 6115
SubnetNumber
SubnetMask
NextHop
128.96.34.0
255.255.255.128
Interface 0
128.96.34.128
255.255.255.128
Interface 1
128.96.33.0
255.255.255.0
R2
©Manuel Rodriguez-Martinez
Datagram forwarding Algorithm
D = destination IP address
For each entry I = (SubnetNumber,
SubnetMask,NextHop) in forwarding table T
D1 = MASK & D; // bitwise AND
if D1 == SubnetNumber
if NextHop is an interface
deliver datagram directly
else
deliver to nextHop router
ICOM 6115
©Manuel Rodriguez-Martinez
More examples
ICOM 6115
©Manuel Rodriguez-Martinez
Issue how to map: IP address to MAC
• ARP – Address Resolution Protocol
– Sender broadcast a message asking host with
IP X to reply with MAC address
• Cached for later
– Only that machine should reply
– Other host will see the message and react
• If they have MAC address of X in memory they will
refresh it
• Otherwise, they ignore it
ICOM 6115
©Manuel Rodriguez-Martinez
ARP Packet format
ICOM 6115
©Manuel Rodriguez-Martinez
Issue: IP addresses are scarce
• To most sites Class A and C are not
appropriate
– Too many hosts or too little
• Every body wants a Class B network
address
• Problem: Not enough IPs to go around
• Solutions
– IPv6
– NAT
ICOM 6115
©Manuel Rodriguez-Martinez
NAT: Network Address Translation
ICOM 6115
©Manuel Rodriguez-Martinez