Post on 02-Jan-2016
transcript
IP Routing Table (Linux)IP Routing Table (Linux)
eth0eth0 UGUG 0.0.0.00.0.0.0144.16.64.1144.16.64.1 0.0.0.00.0.0.0
lolo UU 255.0.0.0255.0.0.0 0.0.0.00.0.0.0 127.0.0.0127.0.0.0
eth0eth0 UU255.255.224.0255.255.224.0 0.0.0.00.0.0.0144.16.64.0144.16.64.0
IntfcIntfc FlagsFlags GenmaskGenmask GatewayGateway DestDest
The routing table mask
IP Routing TablesIP Routing Tables In Linux, a Gateway entry of 0.0.0.0 indicates In Linux, a Gateway entry of 0.0.0.0 indicates
that the destination is directly connectedthat the destination is directly connected
Also, a Genmask of 0.0.0.0 and a destination Also, a Genmask of 0.0.0.0 and a destination of 0.0.0.0 indicate a default entryof 0.0.0.0 indicate a default entry
– Any “dest addr” & 0.0.0.0 = 0.0.0.0Any “dest addr” & 0.0.0.0 = 0.0.0.0
– So any dest addr matches this entrySo any dest addr matches this entry
– Hence “default entry”Hence “default entry”
IP Routing TablesIP Routing Tables The “Destination” column in the routing The “Destination” column in the routing
table is better called table is better called network prefixnetwork prefix
Stores the pattern against which a match of Stores the pattern against which a match of packet D.A & genmaskpacket D.A & genmask
is attemptedis attempted
Possible for Possible for packet D.A & genmaskpacket D.A & genmask
to match multiple entries in col to match multiple entries in col network network prefix?prefix?
IP Routing TablesIP Routing Tables
Longest prefix matchLongest prefix match
Most specific match determines how the Most specific match determines how the packet will be handledpacket will be handled
Presence of the H flag …Presence of the H flag … network prefix is 32 bits longnetwork prefix is 32 bits long
Most specific match possibleMost specific match possibleGenmask = 255.255.255.255Genmask = 255.255.255.255
Routing Table Masks Routing Table Masks
The routing table was that of a machine The routing table was that of a machine whose interface address is 144.16.68.2 whose interface address is 144.16.68.2 and subnet mask is 255.255.224.0and subnet mask is 255.255.224.0
1st row: R.T.mask = subnet mask1st row: R.T.mask = subnet mask
2nd and 3rd rows: R.T.mask not equal to 2nd and 3rd rows: R.T.mask not equal to subnet masksubnet mask
Broadcast addressesBroadcast addresses
What is the limited broadcast address that What is the limited broadcast address that machine X will use?machine X will use?
– 255.255.255.255255.255.255.255
What is the subnet-directed broadcast What is the subnet-directed broadcast address that machine X will use?address that machine X will use?
– 144.16.95.255144.16.95.255
Link layerLink layer
Number of hosts accessible via the link
One More than one
(Serial links) (Ethernet, FDDI, …)
EthernetEthernet
Data (IP, ARP, RARP …) CRC
Dest addr (6 bytes) Source addr (6 bytes) Type
10 Mb/s, 100 Mb/s, 1 Gb/s
IEEE 802.3IEEE 802.3
ARP RARP
IP
D.A. S.A. Length CRC
8 bytes
The type field is part of the additional 8-byte field
Ethernet/802.3 addressesEthernet/802.3 addresses 48-bit addresses48-bit addresses
24 out of the 48 bits are obtained from IEEE24 out of the 48 bits are obtained from IEEE
– IEEE: Official global authority for LAN addressesIEEE: Official global authority for LAN addresses
These 24 bits: These 24 bits: Organizationally Unique Organizationally Unique Identifier Identifier (OUI)(OUI)
Radia Perlman, “Interconnections”Radia Perlman, “Interconnections”
Ethernet/802.3 addressesEthernet/802.3 addresses 1 bit out of the 24 OUI bits: 1 bit out of the 24 OUI bits: Group/Individual Group/Individual
bitbit
– 1: Address refers to a logical group of stations (ex: 1: Address refers to a logical group of stations (ex: multicast multicast Ethernet addressesEthernet addresses))
– 0: Address refers to a particular station0: Address refers to a particular station
Another bit out of the 24 bits: Another bit out of the 24 bits: Local/global bitLocal/global bit
– 0: The address is globally unique0: The address is globally unique
– 1: The address is locally assigned, no guarantee of 1: The address is locally assigned, no guarantee of global uniqueness global uniqueness
FramingFraming How to distinguish between How to distinguish between
successive frames? successive frames?
Where does a frame start and where Where does a frame start and where does it end?does it end?
– Special characters as delimiters?Special characters as delimiters?
– Anything else?Anything else?
Ethernet frameEthernet frame
DataHeader 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 LengthFrame Length Fixed or variable length?Fixed or variable length?
– Ethernet frames are of variable lengthEthernet frames are of variable length
– Minimum: 64 bytes (including 14 bytes of Minimum: 64 bytes (including 14 bytes of header and 4 bytes of CRC)header and 4 bytes of CRC)
– Maximum: 1518 bytesMaximum: 1518 bytes
– Maximum Transmission Unit (MTU): 1500 bytesMaximum Transmission Unit (MTU): 1500 bytes
How can we know the length of a frame?How can we know the length of a frame?
If the beginning and end of the frame can If the beginning and end of the frame can be identified (delimiters), then the frame be identified (delimiters), then the frame can be parsed properlycan be parsed properly
LengthLength
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 DetectionError Detection How to handle errors on the link?How to handle errors on the link?
– Error detection Error detection
– CRC: Cyclic Redundancy CheckCRC: Cyclic Redundancy Check
““Reliable” link or “unreliable” linkReliable” link or “unreliable” link
– Error detection is the first stepError detection is the first step
– If reliable link: sender retransmitsIf reliable link: sender retransmits
Reliability & Flow ControlReliability & Flow Control
– ARQ (Automatic Repeat Request)ARQ (Automatic Repeat Request)
– Acks / Nacks must be sent back to the senderAcks / Nacks must be sent back to the sender
– Ethernet: no reliabilityEthernet: no reliability
Flow ControlFlow Control
– Receiver stops a fast senderReceiver stops a fast sender
– IEEE 802.3 defines a PAUSE frame for thisIEEE 802.3 defines a PAUSE frame for this
Cyclic Redundancy Check CodeCyclic Redundancy Check Code
Simple parity check codesSimple parity check codes– Odd and even parity; modulo-2 sumOdd and even parity; modulo-2 sum
Horizontal and vertical parity check codeHorizontal and vertical parity check code
CRCCRC
Row parity bit
Column parity bit
CRCCRC
Can generalize the horizontal and vertical Can generalize the horizontal and vertical check code to a check code to a general parity check codegeneral parity check code
– Parity bits are calculated on subsets of the data Parity bits are calculated on subsets of the data bitsbits
In a CRC, the string of data bits and the code In a CRC, the string of data bits and the code bits are viewed as polynomialsbits are viewed as polynomials
– Data string = 1101, poly = (D^3 + D^2 + 1)Data string = 1101, poly = (D^3 + D^2 + 1)
CRCCRC
New entity: New entity: generator polynomialgenerator polynomial
L-bitL-bit CRC CRC
Generator polynomial Generator polynomial g(D)g(D) : of degree : of degree LL in in the variable Dthe variable D
s(D):s(D): data polynomial data polynomial
CRCCRC
To get the CRC polynomial To get the CRC polynomial c(D)c(D)
– Obtain Obtain s(D)*(D^L)s(D)*(D^L)
– Divide Divide s(D)*(D^L)s(D)*(D^L) by by g(D)g(D)
– c(D)c(D) = Remainder when = Remainder when s(D)*(D^L)s(D)*(D^L) is divided by is divided by g(D)g(D)
““Data Networks” Data Networks” – Bertsekas and Gallager – Bertsekas and Gallager
– Chap 2Chap 2
ARP headerARP header
Hardware type (2 octets)Hardware type (2 octets)– Value =1 for Value =1 for EthernetEthernet
Protocol type (2 octets)Protocol type (2 octets)– Value = 0x0800 for Value = 0x0800 for IPIP
Hardware address size in bytes (1 octet)Hardware address size in bytes (1 octet)– Value = 6 for Value = 6 for EthernetEthernet
Protocol address size in bytes (1 octet)Protocol address size in bytes (1 octet)– Value = 4 for Value = 4 for IPIP
ARP headerARP header
OpcodeOpcode
– ARP ARP requestrequest
– ARP ARP replyreply
– RARP requestRARP request
– RARP replyRARP reply
ARP cacheARP cache
Before issuing an ARP request, a machine Before issuing an ARP request, a machine always checks its always checks its ARP cacheARP cache to see if the to see if the desired hardware address is present desired hardware address is present
If no such address mapping is found, then If no such address mapping is found, then the ARP request is issuedthe ARP request is issued
Timeout for cache entriesTimeout for cache entries
arp –a arp –a shows all the shows all the ARP cacheARP cache entries entries