IP Routing Table (Linux) Dest Gateway 144.16.64.0 0.0.0.0 127.0.0.0 0.0.0.0 0.0.0.0 144.16.64.1 Genmask Flags Intfc 255.255.224.0 U eth0 255.0.0.0 U lo 0.0.0.0 UG eth0 The routing table mask IP Routing Tables In Linux, a Gateway entry of 0.0.0.0 indicates that the destination is directly connected Also, a Genmask of 0.0.0.0 and a destination of 0.0.0.0 indicate a default entry – Any “dest addr” & 0.0.0.0 = 0.0.0.0 – So any dest addr matches this entry – Hence “default entry” IP Routing Tables The “Destination” column in the routing table is better called network prefix Stores the pattern against which a match of packet D.A & genmask is attempted Possible for packet D.A & genmask to match multiple entries in col network prefix? IP Routing Tables Longest prefix match Most specific match determines how the packet will be handled Presence of the H flag … network prefix is 32 bits long Most specific match possible Genmask = 255.255.255.255 Routing Table Masks The routing table was that of a machine whose interface address is 144.16.68.2 and subnet mask is 255.255.224.0 1st row: R.T.mask = subnet mask 2nd and 3rd rows: R.T.mask not equal to subnet mask Broadcast addresses What is the limited broadcast address that machine X will use? – 255.255.255.255 What is the subnet-directed broadcast address that machine X will use? – 144.16.95.255 Link layer Number of hosts accessible via the link One (Serial links) More than one (Ethernet, FDDI, …) Ethernet Data (IP, ARP, RARP …) Dest addr (6 bytes) Source addr (6 bytes) Type 10 Mb/s, 100 Mb/s, 1 Gb/s CRC Ethernet IP RARP ARP D.A. S.A. Type CRC IEEE 802.3 The type field is part of the additional 8-byte field IP RARP ARP D.A. S.A. CRC Length 8 bytes Ethernet/802.3 addresses 48-bit addresses 24 out of the 48 bits are obtained from IEEE – IEEE: Official global authority for LAN addresses These 24 bits: Organizationally Unique Identifier (OUI) Radia Perlman, “Interconnections” Ethernet/802.3 addresses 1 bit out of the 24 OUI bits: Group/Individual bit – 1: Address refers to a logical group of stations (ex: multicast Ethernet addresses) – 0: Address refers to a particular station Another bit out of the 24 bits: Local/global bit – 0: The address is globally unique – 1: The address is locally assigned, no guarantee of global uniqueness Framing How to distinguish between successive frames? Where does a frame start and where does it end? – Special characters as delimiters? – Anything else? Ethernet frame Header Data Trailer Medium In Ethernet, gaps between frames act as delimiters…inter-frame gap How would a station detect the beginning of the “gap”? Drop in power level in the medium Frame Length Fixed or variable length? – Ethernet frames are of variable length – Minimum: 64 bytes (including 14 bytes of header and 4 bytes of CRC) – Maximum: 1518 bytes – Maximum Transmission Unit (MTU): 1500 bytes How can we know the length of a frame? Length If the beginning and end of the frame can be identified (delimiters), then the frame can be parsed properly Data From the beginning of the frame: first 6 bytes -- D.A., next 6 bytes -- S.A. etc; From the end of the frame: last 4 bytes -- CRC Error Detection How to handle errors on the link? – Error detection – CRC: Cyclic Redundancy Check “Reliable” link or “unreliable” link – Error detection is the first step – If reliable link: sender retransmits Reliability & Flow Control – ARQ (Automatic Repeat Request) – Acks / Nacks must be sent back to the sender – Ethernet: no reliability Flow Control – Receiver stops a fast sender – IEEE 802.3 defines a PAUSE frame for this CRC Cyclic Redundancy Check Code Simple parity check codes – Odd and even parity; modulo-2 sum Horizontal and vertical parity check code Row parity bit Column parity bit CRC Can generalize the horizontal and vertical check code to a general parity check code – Parity bits are calculated on subsets of the data bits In a CRC, the string of data bits and the code bits are viewed as polynomials – Data string = 1101, poly = (D^3 + D^2 + 1) CRC New entity: generator polynomial L-bit CRC Generator polynomial g(D) : of degree L in the variable D s(D): data polynomial CRC To get the CRC polynomial c(D) – Obtain s(D)*(D^L) – Divide s(D)*(D^L) by g(D) – c(D) = Remainder when s(D)*(D^L) is divided by g(D) “Data Networks” – Bertsekas and Gallager – Chap 2 ARP “Protocol address” “Hardware address” Ex: IP address Ex: Ethernet address RFC 826 ARP ARP S.A. D.A. Type CRC Sender h/w Sender proto Target h/w Target proto ARP header Hardware type (2 octets) – Value =1 for Ethernet Protocol type (2 octets) – Value = 0x0800 for IP Hardware address size in bytes (1 octet) – Value = 6 for Ethernet Protocol address size in bytes (1 octet) – Value = 4 for IP ARP header Opcode – ARP request – ARP reply – RARP request – RARP reply ARP cache Before issuing an ARP request, a machine always checks its ARP cache to see if the desired hardware address is present If no such address mapping is found, then the ARP request is issued Timeout for cache entries arp –a shows all the ARP cache entries