Protocols

Part 2

1/28/2009

Oh Yeah ...

Oh Yeah ...

Oh Yeah ...

Netmask

Homework

Questions?

Beyond Ethernet

Beyond Ethernet

Synchronous Digital Hierarchy
but are not otherwise compatible (that's the problem with pre-standards)
  • OC-1 base rate is 51.84 Mbps
  • STS frame has 9 rows of 90 octets
    • first 3 octets per row are overhead, 6 for section, 18 for line

Beyond Ethernet

98% of all networks are Ethernet

ARP (Review)

ARP Packet (Review)

it's an Ethernet packet with an ARP payload/message

ARP Packet (Review)

Transmission Process: Before

Transmission Process: Before

DNS (by numeric IP) so you don't need to know destination's numeric IP address
assumes DNS is local, although it could be behind the default router

Pre-Transmission Process: Local

 source nodepacket descriptiondestination node
1me.dept.university.eduARP broadcast for MAC address of DNS server at known numeric IP addressL2 broadcast (to all)
2dns.university.eduARP unicast replyme.dept.university.edu
3me.dept.university.eduDNS unicast request for numeric IP address of neat-stuff.university.edudns.university.edu
4dns.university.eduDNS unicast reply with numeric IP address of neat-stuff.university.edume.dept.university.edu
5me.dept.university.eduARP broadcast for MAC address to the IP address for neat-stuff.university.eduL2 broadcast (all)
6neat-stuff.university.eduARP unicast replyme.dept.university.edu
now local-area data transmission between two hosts can begin

Pre-Transmission Process: Wide Area

 source nodepacket descriptiondestination node
1me.dept.university.eduARP broadcast for MAC address of DNS server at known numeric IP addressL2 broadcast (all)
2dns.university.eduARP unicast replyme.dept.university.edu
3me.dept.university.eduDNS unicast request for numeric IP address for neat-stuff.company.comdns.university.edu
4dns.university.eduDNS unicast reply with numeric IP address of neat-stuff.company.comme.dept.university.edu
5me.dept.university.eduARP broadcast for MAC address of my-default-router.university.eduL2 broadcast (all)
6my-default-router.university.eduARP unicast replyme.dept.university.edu
now wide-area data transmission through my-default-router can begin

ICMP

ICMP echo request gets ICMP echo reply
path instability makes TCP really upset
send 3 packets with TTL of 1, first router sends back ICMP error that it had to drop that packet
send 3 packets with TTL of 2, second router sends back ICMP error
and so on, until you get to specified destination

ICMP

so usual Ethernet and IP headers, ICMP is the "IP payload," the message in the IP envelope
  • 8 bits - type
  • 8 bits - code
  • 16 bits - checksum
  • optional ICMP message

ICMP message is optional

Common ICMP Types and Codes

typecodedescriptionquery/error
00echo reply (ping)query
40source quench (basic flow control)error
50network redirect (redirect type)error
51host redirecterror
52redirect for ToS and networkerror
53redirect for ToS and hosterror
80echo request (ping)query
110TTL of 0 during transit (time exceeded type)error
111TTL of 0 during reassemblyerror
300traceroute packet successfully forwarded (traceroute type for future use in RFC 1393)query
301traceroute packet discarded - no routequery

All About ICMP

just make sure you understand and can use ping and traceroute!

wikipedia

typecodedescriptionquery/error
00echo reply (ping)query
30network unreachable (destination unreachable type)error
31host unreachableerror
32protocol unreachableerror
33port unreachableerror
34fragmentation needed but don't-fragment bit seterror
35source route failederror
36destination network unknownerror
37destination host unknownerror
38source host isolated (obsolete)error
39destination network administratively prohibitederror
310destination host administratively prohibitederror
311network unreachable for ToSerror
312host unreachable for ToSerror
313communication administratively prohibited by filteringerror
314host precedence violationerror
315precedence cutoff in effecterror
40source quench (basic flow control)error
50network redirect (redirect type)error
51host redirecterror
52redirect for ToS and networkerror
53redirect for ToS and hosterror
60alternate host addressquery
80echo request (ping)query
90router advertisementquery
100router solicitationquery
110TTL of 0 during transit (time exceeded type)error
111TTL of 0 during reassemblyerror
120bad IP header (catch-all error parameter problem type)error
121missing required optionerror
122bad lengtherror
130timestamp requestquery
140timestamp replyquery
150information request (obsolete)query
160information reply (obsolete)query
170address mask requestquery
180address mask replyquery
19-reserved for securityreserved
20-29-reserved for robustness experimentreserved
300traceroute packet successfully forwarded (traceroute type for future use in RFC 1393)query
301traceroute packet discarded - no routequery
31-datagram conversion error type for next version IP called IPv7 in RFC 1475error
32-mobile host redirect typeerror
33-IPv6 Where-Are-You typequery
34-IPv6 Here-I-Am typequery
35-mobile registration request typequery
36-mobile registration reply typequery

Ports

where you talk about connections (sockets and flows) and services (like reliability)
they assign these numbers!

Layer 4 Tools

hope@mjollnir$ netstat -nr

Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
152.2.145.0          152.2.145.34         U         1   1881  hme0
224.0.0.0            152.2.145.34         U         1      0  hme0
default              152.2.145.1          UG        1   4686  
127.0.0.1            127.0.0.1            UH        2    758  lo0

hope@mjollnir$ netstat -an

UDP: IPv4
   Local Address         Remote Address     State
-------------------- -------------------- -------
      *.111                                 Idle
      *.32771                               Idle
      *.514                                 Idle
      *.177                                 Idle
      *.14001                               Idle
      *.14008                               Idle
      *.7001                                Idle
      *.161                                 Idle
      *.34468                               Idle
      *.34469                               Idle
      *.34486                               Idle

hope@jonilaptop$ netstat -ln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      0 0.0.0.0:902                 0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
tcp        0      0 :::2220                     :::*                        LISTEN      
tcp        0      0 :::5308                     :::*                        LISTEN      
udp        0      0 0.0.0.0:33720               0.0.0.0:*                               
udp        0      0 0.0.0.0:69                  0.0.0.0:*                               
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               
udp        0      0 152.2.145.83:123            0.0.0.0:*                               
udp        0      0 127.0.0.1:123               0.0.0.0:*                               
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               
udp        0      0 :::123                      :::*                                    
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     7862   /tmp/.font-unix/fs7100
unix  2      [ ACC ]     STREAM     LISTENING     11799  /tmp/mapping-hope
unix  2      [ ACC ]     STREAM     LISTENING     10654  /tmp/.gdm_socket
unix  2      [ ACC ]     STREAM     LISTENING     10707  /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     11088  /tmp/ssh-OUhgwY4951/agent.4951
unix  2      [ ACC ]     STREAM     LISTENING     11201  /tmp/orbit-hope/linc-13c8-0-5c5bcd5b900ce
unix  2      [ ACC ]     STREAM     LISTENING     11210  /tmp/orbit-hope/linc-1357-0-6470ed98aeeb1
unix  2      [ ACC ]     STREAM     LISTENING     11387  /tmp/.ICE-unix/4951
unix  2      [ ACC ]     STREAM     LISTENING     11397  /tmp/keyring-t9PiQZ/socket
unix  2      [ ACC ]     STREAM     LISTENING     11407  /tmp/orbit-hope/linc-13cd-0-397813bad8642
unix  2      [ ACC ]     STREAM     LISTENING     11429  /tmp/orbit-hope/linc-13cf-0-7b1251a8177c
unix  2      [ ACC ]     STREAM     LISTENING     75919  /tmp/orbit-hope/linc-33da-0-4dfc566421112
unix  2      [ ACC ]     STREAM     LISTENING     11589  /tmp/orbit-hope/linc-13ec-0-b6f99663b0dd
unix  2      [ ACC ]     STREAM     LISTENING     11625  /tmp/orbit-hope/linc-1400-0-227f500721dbb
unix  2      [ ACC ]     STREAM     LISTENING     11650  /tmp/orbit-hope/linc-13fc-0-227f50076cbb0
unix  2      [ ACC ]     STREAM     LISTENING     11677  /tmp/orbit-hope/linc-13fe-0-54e8a5df113cd
unix  2      [ ACC ]     STREAM     LISTENING     11721  /tmp/orbit-hope/linc-1404-0-54e8a5dfafc18
unix  2      [ ACC ]     STREAM     LISTENING     11759  /tmp/orbit-hope/linc-140e-0-5d0b05321efea
unix  2      [ ACC ]     STREAM     LISTENING     11821  /tmp/orbit-hope/linc-1408-0-681f708c4b2d7
unix  2      [ ACC ]     STREAM     LISTENING     11845  /tmp/orbit-hope/linc-1418-0-598f9ee8e1721
unix  2      [ ACC ]     STREAM     LISTENING     11873  /tmp/orbit-hope/linc-141a-0-7d829a85c7fbf
unix  2      [ ACC ]     STREAM     LISTENING     11900  /tmp/orbit-hope/linc-141c-0-204d0d9054f7e
unix  2      [ ACC ]     STREAM     LISTENING     11950  /tmp/orbit-hope/linc-1421-0-4e5836c38dc2
unix  2      [ ACC ]     STREAM     LISTENING     11981  /tmp/orbit-hope/linc-1423-0-4e5836ca4f33
unix  2      [ ACC ]     STREAM     LISTENING     7398   /var/run/acpid.socket
unix  2      [ ACC ]     STREAM     LISTENING     7965   /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     7792   /dev/gpmctl
unix  2      [ ACC ]     STREAM     LISTENING     11176  @/tmp/dbus-UuQXseCgln
unix  2      [ ACC ]     STREAM     LISTENING     11490  @/tmp/fam-hope-

UDP

User Datagram Protocol
one level of service (for Layer 4) is not to offer any services at all; this is UDP

UDP Packet

TCP

Transmission Control Protocol
lost (or late) packets will be re-transmitted, thanks to ACKs
TCP and UDP are sorta opposites: reliable vs no services, options vs none, complex vs simple

TCP Optimization

TCP Packet: the TCP Header

TCP Packet: the TCP Header

TCP Header Options

Typical TCP Options
kindlength of fields (bytes)option meaning
01end of option list from RFC 793
11no operation (NOP) from RFC 793
21kind (value)=2maximum segment size (MSS), from RFC 793
21length=4ibid
22MSSibid
31kind=3window scale factor, from RFC 1323
31length=3ibid
31shift countibid
81kind=8timestamp, from RFC 1323
81length=10ibid
84timestampibid
84timestamp echo replyibid

Interesting TCP Flags: SYN

find an NPAD server for TCP tuning suggestions (could improve your bulk throughput by 1000x, really!)

Interesting TCP Flags: ACK

TCP Start

3-way handshake
you can see these states, SYN_SENT, SYN_RECD, ESTABLISHED, with the netstat command

TCP Finish

you can see these states, ESTABLISHED, FIN_WAIT_1, CLOSE_WAIT, FIN_WAIT_2, LAST_ACK, CLOSED, with the netstat command
you can see these states with the netstat command

TCP Finish

TCP Traffic Control

TCP Flow Control

TCP Flow Control

TCP Congestion Control

TCP Congestion Control

exponential behavior isn't slow!
"triple duplicate ACK" is the hallmark of a dropped packet; why?
... because an immediate ACK is required upon receipt of an out-of-order packet
  • Reno: congestion window / 2, classic AIMD
  • Tahoe: 1 MSS and slow start

TCP Variants

Coming soon

Light Reading

Questions?