CSE 30264 Computer Networks
description
Transcript of CSE 30264 Computer Networks
CSE 30264
Computer Networks
Prof. Aaron StriegelDepartment of Computer Science & Engineering
University of Notre Dame
Lecture 11 – February 16, 2010
CSE 30264 2
Today’s Lecture
• Internetworking– Local Network– NAT– ICMP
• Routing– Routing in the WAN
Spring 2010
Physical
Data
Network
Transport
Application
Spring 2010 CSE30264 3
Internetworking
Outline Local Network Routing
CSE 30264 4
Routing Table – netscale01
Spring 2010
Mask result
Local or next hop?
Interface to pass to
Spring 2009 CSE30264 5
Datagram Forwarding • Strategy
– Always have dest address• In IP header
– Two choices• Local network (subnet)
– Pass it off directly• Not on my local network
– Pass to some router– Routing table
• Maps network to next hop• Routing entries• Default router How do I find that next hop?
Have IP, need Ethernet
Spring 2009 CSE30264 6
Address Translation • Layer 3 -> Layer 2 Translation
– IP -> Ethernet– Destination host– Next hop router
• Techniques– Do nothing
• Make Layer 2 part of Layer 3 address
– Table• Convert Layer 3 to Layer 2
• ARP – Address Resolution Protocol– Broadcast, observe, refresh
CSE 30264 7
Example – ARP Table
Spring 2010
CSE 30264 8
ARP Key Concepts• Broadcast request
– Send to FF:FF:FF:FF:FF:FF– Who is 129.74.50.20?
• Says AA:BB:CC:DD:EE:FF of 129.74.153.157• Response
– Respond directly or broadcast– I am 01:34:57:AB:CD:EF, aka 129.74.50.20
• Interesting concepts– Broadcast locally only – not
beyond the router– Soft state
• Old entries periodically expire– Nosy neighbor
• Note ARP requests of others
Spring 2010
Spring 2009 CSE30264 9
ARP Details
• Request Format– HardwareType: type of physical network (e.g., Ethernet)– ProtocolType: type of higher layer protocol (e.g., IP)– HLEN: Length of physical (hardware) address– PLEN: Length of protocol addresses– Operation: request or response – Source/Target-Physical/Protocol addresses
• Notes– Table entries timeout in about 15 minutes– Update table with source when you are the target – Update table if already have an entry– Do not refresh table entries upon reference
Spring 2009 CSE30264 10
ARP Packet Format
TargetHardwareAddr (bytes 2 – 5) TargetProtocolAddr (bytes 0 – 3)
SourceProtocolAddr (bytes 2 - 3)
Hardware type = 1 ProtocolType = 0x0800
SourceHardwareAddr (bytes 4 – 5)TargetHardwareAddr (bytes 0 – 1)SourceProtocolAddr (bytes 0 – 1)
HLen = 48 PLen = 32 OperationSourceHardwareAddr (bytes 0 - 3)
0 8 16 31
CSE 30264 11
Observe the Packets
Spring 2010
Wireshark
www.wireshark.org
CSE 30264 12
Addressing
Spring 2010
• How do I get my initial IP address?• Static IP
• System Administrator• Private network space• Know IP, mask, subnet, gateway, DNS
• Dynamic IP BOOTP / DHCP• I don’t know my IP, please tell me• Two flavors
• Anybody can come in• Authenticated / MAC filtered
Spring 2009 CSE30264 13
DHCP
• Dynamic Host Configuration Protocol
Spring 2009 CSE30264 14
DHCP
CSE 30264 15
More on DHCP
• Uses UDP– Why not TCP?
• Nearly all sites use DHCP– Static server only
• Other notes– Lease time for IP address– Variety of option fields
• Thin clients
Spring 2010
CSE 30264 16
NAT – Network Address Translation
• Limited public IP space– Share addresses
Spring 2010
I’ll give you one IP address via DHCP
Xfinity The largerInternet
???
CSE 30264 17
Enter the NAT• Translate private address to public
– Private network space• 10.*• 192.168.*
– Translate via table• Use connection tuple
– Src IP, Dst IP, Src Port, Dst Port
Spring 2010
67.56.43.2192.168.1.1
192.168.1.100
192.168.1.101
DHCP Server
CSE 30264 18
NAT Table
• Must originate from inside– Map internal tuple to external tuple
Spring 2010
67.56.43.2192.168.1.1
S: 192.168.1.100D: 25.78.200.3TCPSP: 9876DP: 80
S: 67.56.43.2D: 25.78.200.3TCPSP: 42778DP: 80
Mapping Table Ext: 67.56.43.2:42778 25.78.200.3:80 Int: 192.168.1.100:9876 25.78.200.3.80
CSE 30264 19
Mapping Table
• Maintain a list of all active connections– Map across the boundary– New connection
• Pick an unused external port• Issues
– Reach internal host from external (SSH)• DMZ – One host becomes a catch all
– Scalability– UDP– IPsec / VPN
Spring 2010
Spring 2009 CSE30264 20
Internet Control Message Protocol (ICMP)
• Echo (ping)• Redirect (from router to source host)• Destination unreachable (protocol, port, or host)• TTL exceeded (so datagrams don’t cycle forever)• Checksum failed • Reassembly failed• Cannot fragment
Spring 2009 CSE30264 21
Routing
OutlineDistance VectorLink State
Spring 2009 CSE30264 22
Overview• Forwarding vs Routing
– forwarding: to select an output port based on destination address and routing table
– routing: process by which routing table is built• Network as a Graph
• Problem: Find lowest cost path between two nodes• Factors
– static– dynamic
Spring 2009 CSE30264 23
Distance Vector• Each node maintains a set of triples
– (Destination, Cost, NextHop)• Directly connected neighbors exchange updates
– periodically (on the order of several seconds)– whenever table changes (called triggered update)
• Each update is a list of pairs:– (Destination, Cost)
• Update local table if receive a “better” route– smaller cost– came from next-hop
• Refresh existing routes; delete if they time out
Spring 2009 CSE30264 24
Example
Destination Cost NextHop A 1 A
C 1 C D 2 C
E 2 A F 2 A G 3 A
Spring 2009 CSE30264 25
Routing Loops• Example 1
– F detects that link to G has failed– F sets distance to G to infinity and sends update t o A– A sets distance to G to infinity since it uses F to reach G– A receives periodic update from C with 2-hop path to G– A sets distance to G to 3 and sends update to F– F decides it can reach G in 4 hops via A
• Example 2– link from A to E fails– A advertises distance of infinity to E– B and C advertise a distance of 2 to E– B decides it can reach E in 3 hops; advertises this to A– A decides it can read E in 4 hops; advertises this to C– C decides that it can reach E in 5 hops…
Spring 2009 CSE30264 26
Loop-Breaking Heuristics
• Set infinity to 16• Split horizon• Split horizon with poison reverse
Spring 2009 CSE30264 27
Routing Information Protocol (RIP)
• Distributed along with BSD Unix• Straightforward implementation of DV• Updates sent every 30 seconds• Link costs constant at 1 (16 = infinity)
Spring 2009 CSE30264 28
Link State• Strategy
– send to all nodes (not just neighbors) information about directly connected links (not entire routing table)
• Link State Packet (LSP)– id of the node that created the LSP– cost of link to each directly connected neighbor– sequence number (SEQNO)– time-to-live (TTL) for this packet
Spring 2009 CSE30264 29
Link State (cont)
• Reliable flooding– store most recent LSP from each node– forward LSP to all nodes but one that sent it– generate new LSP periodically
• increment SEQNO– start SEQNO at 0 when reboot– decrement TTL of each LSP
• discard when TTL=0
Spring 2009 CSE30264 30
Link State (cont)
Spring 2009 CSE30264 31
Route Calculation• Dijkstra’s shortest-path algorithm• Let
– N denotes set of nodes in the graph– l (i, j) denotes non-negative cost (weight) for edge (i, j)– s denotes this node– M denotes the set of nodes incorporated so far– C(n) denotes cost of the path from s to node n
M = {s}for each n in N - {s}
C(n) = l(s, n)while (N != M)
M = M union {w} such that C(w) is the minimum for all w in (N - M)
for each n in (N - M)C(n) = MIN(C(n), C (w) + l(w, n ))
Spring 2009 CSE30264 32
OSPF
• Open Shortest Path First Protocol• Authentication• Additional hierarchy• Load balancing
Spring 2009 CSE30264 33
Metrics • Original ARPANET metric
– measures number of packets queued on each link– took neither latency or bandwidth into consideration
• New ARPANET metric– stamp each incoming packet with its arrival time (AT)– record departure time (DT)– when link-level ACK arrives, compute
Delay = (DT - AT) + Transmit + Latency– if timeout, reset DT to departure time for retransmission – link cost = average delay over some time period
• Revised ARPANET metric– compressed dynamic range– replaced Delay with link utilization
• Practice– static metrics (e.g., 1/bandwidth)
Spring 2009 CSE30264 34
Routing for Mobile Hosts
• Mobile IP:– home agent, home address, foreign agent– triangle routing problem