800 likes | 87.73k Views
COMS/CSEE 4140 Networking Laboratory Lecture 06. Salman Abdul Baset Spring 2008. Announcements. Lab 4 (5-7) due next week before your lab slot Prelab 5 due next week. There will be Lab 5 next week. Midterm (March 10 th , duration ~1.5 hours) Assignment 2 issues aslookup compilation?
E N D
COMS/CSEE 4140 Networking LaboratoryLecture 06 Salman Abdul Baset Spring 2008
Announcements • Lab 4 (5-7) due next week before your lab slot • Prelab 5 due next week. • There will be Lab 5 next week. • Midterm (March 10th, duration ~1.5 hours) • Assignment 2 issues • aslookup compilation? • ISP name: nslookup or whois for IP address • Lab 4 (count-to-infinity issues)
Agenda • Autonomous Systems (AS) • Policy vs. distance based routing • Border gateway protocol (BGP) • Transmission control protocol (TCP)
Autonomous Systems Terminology • local traffic = traffic with source or destination in AS • transit traffic = traffic that passes through the AS • Stub AS = has connection to only one AS, only carry local traffic • Multihomed AS = has connection to >1 AS, but does not carry transit traffic • Transit AS = has connection to >1 AS and carries transit traffic
AS 1, AS 2, and AS 5 are stub networks AS 2 is a multi-homed stub network AS 3 and AS 4 are transit networks Stub and Transit Networks
Example: Transit AS 3 carries traffic between AS 1 and AS 4 and between AS 2 and AS 4 But AS 3 does not carry traffic between AS 1 and AS 2 The example shows a routing policy. Selective Transit
A stub network typically obtains access to the Internet through a transit network. Transit network that is a provider may be a customer for another network Customer pays provider for service Customer/Provider
Transit networks can have a peer relationship Peers provide transit between their respective customers Peers do not provide transit between peers Peers normally do not pay each other for service Customer/Provider and Peers
Note that peering reduces upstream traffic Delays can be reduced through peering But: Peering may not generate revenue Shortcuts through peering
ASNs already assigned Source: http://www.potaroo.net/tools/asn32/ private ASN: 65412 – 65536
ARDs versus ASes Autonomous Routing Domains Don’t Always Need BGP or an ASN Qwest Nail up routes 130.132.0.0/16 pointing to Yale Nail up default routes 0.0.0.0/0 pointing to Qwest Yale University 130.132.0.0/16 Static routing is the most common way of connecting an autonomous routing domain to the Internet. This helps explain why BGP is a mystery to many …
ASNs Can Be “Shared” (RFC 2270) AS 701 UUNet AS 7046 Crestar Bank AS 7046 NJIT AS 7046 Hood College 128.235.0.0/16 ASN 7046 is assigned to UUNet. It is used by Customers single homed to UUNet, but needing BGP for some reason (load balancing, etc..) [RFC 2270]
ARDs and ASes: Summary • Most ARDs have no ASN (statically routed at Internet edge) • Some unrelated ARDs share the same ASN (RFC 2270) • Some ARDs are implemented with multiple ASNs (example: Worldcom) ASes are just an implementation detail of Inter-domain routing
Agenda • Autonomous Systems (AS) • Policy vs. distance based routing • Border gateway protocol (BGP) • Transmission control protocol (TCP)
National ISP1 National ISP2 YES NO Regional ISP3 Regional ISP2 Regional ISP1 Cust1 Cust3 Cust2 Why not minimize “AS hop Count”? Shortest path routing is not compatible with commercial relations
provider customer IP traffic Customer versus Provider provider customer Customer pays provider for access to the Internet
Peers provide transit between their respective customers Peers do not provide transit between peers Peers (often) do not exchange $$$ traffic allowed traffic NOT allowed peer peer provider customer The “Peering” Relationship
Peering also allows connectivity between the customers of “Tier 1” providers. peer peer provider customer Peering Provides Shortcuts
Reduces upstream transit costs Can increase end-to-end performance May be the only way to connect your customers to some part of the Internet (“Tier 1”) You would rather have customers Peers are usually your competition Peering relationships may require periodic renegotiation Peering Wars Peer Don’t Peer Peering struggles are by far the most contentious issues in the ISP world! Peering agreements are often confidential.
Agenda • Autonomous Systems (AS) • Policy vs. distance based routing • Border gateway protocol (BGP) • Transmission control protocol (TCP)
Link State Vectoring OSPF RIP IGP IS-IS BGP EGP The Gang of Four
BGP Overview • BGP = Border Gateway Protocol v4 . RFC 1771. (~ 60 pages) • Note: In the context of BGP, a gateway is nothing else but an IP router that connects autonomous systems. • Interdomain routing protocol for routing between autonomous systems. • Uses TCP to establish a BGP session and to send routing messages over the BGP session. • Update only new routes. • BGP is a path vector protocol. Routing messages in BGP contain complete routes. • Network administrators can specify routing policies.
BGP Policy-based Routing • Each node is assigned an AS number (ASN) • BGP’s goal is to find any AS-path (not an optimal one). Since the internals of the AS are never revealed, finding an optimal path is not feasible. • Network administrator sets BGP’s policies to determine the best path to reach a destination network.
The Border Gateway Protocol (BGP) BGP = RFC 1771 + “optional” extensions RFC 1997 (communities) RFC 2439 (damping) RFC 2796 (reflection) RFC3065 (confederation) … + routing policy configuration languages (vendor-specific) + Current Best Practices in management of Interdomain Routing BGP was not DESIGNED. It EVOLVED.
BGP Route Processing Open ended programming. Constrained only by vendor configuration language Apply Policy = filter routes & tweak attributes Apply Policy = filter routes & tweak attributes Receive BGP Updates Based on Attribute Values Best Routes Transmit BGP Updates Apply Import Policies Best Route Selection Best Route Table Apply Export Policies Install forwarding Entries for best Routes. IP Forwarding Table
BGP Attributes Value Code Reference ----- --------------------------------- --------- 1 ORIGIN [RFC1771] 2 AS_PATH [RFC1771] 3 NEXT_HOP [RFC1771] 4 MULTI_EXIT_DISC [RFC1771] 5 LOCAL_PREF [RFC1771] 6 ATOMIC_AGGREGATE [RFC1771] 7 AGGREGATOR [RFC1771] 8 COMMUNITY [RFC1997] 9 ORIGINATOR_ID [RFC2796] 10 CLUSTER_LIST [RFC2796] 11 DPA [Chen] 12 ADVERTISER [RFC1863] 13 RCID_PATH / CLUSTER_ID [RFC1863] 14 MP_REACH_NLRI [RFC2283] 15 MP_UNREACH_NLRI [RFC2283] 16 EXTENDED COMMUNITIES [Rosen] ... 255 reserved for development Most important attributes Not all attributes need to be present in every announcement From IANA: http://www.iana.org/assignments/bgp-parameters
LOCAL_PREF Attribute Forces outbound traffic to take primary link, unless link is down.
NEXT_HOP Attribute • EGP: IP address used to reach the advertising router • IGP: next-hop address is carried into local AS
AS_PATH Attribute • Used to detect routing loops and find shortest paths
Shedding Inbound Traffic with ASPATH Prepending Prepending will (usually) force inbound traffic from AS 1 to take primary link AS 1 provider 192.0.2.0/24 ASPATH = 2 2 2 192.0.2.0/24 ASPATH = 2 primary backup customer 192.0.2.0/24 AS 2 Yes, this is a Glorious Hack …
… But Padding Does Not Always Work AS 1 AS 3 provider provider 192.0.2.0/24 ASPATH = 2 192.0.2.0/24 ASPATH = 2 2 2 2 2 2 2 2 2 2 2 2 2 AS 3 will send traffic on “backup” link because it prefers customer routes and local preference is considered before ASPATH length! Padding in this way is often used as a form of load balancing primary backup customer 192.0.2.0/24 AS 2
COMMUNITY Attribute to the Rescue! AS 3: normal customer local pref is 100, peer local pref is 90 AS 1 AS 3 provider provider 192.0.2.0/24 ASPATH = 2 COMMUNITY = 3:70 192.0.2.0/24 ASPATH = 2 primary backup Customer import policy at AS 3: If 3:90 in COMMUNITY then set local preference to 90 If 3:80 in COMMUNITY then set local preference to 80 If 3:70 in COMMUNITY then set local preference to 70 customer 192.0.2.0/24 AS 2
¾ wedgie BGP Issues - What is a BGP Wedgie? • BGP policies make sense locally • Interaction of local policies allows multiple stable routings • Some routings are consistent with intended policies, and some are not • If an unintended routing is installed (BGP is “wedged”), then manual intervention is needed to change to an intended routing • When an unintended routing is installed, no single group of network operators has enough knowledge to debug the problem Full wedgie
YouTube blocking • Pakistan blocks YouTube • How? (according to BBC) • Advertise a shorter route to reach YouTube • The incorrect short route gets propagated • Seen by two thirds of the Internet • Traffic to YouTube goes through Pakistan • Since Pakistan blocked YouTube, all traffic reaches a dead end!
Dynamic Routing Protocols: Summary • Dynamic routing protocols: RIP, OSPF, BGP • RIP uses distance vector algorithm, and converges slow (the count-to-infinity problem) • OSPF uses link state algorithm, and converges fast. But it is more complicated than RIP. • Both RIP and OSPF finds lowest-cost path. • BGP uses path vector algorithm, and its path selection algorithm is complicated, and is influenced by policies. • BGP has its own problems see WIDGI by Tim Griffin
More Readings (Optional) • BGP Wedgies: Bad Routing Policy Interactions that Cannot be Debugged • JI’s Intro to interdomain routing. • "Interdomain Setting of PlanetLab Nodes." PlanetLab Meeting, May 14, 2004. • Understanding the Border Gateway Protocol (BGP) • ICNP 2002 Tutorial Session
Agenda • Autonomous Systems (AS) • Policy vs. distance based routing • Border gateway protocol (BGP) • Transmission control protocol (TCP)
Transmission Control Protocol (RFC) • Reliable and in-order byte-stream service • TCP format • Connection establishment • Flow control • Reaction to congestion • Packet corruption
TCP Format • TCP segments have a 20 byte header with >= 0 bytes of data.
TCP header fields • Sequence Number (SeqNo): • Sequence number is 32 bits long. • So the range of SeqNo is 0 <= SeqNo <= 232 -1 4.3 Gbyte • Each sequence number identifies a byte in the byte stream • Initial Sequence Number (ISN) of a connection is set during connection establishment Q: What are possible requirements for ISN ?
TCP header fields • Acknowledgement Number (AckNo): • Acknowledgements are piggybacked, i.e., a segment from A -> B can contain an acknowledgement for a data sent in the B -> A direction Q: Why is piggybacking good ? • A hosts uses the AckNo field to send acknowledgements. (If a host sends an AckNo in a segment it sets the “ACK flag”) • The AckNo contains the next SeqNo that a hosts wants to receiveExample: The acknowledgement for a segment with sequence numbers 0-1500 is AckNo=1501
TCP header fields • Acknowledge Number (cont’d) • TCP uses the sliding window flow protocol (see CS 457) to regulate the flow of traffic from sender to receiver • TCP uses the following variation of sliding window: • no NACKs (Negative ACKnowledgement) • only cumulative ACKs • Example: Assume: Sender sends two segments with “1..1500” and “1501..3000”, but receiver only gets the second segment. In this case, the receiver cannot acknowledge the second packet. It can only send AckNo=1
TCP header fields • Header Length ( 4bits): • Length of header in 32-bit words • Note that TCP header has variable length (with minimum 20 bytes)
TCP header fields • Flag bits: • URG: Urgent pointer is valid • If the bit is set, the following bytes contain an urgent message in the range:SeqNo <= urgent message <= SeqNo+urgent pointer • ACK: Acknowledgement Number is valid • PSH: PUSH Flag • Notification from sender to the receiver that the receiver should pass all data that it has to the application. • Normally set by sender when the sender’s buffer is empty
TCP header fields • Flag bits: • RST: Reset the connection • The flag causes the receiver to reset the connection • Receiver of a RST terminates the connection and indicates higher layer application about the reset • SYN: Synchronize sequence numbers • Sent in the first packet when initiating a connection • FIN: Sender is finished with sending • Used for closing a connection • Both sides of a connection must send a FIN
TCP header fields • Window Size: • Each side of the connection advertises the window size • Window size is the maximum number of bytes that a receiver can accept. • Maximum window size is 216-1= 65535 bytes • TCP Checksum: • TCP checksum covers over both TCP header and TCP data (also covers some parts of the IP header) • 16-bit one’s complement • Urgent Pointer: • Only valid if URG flag is set
TCP header fields • Options:
TCP header fields • Options: • NOP is used to pad TCP header to multiples of 4 bytes • Maximum Segment Size • Window Scale Options • Increases the TCP window from 16 to 32 bits, i.e., the window size is interpreted differently Q: What is the different interpretation ? • This option can only be used in the SYN segment (first segment) during connection establishment time • Timestamp Option • Can be used for roundtrip measurements