Post on 26-Dec-2015
transcript
CS-328
OSI Network Model
7
6
5
4
3
2
1
ApplicationLayer
Presentation Layer
SessionLayer
TransportLayer
NetworkLayer
Data LinkLayer
Physical Layer
Provides the interface to a set of network-wide services.Provides such services as: file transfer access and management, document andMessage interchange, job transfer, etc.
Provides a syntax independent message interchange service.Provides for data representation conversion and syntax negotiation.
Provides the control structure for communication between applications.Establishes, manages, and terminates sessions between applications.
Provides a message transfer facility independent of underlying network.Provides for end-to-end message transfer.Deals with connection management, fragmentation, flow control, error control.
Breaks data into information packets.Provides a virtual packet carrying end-to-end connection.Deals with routing, addressing, call setup, buffering, and flow control.
Breaks data into information frames.Provides a data link that is free of undetected transmission errors.Deals with framing, data transparency, error control, flow control
Deals with bits. Provides a virtual bit pipe.Provides for the transmission of bit streams over physical medium.Deals with mechanical, electrical, functional, & procedural aspects of medium.
CS-328
LANs
• Local Area Networks– Layers 1 and 2 of the OSI model
– A collection of peer computers connected together with a common wire protocol
• Ethernet
• Token Ring
– for the purpose of local communications
• Printer sharing
• File sharing
– Usually connected together in the same geographical area • Each host identified by its Media Access Control (MAC) address
CS-328
2 Peers Connected Together
PC NIC PCNIC
S S
R R
Crossover Cable
Peer Connections like this are ok for connecting two computers together, connecting additional computers together requires the creation of a Local Area Network (LAN)
CS-328
Ethernet (CSMA/CD)
• Polite Human Communication– Listen before speaking, if someone else is speaking wait for them
to finish
– While speaking, if someone else starts speaking, stop speaking• This collision detection
• Carrier Sense Multi Access w/Collision Detection– Carrier Sense is how you tell if someone else is already talking
– While sending, listen to the receive if you hear someone a collision is occurring so hold off and try later
CS-328
Internetworks
• A network of networks
• Hubs let you build LANs
• To join LANs into a WAN requires a device that works at the Network Layer of the OSI model to bridge the multiple networks– This is usually an IP Router
• Could also be a Switch or a Bridge
CS-328
TCP/IP
• Transmission Control Protocol and Internet Protocol (TCP/IP)– software suite that enables a single, standards
based approach to communications for a heterogeneous wide area network
CS-328
Layering
• Network protocols are usually developed in layers
• TCP/IP protocol suite is a combination of a set of protocols operating at the various layers
CS-328
TCP/IP Layers
Application
Transport
Network
Linkdevice driver and interface card ARP/RARP
IP, ICMP,IGMP
TCP, UDP
Telnet, FTP, SMTP....
CS-328
Link Layer
• Handles all of the details of physically connecting a machine to the network– network card– device driver for the card– operating system
• Protocols– Address Resolution Protocol (ARP)– Reverse Address resolution Protocol (RARP)
CS-328
NetworkLayer
• handles the movements of packets around the network
• routing takes place in the network layer
• protocols– Internet Protocol (IP)– Internet Control Message Protocol (ICMP)– Internet Group Management Protocol (IGMP)
CS-328
Transport Layer
• provides a flow of data between two hosts for the application layer
• Transmission Control Program (TCP)– Reliable Delivery System
• User Datagram Protocol (UDP)– also known as Unreliable Datagram Protocol
CS-328
Application Layer
• handles details of the particular application
• common applications:– Telnet for remote login– File Transfer Protocol (FTP)– Simple Mail Transfer Protocol (SMTP)– Simple Network Management (Protocol)– Ping– DateTime
CS-328
TCP and UDP
• TCP– reliable data flow
• receipt acknowledgement• packet sizing• timeouts• checksuming
– connection based• telephone metaphor
– call another host– caller knows if
answered
• UDP– sends datagrams
(packets) fast– no guarantees– connectionless
• mailbox metaphor– datagram is a letter– put letter into
mailbox– hope someone picks
it up
CS-328
TCP Frame• 16 bit Source Port number
• 16 bit Destination Port Number
• 32 bit Sequence Number
• 32 bit Acknowledgement Number
• 4 bit Data Offset
• 6 bit reserved
• 1 bit Urgent Flag (URG)
• 1 bit Acknowledgement Field is valid (ACK)
• 1 bit Push Function (PSH)
• 1 bit Reset connection (RST)
• 1 bit Synchronized sequence numbers (SYN)
• 1 bit No more data from sender (FIN)
• 16 bit Window field (# of bytes sender is willing to accept)
• 16 bit checksum (one’s complement sum of all 16 bit words in the header and data)
• 16 bit urgent pointer (add to sequence # of this segment, this pointer to last octet of urgent data
• options -
• padding
• data
CS-328
TCP Connection - Establish
• TCP establishes a connection between two hosts by performing a 3-way handshake, this will establish a virtual connection between the two hosts Host 1 Host 2
Send SYN seq=x
Receive SYN segment
Send SYN seq=y, ACK x+1
Receive SYN + ACK segment
Send ACK y+1
Receive ACK Segment
Network Messages
CS-328
TCP Connection - Closing
Send FIN seq=x
Receive FIN segment
Send ACK x+1
Receive FIN + ACK segment
Send ACK y+1
Receive ACK Segment
Network Messages
Send FIN ,ACK seq=x+1Receive ACK segment
CS-328
Client/Server and TCP/IP
FTP Client
FTP Server
TCPTCP
IP IPIP
Ethernet driver
Ethernet driver
Ethernet
FTP Protocol
TCP Protocol
IP Protocol
Ethernet Protocol
CS-328
IP Routing and protocol conv.
FTP Client
FTP Server
TCPTCP
IP IP
Ethernet driver
Token ring Driver
Ethernet
FTP Protocol
TCP Protocol
IP Protocol IP Protocol
IP
Router
Ethernet driver
Token ring driver
Token Ring
CS-328
A Clearer Picture
User Process
User Process
User Process
User Process
TCP UDP
IPICMP IGMP
Hardware Interface
ARP RARP
Application
Transport
Network
Link
media
CS-328
Internet Addresses (IPv4)
• 32 bit number– written as 4 decimal numbers seperated by
periods (dotted decimal notation)
• Five classes of internet addresses– class A thru class E
• netid are issued by InterNIC (Internet Network Information Center) also registers domain names
CS-328
Class A
00
7 bits7 bits
netidnetid
24 bits24 bits
hostidhostid
0.0.0.00.0.0.0 thru 127.255.255.255 thru 127.255.255.255
CS-328
Class B
128.0.0.0 thru 191.255.255.255128.0.0.0 thru 191.255.255.255
1010 netidnetid
14 bits14 bits 16 bits16 bits
hostidhostid
CS-328
Class C
192.0.0.0 thru 223.255.255.255192.0.0.0 thru 223.255.255.255
110110
21 bits21 bits 8 bits8 bits
netidnetid hostidhostid
CS-328
Class D
224.0.0.0 thru 239.255.255.255224.0.0.0 thru 239.255.255.255
1110
28 bits
multicast group id
CS-328
Class E
240.0.0.0 thru 247.255.255.255240.0.0.0 thru 247.255.255.255
1111011110
27 bits27 bits
reserved for future usereserved for future use
CS-328
IPv6 (IPng)
• 128 bit number– written as 8 decimal numbers separated by colons
• 3 types of addresses– Unicast - a packet sent to a unicast address is delivered to the interface
identified by that address
– Anycast - an identifier for a set of interfaces(typically belonging to different nodes). A packet sent to an anycast address is delivered to one of the interfaces identified by the address (the “nearest” identified by the routing protocol’s measure of distance)
– Multicast - An identifier for a set of interfaces ( typically belonging to different nodes). A packet sent to a multicast address will be delivered to all interfaces identified by that address.
CS-328
IPv6 Text representation of Addresses
• Preferred form:– x:x:x:x:x:x:x:x
• where each x represents a 4 hexadecimal digit 16-bit piece of the address– FEDC:BA89:7654:3210:FEDC:BA98:7654:3210
– 1080:0:0:0:8:800:200C:417A
– note - leading zeros are not required
– note- pieces consisting of all zero bits may be shown as ::
• Alternative form– sometimes used in mixed IPv4 and IPv6 environments
• x:x:x:x:x:x:d.d.d.d– where x represents high order 6 pieces of IPV6 address and the 4 d’s represent the
IPv4 address
CS-328
IPv4 to IPv6 transition
0000…………………………………………0000 0000 IPv4 address
80 bits 16bits 32 bits
0000…………………………………………0000 FFFF IPv4 address
80 bits 16bits 32 bits
IPv4-compatible IPv6 address (special IPv6 unicast address that contain the IPv4 address)
IPv4-mapped IPv6 address
For tunneling IPV6 packets through an IPv4 infrastructure use:
For nodes that are IPv4 only (do not support IPv6) use:
CS-328
Domain Name System (DNS)
• Distributed database– provides translation between IP addresses and
hostnames (and vice-versa)
• Most TCPIP Applications can use either way of identifying a host (i.e. by host name or IP address)
CS-328
Encapsulation
user data
user dataApp.Hdr
user dataApp.HdrTCP Hdr
user dataApp.HdrTCP HdrIP Hdr
user dataApp.HdrTCP HdrIP Hdrethernet hdr
ethernet trailer
ethernet frame
Application
Transport
Network
Link
CS-328
Ports and Sockets
• mean the same thing, part of a buffering scheme
• implemented at transport layer (TCP/UDP)
• 16 bit number in the TCP or UDP header (32767 connection possible)
• ports 1 thru 1023 reserved for “well known ports”
CS-328
Well Known Ports
• ports used for common TCP/IP applications– TCP port 7 - Echo– TCP port 20 - FTP-Data– TCP port 21 - FTP-Commands– TCP port 23 - telnet– UDP port 67 - BOOTP (Server)– UDP port 68 - BOOTP (Client)– UDP port 69 - TFTP– etc
CS-328
Java and sockets
• supports both TCP and UDP sockets– also multicast under RMI
• provided both ends of a TCP application connection (i.e. client and server facilities)
• java.net
• also provides URL connections
• can be used to implement almost any existing internet protocol.