Chuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạngChuyên đề mạng thế hệ mới mạng
Trang 1Prométhée Spathis
promethee.spathis@{lip6,upmc}.fr http://www-rp.lip6.fr/~spathis/
What is Addressing?
• Providing suitable identifiers to nodes
– So you can direct data to a node
– So you know which node sent the data– … and how to send data back to that node
• Addressing in the French mail
Trang 2What is Routing?
• A famous quotation from RFC 791
“A name indicates what we seek.
An address indicates where it is.
A route indicates how we get there.”
Jon Postel
5
Forwarding vs Routing
– Directing a data packet to an outgoing link
– Individual router using a forwarding table
– Computing paths the packets will follow – Routers talking amongst themselves
– Individual router creating a forwarding
table
Trang 3• Use of network resources
– Balance of the traffic over the routers and links– Avoiding congestion by directing traffic to lightly-loaded links
• Transient disruptions during changes
– Failures, maintenance, and load balancing
– Limiting packet loss and delay during changes
Overview of Today’s Lecture
• Two widely-used addressing schemes
– Medium Access Control (MAC) addresses
– Internet Protocol (IP) addresses
• Key concepts in addressing
– Number of unique addresses
– Allocating addresses to nodes
– Flat vs hierarchical structure
– Persistent vs temporary identifiers
– Handling diminishing address space
Trang 4Some Questions
• Could every host on the Internet have an
arbitrary, unique numerical address?
– Would it scale?
• If hierarchy is necessary, how to do it?
– Tying the addressing to the topology & routing?– What about mobile hosts? Temporary addresses?
• Who should allocate the addresses?
– Network provider? Device manufacturer?
• Does the sender of the traffic need to
authenticate itself? The destination?
– What about spoofing and impersonation?
Comparing MAC and IP Addresses
Assignment Hard-coded in
the adaptor Configured or learnedSize 48 bits 32 bits (in v4)
Portability Constant over life
of the adapter Changes with time and location
Purpose Delivery within a
single network Delivery across an inter-network
E.g., social security number vs postal address
Trang 5MAC Addresses
MAC Addresses
• Flat name space of 48 bits
– Typically written in six octets in hex
– E.g., 00-15-C5-49-04-A9 for my Ethernet
• Organizationally unique identifier
– Assigned by IEEE Registration Authority – Determines the first 24 bits of the address – E.g., 00-15-C5 corresponds to “SONY VAIO”
• Remainder of the MAC address
– Allocated by the manufacturer
Trang 6Scalability Challenges
• MAC addresses are flat
– Multiple hosts on the same network
– No relationship between MAC addresses
• Data plane
– Forwarding based on MAC address
– Table size? Look-up overhead?
• Control plane
– Determining where the host is located
– Keeping the information up-to-date
Forwarding Frames to Destination Adapter
• Shared media
– Forward all frames on the shared media
– Adapter grabs frames with matching dest address
• Multi-hop switched networks
– Flood every frame over every link?
– Learn where the MAC address is located?
host host host
host host host host
Trang 7When to Learn?
• When the adapter connects to the network?
– Requires adaptor to register its presence
– Overhead even when not sending/receiving
– Leading to control messages and large tables
• When the adapter sends a frame?
– Source MAC address is in the frame
– Allows switch to learn about the adapter
• When the adapter needs to receive a frame?
– Destination MAC address is in the frame
– Switch needs to figure out how to get there
Motivation For Self Learning
• Switches forward frames selectively
– Forward frames only on segments that need them
• Switch table
– Maps dest MAC address to outgoing interface
– Goal: construct the switch table automatically
switch
A
B
C
Trang 8Self Learning: Building the Table
• When a frame arrives
– Inspect the source MAC address
– Associate the address with the incoming interface
– Store the mapping in the switch table
– Use a TTL field to eventually forget the mapping
Self Learning: Handling Misses
• When frame arrives with unfamiliar dest
– Forward the frame out all of the interfaces
– … except for the one where the frame arrived– Hopefully, this case won’t happen very often
Trang 9Switch Filtering/Forwarding
When switch receives a frame:
index switch table using MAC dest address
if entry found for destination
then {
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood forward on all but the interface
on which the frame arrived
Flooding Can Lead to Loops
• Switches sometimes need to broadcast frames
– Upon receiving a frame with an unfamiliar destination – Upon receiving a frame sent to the broadcast address
• Broadcasting is implemented by flooding
– Transmitting frame out every interface
– … except the one where the frame arrived
• Flooding can lead to forwarding loops
– E.g., if the network contains a cycle of switches
– Either accidentally, or by design for higher reliability
Trang 10Solution: Spanning Trees
• Ensure the topology has no loops
– Avoid using some of the links when flooding
– … to avoid forming a loop
Constructing a Spanning Tree
• Need a distributed algorithm
– Switches cooperate to build the spanning tree
– … and adapt automatically when failures occur
• Key ingredients of the algorithm
– Switches need to elect a “root”
• The switch with the smallest identifier
– Each switch identifies if its interface
is on the shortest path from the root
• And it exclude from the tree if not
– Messages (Y, d, X)
• From node X
• Claiming Y is the root
• And the distance is d
root
One hop
Three hops
Trang 11Steps in Spanning Tree Algorithm
• Initially, each switch thinks it is the root
– Switch sends a message out every interface
– … identifying itself as the root with distance 0
– Example: switch X announces (X, 0, X)
• Switches update their view of the root
– Upon receiving a message, check the root id
– If the new id is smaller, start viewing that switch as root
• Switches compute their distance from the root
– Add 1 to the distance received from a neighbor
– Identify interfaces not on a shortest path to the root – … and exclude them from the spanning tree
Example From Switch #4’s Viewpoint
• Switch #4 thinks it is the root
– Sends (4, 0, 4) message to 2 and 7
• Then, switch #4 hears from #2
– Receives (2, 0, 2) message from 2
– … and thinks that #2 is the root
– And realizes it is just one hop away
• Then, switch #4 hears from #7
– Receives (2, 1, 7) from 7
– And realizes this is a longer path
– So, prefers its own one-hop path
– And removes 4-7 link from the tree
Trang 12Example From Switch #4’s Viewpoint
• Switch #2 hears about switch #1
– Switch 2 hears (1, 1, 3) from 3
– Switch 2 starts treating 1 as root
– And sends (1, 2, 2) to neighbors
• Switch #4 hears from switch #2
– Switch 4 starts treating 1 as root
– And sends (1, 3, 4) to neighbors
• Switch #4 hears from switch #7
– Switch 4 receives (1, 3, 7) from 7
– And realizes this is a longer path
– So, prefers its own three-hop path
– And removes 4-7 Iink from the tree
1
234
5
67
26
Robust Spanning Tree Algorithm
• Algorithm must react to failures
– Failure of the root node
• Need to elect a new root, with the next lowest identifier
– Failure of other switches and links
• Need to recompute the spanning tree
• Root switch continues sending messages
– Periodically reannouncing itself as the root (1, 0, 1) – Other switches continue forwarding messages
• Detecting failures through timeout (soft state!)
– Switch waits to hear from others
– Eventually times out and claims to be the root
Trang 13MAC Addresses
• Disadvantages
– Large forwarding tables in the data plane
– Flooding overhead to learn location information– Lack of privacy
• Advantages
– Persistent identifier (well, except for spoofing)– Mobile hosts are easy to handle
– Forwarding-table look-up is a simple match
Christian: Internet Control Protocols
• Dynamic Host Configuration Protocol (DHCP)
– End host learns how to send packets
– Learn IP address, DNS servers, and gateway
• Address Resolution Protocol (ARP)
– Others learn how to send packets to the end host– Learn mapping between IP and MAC addresses
host host DNS host host DNS
1.2.3.7 1.2.3.156
???
Trang 14Christian: Hubs and Switches
• Different devices switch different things
– Physical layer: electrical signals (repeaters, hubs)– Link layer: frames (bridges, switches)
– Network layer: packets (routers)
• Key ideas in switches
– Self learning of the switch table
User data
Application gateway Transport gateway Router Bridge, switch Repeater, hub
IP Addresses
Trang 15IP Addressing: Scalability Through Hierarchy
• Hierarchy through IP prefixes
– Routing between networks
– Allocation of address blocks
• Non-uniform hierarchy
– More efficient address allocation
– More complex packet forwarding
• Dealing with limited address space
– Larger address space (IPv6 with 128 bits)
– Sharing a small set of addresses (NAT)
– Dynamic assignment of addresses (DHCP)
Grouping Related Hosts
• The Internet is an “inter-network”
– Used to connect networks together, not hosts
– Needs a way to address a group of hosts
host host host
LAN 1
LAN 2
router router router
Trang 16Scalability Challenge
• Suppose hosts had arbitrary IP addresses
– Then every router would need a lot of information– …to know how to direct packets toward the host
host host host
LAN 1
LAN 2
router router router
Hierarchy Through Prefixes
• Divided into network and host portions
• 12.34.158.0/24 is 24-bit prefix (28 addresses)
00001100 00100010 10011110 00000101
Network (24 bits) Host (8 bits)
Trang 17Example IP Address and Subnet Mask
• 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
host host host
LAN 1
LAN 2
router router router
1.2.3.4 1.2.3.7 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.212
1.2.3.0/24
5.6.7.0/24
Trang 18Easy 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
host host host
LAN 1
LAN 2
router router router
Classful Addressing (and Dotted Quad Notation)
• In the olden days…
• Reserved for future use (sounds a bit scary…)
• And then, address space became scarce…
Trang 19Classless Inter-Domain Routing (CIDR)
Use two 32-bit numbers to represent a network
Network number = IP address + Mask
12.3.0.0/24 12.3.1.0/24 : : 12.3.254.0/24 12.253.0.0/19 12.253.32.0/19 12.253.64.0/19 12.253.96.0/19 12.253.128.0/19
: : :
• Prefixes are key to Internet scalability
– Routing protocols and packet forwarding based on prefixes – Today, routing tables contain ~150,000-200,000 prefixes
Trang 21Scalability Through Hierarchy
• Hierarchical addressing
– Critical for scalable system
– Don’t require everyone to know everyone else
– Reduces amount of updating when something changes
• Non-uniform hierarchy
– Useful for heterogeneous networks of different sizes
– Initial class-based addressing was far too coarse
– Classless InterDomain Routing (CIDR) helps
• Next few slides
– Plots are # of prefixes vs time
Pre-CIDR (1988-1994): Steep Growth
Trang 22Efforts to aggregate (even decreases after IETF meetings!)
46
Good use of aggregation, and peer pressure in CIDR report
Trang 2347 Internet boom and increased multi-homing
Boom Period (1998-2001): Steep Growth
Trang 24Obtaining a Block of Addresses
• Separation of control
– Prefix: assigned to an institution
– Addresses: assigned to nodes by the institution
• Who assigns prefixes?
– Internet Corp for Assigned Names and Numbers
• Allocates large blocks to Regional Internet Registries
– Regional Internet Registries (RIRs)
• E.g., ARIN (American Registry for Internet Numbers)
• Allocated to ISPs and large institutions in a region
– Internet Service Providers (ISPs)
• Allocate address blocks to their customers
• Who may, in turn, allocate to their customers…
Longest Prefix Match Forwarding
• Forwarding tables in IP routers
– Maps each IP prefix to next-hop link(s)
• Destination-based forwarding
– Packet has a destination address
– Router identifies longest-matching prefix
– Pushing complexity into forwarding decisions
4.0.0.0/8 4.83.128.0/17 12.0.0.0/8
Trang 25Are 32-bit Addresses Enough?
• Not all that many unique addresses
– 232= 4,294,967,296 (just over four billion)
– Plus, some are reserved for special purposes– And, addresses are allocated in larger blocks
• And, many devices need IP addresses
– Computers, PDAs, routers, tanks, toasters, …
• Long-term solution: a larger address space
– IPv6 has 128-bit addresses (2128 = 3.403 × 1038)
Are 32-bit Addresses Enough?
• Not all that many unique addresses
– 232= 4,294,967,296 (just over four billion)
– Plus, some are reserved for special purposes– And, addresses are allocated in larger blocks
• And, many devices need IP addresses
– Computers, PDAs, routers, tanks, toasters, …
• Long-term solution: a larger address space
– IPv6 has 128-bit addresses (2128 = 3.403 × 1038)
• Short-term solutions: limping along with IPv4
– Private addresses
– Network address translation (NAT)
Trang 26Short-Term Solutions: Limping Along
– Allowing multiple hosts to share an IP address– IP addresses not unique and not end-to-end
NAT
inside
outside 10.0.0.1
10.0.0.2
138.76.29.7
Short-Term Solutions: Limping Along
• Dynamic Host Configuration Protocol
– Share a pool of addresses among many hosts– Dynamically assign an IP address upon request
arriving
client
DHCP server 233.1.2.5
Trang 27Hard Policy Questions
• How much address space per geographic region?
– Equal amount per country?
– Proportional to the population?
– What about addresses already allocated?
• Address space portability?
– Keep your address block when you change providers? – Pro: avoid having to renumber your equipment
– Con: reduces the effectiveness of address aggregation
• Keeping the address registries up to date?
– What about mergers and acquisitions?
– Delegation of address blocks to customers?
– As a result, the registries are horribly out of date