View
213
Download
0
Category
Preview:
Citation preview
EEC-484/584EEC-484/584Computer NetworksComputer Networks
Lecture 8Lecture 8
Wenbing ZhaoWenbing Zhao
wenbing@ieee.orgwenbing@ieee.org
22
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
OutlineOutline• Reminder:
– 3/3 (Monday): Lab #3– 3/5 (Wednesday): Quiz #2
• CSMA protocols• Manchester Encoding• The Ethernet MAC Sublayer Protocol• The Binary Exponential Backoff Algorithm• Switched Ethernet• ARP and DHCP
33
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Carrier Sense Multiple AccessCarrier Sense Multiple Access
• When station has data to send, listens to channel to see if anyone else is transmitting
• If channel is idle, station transmits a frame• Else station waits for it to become idle• If collisions occurs, station waits random amount
of time, tries again• Also called 1-persistent CSMA
– With probability 1 station will transmit if channel is idle
44
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
• After a station starts sending, it takes a while before 2nd station receives 1st station’s signal– 2nd station might start sending before it knows that
another station has already been transmitting
• If two stations become ready while third station transmitting– Both wait until transmission ends and start
transmitting, collision results
Carrier Sense Multiple Access:Carrier Sense Multiple Access:Collision Still PossibleCollision Still Possible
55
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
pp-persistent CSMA:-persistent CSMA:Reduce the Probability of CollisionReduce the Probability of Collision
• Sense continuously, but does not always send when channel is idle– Applicable for slotted channels
• When ready to send, station senses the channel– If channel idle, station transmits with probability p,
defers to next slot with probability q = 1-p– Else (if channel is busy) station waits until next slot tries
again– If next slot idle, station transmits with probability p,
defers with probability q = 1-p– …
66
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Non-Persistent CSMANon-Persistent CSMA
• Does not sense continuously, send if it senses the channel is idle
• Before sending, station senses the channel– If channel is idle, station begins sending– Else station does not continuously sense, waits
random amount of time, tries again
77
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Persistent and Nonpersistent CSMAPersistent and Nonpersistent CSMA
• Improves over ALOHA because they ensure no station to transmit when it senses channel is busy
88
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Manchester EncodingManchester Encoding• Binary encoding
– Hard to distinguish 0 bit (0-volt) from idle (0-volt)– Requires clocks of all stations synchronized
• Manchester encoding and differential Manchester encoding
99
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Ethernet Frame StructureEthernet Frame Structure• Preamble: for clock synchronization
– First 7 bytes with pattern 10101010, last byte with pattern 10101011
– The two consecutive 1’s indicate the start of a frame
• How can the receiver tell the end of the frame?– No current on the wire
>= 64 bytesNot considered as part of the
header!
1010
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Ethernet Frame StructureEthernet Frame Structure• Destination address: 6 bytes (48 bits)
– Highest order bit: 0 individual, 1 multicast; all 1’s broadcast
– Frames received with non-matching destination address is discarded
• Type: type of network layer protocol• Pad – used to produce valid frame >= 64 bytes• Checksum – 32-bit cyclic redundancy check
1111
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Ethernet MAC Sublayer ProtocolEthernet MAC Sublayer Protocol
• Uses 1-persistent CSMA/CD
• Binary exponential backoff
• Provides unreliable connectionless service
1212
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
CSMA with Collision DetectionCSMA with Collision Detection
• If two stations start transmitting simultaneously, both detect collision and stop transmitting
• Minimum time to detect collision = time for signal to propagate
• Monitor collision while sending– Minimum time to detect collision => minimum frame
length
1313
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Minimum Time to Detect CollisionMinimum Time to Detect Collision
• To ensure the sender can detect collision– All frames must take more than 2 to send so that
transmission is still taking place when the noise burst gets back to the sender
1414
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Randomization and Randomization and Binary Exponential BackoffBinary Exponential Backoff
• Time divided into slots– Length of slot = 2 = worst-case round-trip
propagation time– To accommodate longest path, slot time = 512 bit
times = 51.2 sec (10Mbps Ethernet)
• Binary exponential backoff
1515
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Randomization and Randomization and Binary Exponential BackoffBinary Exponential Backoff
• After 1st collision, station picks 0 or 1 at random, waits that number of slots and tries again
• After 2nd collision, station picks 0,1,2,3 at random, waits that number of slots and tries again
• ….• After i-th collision, station picks 0,1,…,2i-1 at random, …• If 10 <= i < 16, station picks 0,1,…,210-1 at random• If i=16, controller reports failure to computer
1616
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Ethernet PerformanceEthernet Performance
• Binary exponential backoff results in– Low delay when few stations collide– Reasonable delay for collision resolution when many
stations collide
• When other factors are fixed, channel efficiency decreases when– Network bandwidth increases– Cable length increases– Number of stations increases– Frame length decreases
1717
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Ethernet PerformanceEthernet Performance
Efficiency of Ethernet at 10 Mbps with 512-bit slot times
1818
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Switched EthernetSwitched Ethernet• Switch – contains a high-speed backplane and room for
typically 4 to 32 plug-in line cards, each containing 1-8 connectors– Possibly each card forms its own collision domain, or– Full-duplex operation if each input port is buffered
1919
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
ARP ARP –– Address Resolution Protocol Address Resolution Protocol
How do IP addresses get mapped onto data link layer addresses, such as Ethernet?
2020
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
ARP OptimizationARP Optimization
• ARP result is cached (step 5 in figure)• When A wants to communicate with B, A includes its
IP-to-Ethernet mapping in the ARP packet so that B knows the mapping right away (step 3 in figure)
• Have every machine broadcast its mapping when it boots, so that everyone else knows the mapping
• To accommodate changes, entries in the ARP cache time out after a few minutes
2121
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
ARP: ARP: How to Handle Remote TrafficHow to Handle Remote Traffic
• Proxy ARP – A router is configured to answer ARP requests on one of its networks for a host on another network
2222
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
ARP – ExerciseARP – Exercise• Node 1 wants to send a packet to node 3, what will be
returned by ARP?• Node 1 wants to send a packet to node 2, what will be
returned by ARP?
2323
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
RARP RARP –– Reverse Address Resolution ProtocolReverse Address Resolution Protocol
• RARP - Allows a newly-booted diskless-workstation (e.g., X terminal) to broadcast its Ethernet address and ask for its IP address– RARP server responds to a RARP request with the
assigned IP address
32-bit Internet address
48-bit Ethernet address
ARP RARP
2424
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Limitations of RARPLimitations of RARP
• RARP uses a link-layer broadcast, RARP requests are not forwarded by routers, therefore, an RARP server must be present on every network
• The only thing returned by the RARP server is the IP address
2525
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
BOOTP BOOTP –– Bootstrap Protocol Bootstrap Protocol• BOOTP – uses UDP
– A client broadcasts to 255.255.255.255– The source IP address is set to 0.0.0.0 if client does
not know its own IP address yet– Port number: 67 for server, 68 for client
• BOOTP drawbacks– Requires manual configuration of tables mapping IP
address to Ethernet address at the BOOTP server• Replaced by DHCP
2626
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
Dynamic Host Configuration ProtocolDynamic Host Configuration Protocol
• Allow host to dynamically obtain its IP address from network server when it joins network– IP address assignment is lease-based (to cope with
client failure, also enables reuse of addresses)– Can renew its lease on address in use
• DHCP overview (UDP is used for communication)– Host broadcasts “DHCP discover” msg– DHCP server responds with “DHCP offer” msg– Host requests IP address: “DHCP request” msg– DHCP server sends address: “DHCP ack” msg
2727
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
DHCP Client-Server ScenarioDHCP Client-Server Scenario
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
2828
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
DHCP Client-Server ScenarioDHCP Client-Server ScenarioDHCP server: 223.1.2.5 arriving
client
time
DHCP discover
src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654
DHCP offer
src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
2929
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
DHCP ReplayDHCP Replay• A DHCP relay agent can be configured on each LAN• The agent stores the IP address of the DHCP server and
forward the request to the server
3030
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
DHCP with Replay AgentDHCP with Replay Agent
• To find its IP address, a newly-booted machine broadcasts a DHCP Discover packet
• The DHCP relay agent on its LAN receives all DHCP broadcasts
• On receiving a DHCP Discover packet, the agent sends the packet as a unicast packet to the DHCP server, possibly on a distant network
3131
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
ExerciseExercise
• An IP packet to be transmitted by Ethernet is 60 bytes long. Is padding needed in the Ethernet frame, and if so, how many bytes?
3232
Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao
ExerciseExercise
• Consider building a CSMA/CD network running at 1 Gbps over a 1-km cable. The signal speed in the cable is 200,000 km/sec. What is the minimum frame size?
Recommended