Computer Networks    Spring 2010   Corboy Law 522

Continue intro to IP
UDP/TCP
2.1-2.3
sliding windows

Ethernet switching

    forwarding tables
    one entry for every node

IP

Net/host portions of addresses
Administratively assigned addresses, so that all hosts on the same network can be given the same net portion
IP delivers to destination network; that network must correspond to a physical LAN that can complete the delivery
CLASSIC IP: classes A, B, C (deprecated)
IP header v Ethernet header (ignore fields of IP header for now)
What an IP ROUTER does
        Extraction of Dest_net
Routing tables
Routing table size

No b'cast (well, there is a limited form of IP broadcast, basically intended for your LAN only)

best-effort delivery: if the packet is lost (eg through router queue overflow), the IP layer is not responsible for replacing it. Nor does the IP layer handle acknowledgements.

Example of delivery through a router

IP routing algorithm:
Extract destination_network from packet, and decide if this router connects to that network
Significance of administrative assignment : the destination_network part of each IP address represents something about the host's location.

Compare to Ethernet switch, with per-host forwarding table


A    B    C                         D    E    F
+----+----+--S1-------S2------S3----+----+----+
200.0.0                                                      200.0.1

Ethernet forwarding: S2 has to maintain entries for A,B,C,D,E,F
IP forwarding: S2 has two networks to maintain: 200.0.0/24 and 200.0.1/24

Goal of smaller routing tables
     
Two benefits to IP:
  1. allows interconnection ("internetworking") of incompatible LANs
  2. routing strategy is SCALABLE: works well with very large Internet

UDP

User Datagram Protocol: simple header, no retransmission or acknowledgement features
UDP is a very simple extension to IP; it basically just adds port numbers for application-level multiplexing, and a checksum over the data.
Socket = <host,port>; this acts like a mailbox address in that anything sent to it will be delivered to the receiving application (typically through some sort of socket handle in the underlying OS)

demo of stalkc, stalks (defer)
demo with two clients

TCP

Adds:
stream-oriented connection: no application packetization
reliability
port-number mulitplexing like UDP
Also: uses sliding-windows to keep max traffic en route at any one time
Adapts sliding-windows to manage congestion

You connect TO a socket = <host,port>
Everything sent on that connection goes to same place.
<host,port> doesn't received directly;
only "connected_sockets" receive data; you can only receive data from the endpoint to which you are connected.

TCP semantics are more like "telephone" semantics, for a room with dozens of phones all answering to the same phone number (eg for telephone sales). Each remote phone's data goes to, say, 1-800-LOYOLA1, but it is routed by the phone switch to the correct phone based on what phone it came from. That way, each remote phone has its own connection.



Uses:
TCP: telnet, http/ftp
UDP: voice/video. Why?


Chapter 2

Direct links: 
    Read 2.1: basic ideas
        "as a network node, a workstation runs at memory speeds, not CPU speeds"
        
encoding and framing:
    encoding: recognizing byte boundaries
    framing: recognizing packet boundaries
    These are related, though not the same.
    
2.2: NRZ. Problem with NRZ. Manchester and 4B/5B
        NRZ: 0=lo, 1=hi
        NRZI: 0=notransition, 1=transition
The central problem with these is clock desynchronization, so the receiver loses track in long runs of 0's or 1's and interprets 10 bits as either 9 or 11. Note that for NRZI, long runs of 1 bits do not pose a problem.

Manchester encoding: add clock pulse between each 0/1 . This means that the signaling rate is now double the data rate, eg 20 MHz for 10Mbps Ethernet (which does use Manchester encoding).
            
4b/5b: For each 4-bit "nybble" of data, we actually transmit a fixed 5-bit code, selected to have "enough" 1-bits. Specifically, each 5-bit code has at most one leading 0-bit and at most two trailing 0-bits. The result is then sent with NRZI, where runs of 1's are ok.  Note that the worst-case run of 0-bits has length three. Note also that the signaling rate here is 1.25 times the data rate. 4b/5b is used in 100-Mbps Ethernet ("fast" Ethernet).
          data         code
            0000    11110
            0001    01001
            0010    10100
            0011    10101
            ..
            1100    11010
            1101    11011
            1110    11100
            1111    11101
            IDLE    11111
            DEAD    00000
            HALT    00100
Note the option for "extra" codes.

2.3: basics of framing (on a dedicated serial link): 
bisync (typical byte-oriented framing)
Basic packet format is SYN SOH header STX data ETX
The ETX byte (End of TeXt) marks the end of the data. What if the data actually includes the ETX byte?
Any ETX in body is "escaped" with an extra DLE char
Any DLE in body is also escaped with an extra DLE
Like C/Java quoted strings: " and \ in body are each escaped with \

HDLC (typical bit-oriented framing)
The special bit-pattern 0111 1110 (exactly six 1-bits in a row) is used to mark packet boundaries.
Whenever five consecutive 1-bits appear, eg 011111, a 0-bit is inserted by the sender (regardless of whether or not the next bit is also a 1). The receiver then knows that
Data:        011110  0111110  01111110
Sent as:    011110  0111110  011111010 (stuffed bits underlined)

Sonet (clock-based)
            starts at STS-1, 9x90 byte grid, 1st 3 bytes of each row is frame header
            scrambling: sent as frame XOR std_random_pattern
            resynchronization based on expected bytes at expected places in header
            sts-3 = 3 sts-1 frames, 9x270
            frames can float
            frame re-synchronization
            need for accuracy in sending voice bytes at 8000/sec
            Basic rate of 51.84 Mbps is exactly 810 bytes/frame * 8 bits/byte * 8000 frames/sec
             
                STS-1    STM-0         51.84 Mbps 
                STS-3    STM-1         OC-3
                STS-12    STM-4        622.08Mbps  (=12*51.84, exactly)
                STS-48    STM-12
                 

Sliding Windows ;  §2.5, P&D 

2.5: stop-and-wait versus sliding windows
four stop-and-wait scenarios
                    (a) Frame/ACK
                    (b) Frame / lost ACK; Frame retransmitted
                    (c) Lost Frame, retransmitted, one ACK sent
                    (d) late ACK (arriving after Frame is retransmitted)
                     
retransmit-on-timeout v. retransmit-on-duplicate
sorcerers' apprentice bug  (both sides retransmit on duplicate)