Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCD 330 Network Programming

Similar presentations


Presentation on theme: "CSCD 330 Network Programming"— Presentation transcript:

1 CSCD 330 Network Programming
Winter 2019 Lecture 18 Link Layer Protocols Continued Reading: Chapter 5 Who is this? Some slides provided courtesy of J.F Kurose and K.W. Ross, All Rights Reserved, copyright 1 1

2 Overview Link Layer Hardware Hubs vs Switches vs Routers Ethernet
ARP and MAC Addressing 2 2

3 LAN and Network Hardware

4 Shuttling Data at Different Layers
Different devices switch different things Physical Layer: Electrical signals (repeaters and hubs)‏ Link layer: Frames (bridges and switches)‏ Network layer: Packets (routers)‏ Application gateway Transport gateway Router Frame header Packet header TCP header User data Bridge, switch Repeater, hub 4 4

5 Key Distinction (Smart) Routers (Dumber) Switches/Bridges
Forward based on IP headers (Dumber) Switches/Bridges 00:13:02:BA:43:56 Forward based on MAC addresses (Dumbest) Repeaters/Hubs Broadcast all bits Also talk about devices being “smart” or “stupid” Smart means they can detect addresses Stupid means they can't make decisions – too dumb 5

6 Repeaters Length of cable influences quality of communication
Repeaters repeat signals Clean and boost digital transmission Analog networks use amplifiers to boost signal Repeaters only work with the physical signal Cannot reformat, resize, or manipulate the data Physical layer, Layer 1 device

7 Repeaters (continued)‏

8 Repeaters (continued)‏

9 Hubs Generic connection device
Operates at the Physical Layer Connect several networking cables together Active hubs Known as ... Multiport repeaters Passive hubs Something that does not boost signal, just connects the wires

10 Hubs (continued)‏

11 Switches Operate at the Data Link layer
Increases network performance Virtual circuits between source and destination Micro segmentation at the port level More complicated and expensive than hubs

12 Switches Switch Filter based on MAC addresses
Build tables in memory of host locations Creates singular collision domains Collision Domain Hub Switch

13 Collision Domain What is a Collision Domain?
Group of nodes in Ethernet network that compete with each other for access If two or more devices try to access network at exact same time, collision will occur In switched Ethernet environment, each transmitting-receiving pair of nodes is essentially its own collision domain, except that no collisions can occur, because there is no sharing of bandwidth

14 Use of Ethernet Switches Versus Hubs in a LAN
Collisions with Switch and Hub Hubs Switch

15 Switch Link-layer device, “Layer 2” Switch Transparent
Store, forward Ethernet frames Examine incoming frame’s MAC address, selectively forward frame outgoing link when frame is to be forwarded on segment Transparent Important !!!!! Note that Hosts are unaware of presence of switches Operate at lower levels of protocol stack Plug-and-play, self-learning Switches do not need to be manually set 5-15 15

16 Switches Advantages of Switches Increase available network bandwidth
Reduced workload, computers only receive packets intended for them specifically Increase network performance Each host gets full speed use of link Smaller collision domains Single host as opposed to everyone is competing for bandwidth

17 Switches ‏ Disadvantages of Switches
More expensive than hubs and bridges Difficult to trace network connectivity problems through a switch Does not filter broadcast traffic

18 Switches (continued)‏

19 Routers What does a router do?
Provides filtering and network traffic control Used for LANs to connect segments and WANs Connect multiple segments and networks Multiple routers create an “internetwork” Operates at Network layer Layer 3 device

20 Routers Creates a table to determine how to forward packets
Filtering and traffic control base on logical addresses, IP addresses

21 Differences Logical vs. Physical
Look at the Differences Between Logical and Physical Addresses ...

22 Physical Versus Logical Addresses
MAC addresses Data Link layer Used by switches Used for directly connected devices Mostly encoded in firmware, does not change Logical addresses, IP Network layer Use by routers Changes with network segment IP addresses are assigned manually or by software

23 Physical Versus Logical Addresses (continued)‏

24 Ethernet

25 Ethernet History 1973 Xerox Corporation’s Palo Alto Research Center developed bus topology Local Area Network (LAN) 1976, carrier sensing added, Xerox built 2.94 Mbps network to connect over 100 personal workstations on 1 km cable Network called Ethernet, named after ether, single coaxial cable used to connect machines "Ethernet" refers to product which predates IEEE Standard But, nowadays any compliant network is referred to as an Ethernet

26 Ethernet Bob Metcalf Original Paper published in 1976
Metcalfe’s Ethernet sketch Original Paper published in 1976 26 26

27 802.3 Standard Project In 1980, (IEEE) started project 802 to standardize local area networks (LAN)‏ IEEE wanted to put forward one standard IBM Token Ring, Token Bus and Ethernet were all contenders Eventually, Ethernet won and it became a standard in 1985 … 28 years ago! First standard was for 10 Mbps Entire list of Ethernet Standards

28 Ethernet Terminology Physical Layer
First number (10, 100, or 1000) transmission speed in megabits per second, Mbps Second term indicates transmission type BASE = baseband or BROAD = broadband Baseband – entire channel is taken up by one signal Broadband – multiple signals can occupy one channel Last number indicates segment length 5 means 500-meter (500-m) segment length from original Thicknet Recent versions, letters replace numbers Ex. 10BASE-T, T means unshielded twisted-pair cables Numbers show number of twisted pairs Ex.100BASE-T4, T4 indicates four twisted pair

29 Classical Ethernet Broadcast
Classical Ethernet, is Broadcast Network Hosts connected to network through single shared medium If two nodes try to send at same time, Called collision and prevents information passed along network Multiple messages would collide and corrupt each other

30 Early Ethernet 10Base5 and 10Base2
The initial Ethernet implementations used coaxial cable to connect the stations to each other Two forms of coaxial cable were used 10Base5 cable known as thick Ethernet 10Base2 also known as thin Ethernet

31 Ethernet Technology: First Attempt
10Base2: under 656 ft cable length Thin coaxial cable in a bus topology 10Base5 uses Thick coaxial cable which allows up to 100 nodes over a maximum distance of 1640 ft Repeaters used to connect multiple segments

32 Ethernet with Hubs: 2nd Attempt
Next form of Ethernet 10BaseT with Hubs 10BaseT, used twisted pair wiring instead of coaxial cable 10BaseT could use Category 3 twisted pair wire, already present in modern office buildings for telephones Contributed hugely to Ethernet's popularity

33 Ethernet Technologies: Next Attempt 10BaseT and 100BaseT
Hub(s) connected by twisted pair in “star topology” Distance of any node to hub < 326 ft

34 The 10Mb/s Ethernet Standard IEEE 802.3
Ethernet MAC Protocol 10Base-5 10Base-2 10Base-T 10Base-F Different physical layer options 10Base-5: Original Ethernet: large thick coaxial cable. 10Base-2: Thin coaxial cable version. 10Base-T: Voice-grade unshielded twisted-pair Category-3 telephone cable. 10Base-F: Two optical fibers in a single cable.

35 802.3u Fast Ethernet In 1995, IEEE adopted
802.3u Fast Ethernet standard Fast Ethernet is 100 Mbps Ethernet standard With Fast Ethernet came full-duplex Ethernet Two stations could transmit at the same time! Previously, Ethernets worked in half-duplex mode

36 The 100Mb/s Ethernet Standard “Fast Ethernet”
Different physical layer options Ethernet MAC Protocol 100Base-T4 100Base-TX 100Base-FX Up to 100m of cable per segment. 100Base-T4: Uses four pairs of voice grade Category-3 cable . 100Base-TX: Uses two pairs of data grade Category-5 cable. 100Base-FX: Uses two optical fibers.

37 The 1Gb/s Ethernet Standard
June Gigabit Ethernet was first defined in 802.3z supplement to standard, published in June 1998 802.3z defines network running at 1000 Mbps in either half-duplex or full-duplex mode, over variety of different network media

38 The 1Gb/s Ethernet Standard “Gigabit Ethernet”
Ethernet MAC Protocol 1000Base-TX 1000Base-FX 1000Base-TX: Uses four pairs of data grade Category-5 cable. 1000Base-FX: Uses two optical fibers.

39 Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Preamble: 7 bytes with pattern followed by one byte with pattern Used to synchronize receiver, sender clock rates 5: DataLink Layer 5-39 39

40 Ethernet Frame Structure (more)‏
Addresses: If adapter receives frame with matching destination address, or with broadcast address , it passes data in frame to network layer protocol, accepts the frame Otherwise, adapter discards frame What kind of addresses at this layer? MAC - Media Access Control Example: 00:13:02:BA:43:56 Type: Indicates higher layer protocol (mostly IP but others possible, e.g., Novell IPX)‏ CRC: checked at receiver, if error is detected, frame is dropped 40 40

41 CSMA/CD in Ethernet

42 Carrier Sense Media Access/ Collison Detection (CSMA/CD) Protocol
All hosts transmit & receive on one channel Packets are of variable size. When a host has a packet to transmit: 1. Carrier Sense: Check that the line is quiet before transmitting. 2. Collision Detection: Detect collision as soon as possible. If a collision is detected, stop transmitting; wait a random time, then return to step 1. binary exponential backoff

43 Ethernet CSMA/CD algorithm
Carrier Sense Multiple Access/ Collision Detection Algorithm 1. NIC receives datagram from network layer, creates frame 2. If NIC senses channel idle, starts frame transmission If NIC senses channel busy, waits until channel idle, then transmits 3. If NIC transmits entire frame without detecting another transmission, NIC is done with frame ! 43 43

44 Ethernet CSMA/CD algorithm
4. If NIC detects another transmission while transmitting, aborts and sends jam signal 5. After aborting NIC enters exponential backoff after mth collision, NIC chooses a K, small integer, at random from {0,1,2,…,2m-1} NIC then waits K·512 bit time, Returns to Step 2 More details follow … 44

45 Ethernet CSMA/CD algorithm
Features Transmitting station intentionally transmits a "jam sequence" to ensure all stations are notified frame transmission failed due to collision Station then remains silent for a random period of time before attempting to transmit again Repeats: Until frame is eventually transmitted successfully 45

46 Ethernet’s CSMA/CD (more)‏
Exponential Backoff Goal Adapt retransmission attempts to estimated current load Heavy load -> random wait will be longer and more varied First collision: Choose K from {0,1}; Delay is K· 512 bit transmission times After second collision: Choose K from {0,1,2,3}… After ten collisions, Choose K from {0,1,2,3,4,…,1023} Set size grows Exponentially 46 46

47 Ethernet and Switches

48 switch with six interfaces
Switch: Allows multiple simultaneous transmissions A Hosts have dedicated, direct connection to switch Switches “buffer” packets Ethernet protocol used on each incoming link, no collisions AND full duplex Each link is its own collision domain Switching: A-to-A’ and B-to-B’ simultaneously, without collisions Not possible with “dumb” hub C’ B 1 2 6 3 4 5 C B’ A’ switch with six interfaces (1,2,3,4,5,6) 5: DataLink Layer 5-48 48

49 switch with six interfaces
Switch Table A Q: How does switch know that A’ reachable via interface 4, B’ reachable via interface 5? A: Each switch has switch table, each entry: MAC address of host, interface to reach host, time stamp Looks like a routing table! Q: How are entries created, maintained in switch table? Self-Learning C’ B 1 2 6 3 4 5 C B’ A’ switch with six interfaces (1,2,3,4,5,6) 5: DataLink Layer 5-49 49

50 Switch: Self-learning
Switch learns which hosts can be reached through which interfaces When frame received, switch “learns” location of sender: Incoming LAN segment Records sender/location pair A C’ B 1 2 6 3 4 5 C B’ A’ MAC addr interface TTL Switch table (initially empty)‏ A 1 60 5-50 50

51 Switch: self-learning
Source: A Dest: A’ A A A’ Frame with Destination A' arrives at switch from interface 1 Two possibilities: 1. No entry in table, for A', switch forwards frame to all interfaces except 1 - Entry for A' added when A' answers 2. Entry in table, for A' interface of 4, frame would get forwarded only to A' C’ B 1 2 6 3 4 5 C B’ A’ MAC addr interface TTL A 1 60 Switch table (initially empty)‏ A' 4 5: DataLink Layer 5-51 51

52 Switches and CSMA/CD Do we need to use CSMA/CD on today's switched network? Collision domain has pretty much been relegated to history Hubs still use CSMA/CD, but if network uses Fast Ethernet switches, in full-duplex mode, then CSMA/CD no longer comes into play Full-duplex switches use separate wire pairs so switch port can send data to attached computer, while receiving data from that computer on another wire pair

53 Link Layer 5.1 Introduction and services
5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.6 Link-layer switches 53 53

54 Topics LAN Addressing Arp Protocol

55 MAC Addresses Network Layer 32-bit IP address
Network-layer address, dotted decimal Ex.: To route datagram to destination machine MAC (or LAN or physical or Ethernet) Address MAC stands for Media Access Control 48 bit MAC address (for most LANs)‏ Burned in NIC ROM, also sometimes software settable 24 bits set for manufacturer, bits for NIC adapter Ex.: 00:E0:B8:9C:A6:60 55 55

56 MAC Address Why would you want to change your MAC address?
Many reasons ... 1. To get around MAC address filtering of wireless routers. You sniff for Mac address of someone already on network, then change your Mac address to one that's acceptable Why filtering by Mac address is not very secure!! 2. To keep a burned-in MAC address out of IDS and security logs, keeps deviant behavior from being connected to hardware 3.To pull off a denial of service attack, assume MAC of gateway to a subnet lots of WiFi routers will lock up if a client tries to connect with the same MAC as router's BSSID

57 Change Your MAC Address
How to change your MAC address Windows XP/2000/Vista Use regedit to edit registry or use a utility Mac Makeup, MadMACs spoofer Smac Etherchange - Linux $ ifconfig eth0 down hw ether 00:00:00:00:00:01 $ ifconfig eth0 up

58 MAC Addresses Each adapter on LAN has unique MAC address except for
Broadcast address which is FF-FF-FF-FF-FF-FF 1A-2F-BB AD LAN (wired or wireless)‏ = adapter 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 58 58

59 MAC Address Analogy: MAC address allocation administered by IEEE
Manufacturer buys portion of MAC address space (to assure uniqueness)‏ Table: Analogy: (a) MAC address … like Social Security Number Take it with you (b) IP address … like postal address, Changes when you move Flat MAC address increases Portability Can move LAN card from one LAN to another IP hierarchical address NOT portable Address depends on IP subnet to which node is attached Must change IP address if move to a different subnet 59 59

60 ARP: Address Resolution Protocol
Question: How to determine MAC address of B knowing B’s IP address? Each IP node on LAN has ARP table ARP table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; TTL> TTL (Time To Live): time after which address mapping discarded Varies 1 to 20 minutes on average A 1A-2F-BB AD LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 B 60 60

61 ARP Cache For every outgoing packet sending ARP request
and wait for response is inefficient Requires more bandwidth Consumes Time So, ARP cache maintained at each node Size limit = 512 entries

62 ARP Protocol: Same LAN A wants to send datagram to B, and B’s MAC address not in A’s ARP table A broadcasts ARP query packet, containing B's IP address Shouts to everyone on LAN!!! Destination MAC address = FF-FF-FF-FF-FF-FF All machines on LAN receive ARP query B receives ARP packet, replies to A with its (B's) MAC address Frame sent to A’s MAC address (unicast)‏ 62 62

63 Types of ARP Messages ARP request ARP reply
Who is IP addr X.X.X.X tell IP addr Y.Y.Y.Y ARP reply IP addr X.X.X.X is Ethernet Address hh:hh:hh:hh:hh:hh

64 ARP Protocol: Same LAN A caches (saves) IP-to-MAC address pair
Called: ARP table until information becomes old Eventually Times out ARP table keeps Soft state information that times out unless refreshed ARP is “plug-and-play” Nodes create their ARP tables without intervention from, you, the network administrator Look at example within one LAN … in class

65 ARP Protocol: Routing to another LAN
Walkthrough: Send datagram from A to B via router, R Assume A knows B’s IP address Two ARP tables in router R, one for each IP network (LAN)‏ R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D A C-E8-FF-55 88-B2-2F-54-1A-0F B 49-BD-D2-C7-56-2A 65 65

66 R ARP Protocol example continued
A creates IP datagram with source A, destination B A uses ARP to get R’s MAC address for A creates link-layer frame with R's MAC address as destination, frame contains A-to-B IP datagram A’s NIC sends frame R’s NIC receives frame R removes IP datagram from Ethernet frame, sees its destined to B R uses ARP to get B’s MAC address R creates frame containing A-to-B IP datagram sends to B C-E8-FF-55 88-B2-2F-54-1A-0F A E6-E BB-4B 1A-23-F9-CD-06-9B B R 49-BD-D2-C7-56-2A CC-49-DE-D0-AB-7D 66 66

67 Summary Ethernet highly successful LAN technology
Simple, cheap and adaptable Can adapt to new faster underlying medium Hubs, Switches and Routers Good to know what each does Hubs and switches at Link Layer Router at higher layer 67

68 End 68


Download ppt "CSCD 330 Network Programming"

Similar presentations


Ads by Google