2013年6月14日星期五

Network Fundamentals - OSI Transport Layer

Transport Layer Role and Services



The Transport layer prepares application data for transport over the network and process network data for use by applications.





Functions of OSI Transport Layer


  • Tracking the individual communication between applications on the source and destination hosts
  • Segmenting data and managing each piece
  • Reordering and Reassembling the segments into streams of application data
  • Identifying the different applications



Tracking Individual Conversations


Any host may have multiple applications that are communicating across the network.





Segmenting Data and Reassembling Segments







Identifying the Applications



Each software process that needs to access the network is assigned a port number unique in that host.






Transport Layer Role and Services



Data Requirements Vary
    Efficient Data Delivery  --> UDP Protocol
    Supporting Reliable Communication -->  TCP Protocol








Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)











Transmission Control Protocol (TCP)


  • A connection-oriented protocol


  • It is described in RFC 793.
  • Applications that use TCP are: Web Browsers
     E-mail
     File Transfers





User Datagram Protocol (UDP)


UDP is a simple, connectionless protocol
  •    It provides low overhead data delivery.
  •    It has only 8 bytes of overhead.
  •    No flow control
  •    The segments in UDP are called datagrams.

Applications that use UDP include:
  •    Domain Name System (DNS)
  •    Video Streaming
  •    Voice over IP (VoIP)




Port Numbers


  • Port numbers are used to identify different application
  • Each application has a unique port number
  • Both TCP and UDP use port numbers to pass correct data to the upper layers
  • Port numbers are used as source and destination addresses in the segment






Types of Port Number










Port Numbers in TCP request







Netstat

netstat is a network utility to verify active TCP connections, port on which the computer is listening.






Sequence Number


  • Sequence numbers are used to re-order data segments
  • TCP provides a sequence number to each segment before transmission
  • If a sequence number is missing, that segment need to be re-transmitted
  • If no acknowledgment  within a given time, that segment is re-transmitted





Re-order data segments








Acknowledgment Number


  • Acknowledgment number is the sequence number of next expected segment
  • TCP provides an acknowledgment number to each segment before transmission
  • Ack. No. is used to check any data loss






TCP – Setup a Connection

 






TCP – Three-way Handshake


Handshake – made use of sequence number and acknowledgment to form SYN packet in the establishment of TCP session






TCP Connection Termination





TCP Congestion Control – Flow Control  


  • This Window Size field in the TCP header specifies the amount of data that can be transmitted before an acknowledgment must be received. 
  • TCP feedback mechanism adjusts the effective rate of data transmission to the maximum flow that the network and destination device can support without loss.
  • TCP attempts to manage the rate of transmission so that retransmissions will be minimized. 





Window Size








Sliding Window


Sliding window means that the window size is negotiated dynamically during the TCP connection








UDP Protocol


Connectionless, lower overhead and less delay than TCP




Reassemble PDUs at the destination device, no re-order, no re-sent




Servers use port numbers to identify a specified application layer process and direct segments to the proper service or application





Trace the steps as the UDP protocol and port numbers are utilized in client-server communication.


Network Fundamentals - Addressing the Network IPv4

IP Addressing Structure


The dotted decimal structure of a binary IP address

  • 8-bit binary number forms an octet
  • Represented in dotted decimal form
  • 32-bit binary address
  • Having Network and Host portion (hierarchical addressing)









Convert 8-bit binary to decimal







E.g. Convert 0101100  00010000  00000100  00010100  to 172.16.4.20






E.g. Convert 172.16.4.20 to binary







Type of  IP Addresses


Three types of addresses in the network






Network Prefix


Network prefix (or slash format) - the number of bits in the address that gives us the network portion.

E.g. 172.16.4.0 /24, the /24 is the prefix length - the first 24 bits are the network address.




E.g. Change in prefix length
172.16.4.0 /26, the /26 is the prefix length - the first 26 bits are the network address.







Different Prefixes for different host addresses and broadcast address in a network







Different prefixes


The network address could remain the same, but the host range and the broadcast address are different for different prefix lengths.





More example


Determine the network, broadcast and host addresses for a given address and prefix combination






Types of communication


Three types of communication:
  • Unicast – one to one


  • Broadcast – one to all 

  • Multicast – one to many







Broadcasting Traffic


Directed Broadcast
 A directed broadcast is sent to all hosts on a specific network.
 172.16.4.255

Limited Broadcast
The limited broadcast is used for communication that is limited to the hosts on the local    network.
 255.255.255.255





Reserved IPv4 Address Ranges








Public and Private Host Addresses


Public address
Addresses are designed to be used in the hosts that are publicly accessible from the Internet

Private address
Blocks of addresses that are used in networks that require limited or no Internet access







Network Address Translation (NAT)


Services to translate private addresses to public addresses - hosts on a privately addressed network can have access to resources across the Internet.

NAT services can be implemented on a device at the edge of the private network.






Special IPv4 Addresses



Special addresses - addresses that cannot be assigned to hosts :

Network and Broadcast Addresses - the first and last addresses in each network
Default Route - 0.0.0.0 - 0.255.255.255 (0.0.0.0 /8)
Loopback - hosts use to direct traffic to themselves. 
                    127.0.0.0  - 127.255.255.255 (127.0.0.0 /8)
                     Ping the loopback address to test the configuration of TCP/IP on the local host.


Link-Local Addresses - automatically assigned to the local host by the operating system where no IP configuration is available (let say no DHCP service in dynamic configuration)
169.254.0.0 - 169.254.255.255 (169.254.0.0 /16)

TEST-NET Addresses - for teaching and learning purposes and used in documentation and network examples.
192.0.2.0  - 192.0.2.255 (192.0.2.0 /24)






Classful IPv4 Address


  • Classful Addressing - historic method for assigning addresses and the issues associated with the method
  • Classless Addressing – current method







Role of the subnet mask 


How the subnet mask is used to create and specify the network and host portions of an IP address?
The prefix and the subnet mask are different ways of representing the SAME THING - the network portion of an address.






Leading Consecutive 1s in subnet mask







Trailing Consecutive 0s in subnet mask






Extracting network address  


Use the subnet mask and ANDing process to extract the network address from the IP address.







Subnetting


Subnetting allows for creating multiple logical networks from a single address block.

We can use a router to connect these networks together, each interface on a router must have a unique network ID. Every node on that link is on the same network.




Calculating Addresses 


Use the subnet mask to divide a network into smaller networks and describe the implications of dividing networks for network planners




Formula for calculating the number of subnets:
         2^n where n = the number of bits borrowed

Formula for calculating the number of usable hosts:
        2^m - 2 where m = the number of bits left for hosts.








Example with 3 subnets: (2^2 = 4 > 3)
2^6 - 2 = 62 usable hosts per subnet






Given a subnet address and subnet mask, calculate the network address, host addresses and broadcast address






Given a pool of addresses and masks, assign a host parameter with address, mask and gateway








Given a diagram of a multi-layered network, address range, number of hosts in each network and the ranges for each network, create a network scheme that assigns addressing ranges to each network




Planning to Address Network

 

The allocation of these addresses inside the networks should be planned and documented for the purpose of:

 Preventing duplication of addresses
      Each host in an internetwork must have a unique address.

 Providing and controlling access

      Access to resources such as server can be controlled by the Layer 3 address.

Monitoring security and performance
      We examine network traffic looking for addresses that are generating or receiving excessive packets.




Assigning Addresses


  • Only those devices that will directly access the Internet - such as web servers - require a public address.
  • A NAT service allows those devices with private addresses to share the remaining public addresses.
 
 





Assigning Addresses within a network


Some examples of different types of hosts are:
  •  End devices for users
  •  Servers and peripherals
  •  Hosts that are accessible from the Internet
  •  Intermediary devices


 Assigning Addresses


Statically through an administrator

      Static addresses - for printers, servers, and other networking devices

      It is time-consuming to enter the information on each host.





Dynamically through DHCP

     A preferred method of assigning IP addresses to hosts on large networks











Internet Assigned Numbers Authority (IANA) ( http://www.iana.net ) is the master holder of the IP addresses.

Regional Internet Registries (RIRs) - manage for particular purposes or for regional areas





ISPs are designated by a hierarchy based on their level of connectivity to the Internet backbone.

    Each lower tier obtains connectivity to the backbone via a connection to a higher tier ISP.





The Development of IPv6


  • The exhaustion of the IPv4 network addresses 
  • Improved packet handling
  • Increased scalability and longevity
  • QoS mechanisms
  • Integrated security





IPv6 features

 

  • 128-bit hierarchical addressing - to expand addressing capabilities
  • Header format simplification - to improve packet handling
  • Improved support for extensions and options - for increased scalability/longevity and improved packet handling
  • Flow labeling capability - as QoS mechanisms
  • Authentication and privacy capabilities - to integrate security





Testing the Network Layer 


  • Ping is a utility for testing IP connectivity between hosts.
  • Ping uses a Layer 3 protocol called Internet Control Message Protocol (ICMP).
  • Ping uses an ICMP Echo Request datagram.
  • If the host at the specified address receives the Echo request, it responds with an ICMP Echo Reply datagram.




Pinging the Local Loopback (127.0.0.1) – Testing if TCP/IP configuration is properly installed on the host






Ping Gateway - Testing Connectivity to the Local LAN








Ping Remote Host - Testing Connectivity to Remote LAN





Use tracert/traceroute to observe the path between two devices as they communicate and trace the steps of tracert/traceroute's operation








ICMP (Internet Control Message Protocol)


Services to provide feedback about issues related to the process of IP packets

ICMP Packet – Header