Você está na página 1de 45

Getting Started with TCP/IP and the OSI Model

Delivered by ITS Training Services for Penn State

ITS Training Services 23 Willard Building University Park, PA 16802 814-863-9522 itstraining@psu.edu http://its.psu.edu/training/ Version 07/28/2011

Alternative Format Statement


This publication is available in alternative media upon request.

Statement of Non-Discrimination
The Pennsylvania State University is committed to the policy that all persons shall have equal access to programs, facilities, admission, and employment without regard to personal characteristics not related to ability, performance, or qualifications as determined by University policy or by state or federal authorities. It is the policy of the University to maintain an academic and work environment free of discrimination, including harassment. The Pennsylvania State University prohibits discrimination and harassment against any person because of age, ancestry, color, disability or handicap, national origin, race, religious creed, sex, sexual orientation, or veteran status. Discrimination or harassment against faculty, staff, or students will not be tolerated at The Pennsylvania State University. Direct all inquiries regarding the nondiscrimination policy to the Affirmative Action Director, The Pennsylvania State University, 328 Boucke Building, University Park, PA 16802-5901; Tel 814-865-4700/V, 814-863-1150/TTY.

Getting Started with TCP/IP and the OSI Model

Objectives
Part I 7 Layers of the OSI Model
Adjacent and Peer Communication The Encapsulation Process The 7 Layers
Characteristics Devices Protocols

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets, Subnetting, and Summarization Transport Layer: TCP and UDP Configuring TCP/IP in Windows

Objectives
Part I 7 Layers of the OSI Model
Adjacent and Peer Communication The Encapsulation Process The 7 Layers
Characteristics Devices Protocols

7 Layers of the OSI Model


Host Layers
Layer 7 Application Layer 6 Presentation Layer 5 Session Layer 4 Transport

Media Layers
Layer 3 Network Layer 2 Data-Link Layer 1 - Physical

Adjacent, Peer Communication


Horizontal (Peer) communication
Layers use PDUs (Protocol Data Units)
To talk to corresponding layers on other systems

Layers use headers to encapsulate PDUs

Horizontal and Vertical Communication


Application Presentation Session Transport Network Data-Link Physical

Adjacent, Peer Communication


Vertical (Adjacent) communication
Each layer provides and receives services to and from adjacent layers

PDU becomes SDU (Service Data Unit)


Once passed to an adjacent layer

Horizontal and Vertical Communication


Application Presentation Session Transport Network Data-Link Physical

Objectives
Part I 7 Layers of the OSI Model
Adjacent and Peer Communication The Encapsulation Process The 7 Layers
Characteristics Devices Protocols

Encapsulation
The process by which one layer packages its data in headers with fields that adjacent and peer layers understand, in order to facilitate DE-capsulation of data on subsequent systems

Header
Series of fields describing PDU contents Handling instructions and payload information Relevant to both adjacent and peer layers

PDUs at Layers 2, 3 & 4


Layers 5, 6, & 7 collectively build what is referred to as the payload Protocol Data Units
Layer 4 Segment Layer 3 Packet Layer 2 Frame

Objectives
Part I 7 Layers of the OSI Model
Adjacent and Peer Communication The Encapsulation Process The 7 Layers
Characteristics Devices Protocols

Layer 7: Application Layer


Provides services to network-aware applications Flow control and error recovery Protocols at Layer 7
HTTP, SMTP, DNS, FTP, SNMP

Supports user services

Layer 6: Presentation Layer


Data is changed from an application format to a network format Encryption, compression Serializing data into and out of XML Protocols at Layer 6
ASCII (Standard computing)
8 bit binary codes to represent characters

EBCDIC (Mainframe computing)

Layer 5: Session Layer


Manages conversations and sessions between applications at each end TCP sessions are established, maintained, and closed Time management: who transmits and when Protocols at Layer 5
NetBIOS 15 characters for computer names Name resolution A key component for communication between systems on a network

Layer 4: Transport Layer


Bridges the Host and Media Layers Media layers encompass hardware Data divided into pieces Tracks which data belongs to which application Segmentation of data begins Reliability: flow control and error correction Flow control ensures data was received Layer 4 PDU: Segment TCP: Connection-oriented communication UDP: Connectionless communication

Layer 3: Network Layer


Sources and destinations are defined with IP addresses Answers: How do I get there from here? Physical devices are introduced
Routers routing tables

PDU is a Packet Protocols at Layer 3


IP, ARP

Layer 2: Data-Link Layer


Where sources and destinations are defined with MAC (Media Access Control) addresses
A MAC address: burned in - permanent 12 hexadecimal digits (48 bits)

Physical devices
Switches, bridges, NIC cards

Protocols at layer 2
Ethernet, 802.11

Layer 1: Physical Layer


Bits are transmitted across the wire Physical devices, media
Hubs, repeaters Ethernet, fiber, wireless (air)

Protocols at Layer 1
10BaseT, 100BaseTX, T1 Media specifications

10

End of Part I
Questions on the 7 layers of the OSI model?

TCP/IP: Definitions & History

11

Introduction to TCP/IP
Branch of DoD ARPA
Advanced Research Projects Agency

Military implications
Support
Error correction Failover Scaleable Vendor-neutral Still works when part is destroyed

TCP/IP
TCP/IP
The set of communications protocols that implement the protocol stack on which the Internet and most commercial networks run

- Wikipedia

12

TCP/IP
TCP/IP protocol stack
The suite of protocols in its entirety

Name is derived from two of the many protocols in the TCP/IP protocol suite
TCP Transmission Control Protocol IP Internet Protocol

A Few Definitions
internet (an internet)
Any network using TCP/IP

Internet (THE Internet)


The public TCP/IP network which connects other internets together Maintained by IANA

13

A Few More Definitions


Bit
The smallest unit of data. 1 or 0. On or off. The presence or absence of voltage.

Byte
8 bits

Octet
8 bits (1 byte) of an IP address Separated by decimals

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets, Subnetting, and Summarization Transport Layer: TCP and UDP Configuring TCP/IP in Windows

14

Elements of an IP Address
4 octets in an IP address:
A.B.C.D

Each octet is an 8 bit number


256 total possibilities (28) in each octet 0 - 255 Octets separated by decimals

32 bits total

Translating binary to decimal


Bits are either on or off Off bits are represented by a 0 On bits are represented by a 1 If a bit is on, its value is counted

15

Translating Binary to Decimal


Bit values in an octet
128, 64, 32, 16, 8, 4, 2, 1

1000 0000 ? 1100 0000 ? 1000 0001 ? 1000 1000 ? 0000 0100 ?

Translating Decimal to Binary


Bit values in an octet
128, 64, 32, 16, 8, 4, 2, 1

150 12 76 210 280

? ? ? ? ?

16

IP Address Overview
Address divided into network and host portions Five classes of IP addresses: A E
Determined by the first octet
140.211.166.198 10001100.11010011.10100110.11000110

How?

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets, Subnetting, and Summarization Transport Layer: TCP and UDP Configuring TCP/IP in Windows

17

Five Classes of IP Addresses


Class A:
8 network bits First octet is 0 127; binary starts with 0

Class B:
16 network bits First octet is 128 191; binary starts with 10

Class C:
24 network bits First octet begins with 192 223; binary starts with 110

The fewer the network bits, the more hosts and subnets* possible

5 Classes of IP Addresses
Class D: Reserved for multicast
First octet is 224 239; Binary starts with 1110

Class E: Reserved for experimentation


First octet is 240 255; binary starts with 1111

18

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets, Subnetting, and Summarization Transport Layer: TCP and UDP Configuring TCP/IP in Windows

Public, Private IP Addresses


Publicly routable addresses
Unique addresses reserved for a single host From classes A, B, or C Exclude network and broadcast addresses Exclude private addresses

Private IP addresses
Set aside for internal use only Alleviate problem of limited addresses

19

Private IP Address Space


10.0.0.0 10.255.255.255
10.0.0.0 / 8 1 class A network

172.16.0.0 172.31.255.255
172.16.0.0 / 12 16 adjoining class B networks

192.168.0.0 192.168.255.255
192.168.0.0 / 24 256 adjacent class C networks

Network and Broadcast IDs


Network Address
Uses all 0s for the host portion of the IP address Identifies a network Used by network devices to direct traffic toward a network 192.168.1.0 / 24

Broadcast Address
Uses all 1s for the host portion of the IP address Represents every address in a particular network or subnet 192.168.1.255 / 24

20

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets, Subnetting, and Summarization Transport Layer: TCP and UDP Configuring TCP/IP in Windows

Subnets
A logical group of addresses within a network If College Ave was a network 100 block might be a particular subnet Allen to Atherton might be a subnet Hosts are defined by the prefix portion of the IP address in common Length of the prefix is defined by a secondary address This is the subnet mask Example: 255.255.255.224

21

Classful Subnet Boundaries


Class A addresses: 8 network bits Class B addresses: 16 network bits Class C addresses: 24 network bits Respectively, their classful subnets:
255.0.0.0 255.255.0.0 255.255.255.0

Subnetting at Classless Boundaries


No subnets when network is divided at a classful boundary Subnetting is done by borrowing host bits Subnetting at classless boundary
216.186.145.0 / 27 IP: 216.186.145.0 mask: 255.255.255.224 Creates 8 subnets with 30 hosts in each 23 = 8 25 = 32; 32 2 = 30

22

Subnetting review
Borrows bits from the host portion to create a subnet address The more bits borrowed, the more subnets can be created And the fewer hosts for each subnet All hosts on a common subnet will have a common subnet address

You Do One
A company has 12 departments and wants to create a subnet for each department The smallest department has 7 employees; the largest has 14 They have been assigned 220.10.20.0 What should they do?

23

Questions To Ask:
12 Departments; 7 12 employees each 220.10.20.0 What class address is this? How many host bits do I need to borrow to get the number of subnets that I need? Will this leave enough hosts in each subnet to accommodate the departmental need?

The answer
Borrow 4 bits:
220.10.20.0 / 28 220.10.20.0 255.255.255.240 Subnets: 24 = 16; 16 2 = 14 subnets Hosts: 24 = 16

What do see as a potential problem with this solution?

24

Route Summarization
Addresses must be carefully allocated, hierarchically, ahead of time Useful for Classless Inter-Domain Routing (CIDR)
Subnet masks are passed as well as the network address

Limits the size of routing tables Decreases network overhead Lowers processing time for routers and firewalls

Route Summarization
For example:
10.32.35.0 and 10.32.45.0 and 10.32.55.0 Can be summarized as: 10.32.32.0/19

If all networks exist via the same port One entry to process, rather than three

25

Route Summarization
How its done:
Convert each network to binary
00001010.00100000.00100011.00000000 00001010.00100000.00101101.00000000 00001010.00100000.00110111.00000000

Identify the bits in common


00001010.00100000.001

Write out as a network number


10.32.32.0 / 19 /19 because there are 19 bits in common

You Do One
146.186.20.0 146.186.21.0 146.186.26.0 146.186.30.0 00010100 00010101 00011010 00011110

146.186.16.0 / 20

26

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets and Subnetting Transport Layer: TCP and UDP Configuring TCP/IP in Windows

TCP (Transmission Control Protocol)


Connection-oriented 3-way handshake
SYN SYN-ACK ACK (establish) FIN FIN-ACK ACK (terminate)

Flow control
Windowing (window size) Sequence numbers

Error correction
Checksum Acknowledgments

27

TCP
Each segment of data has a header with a sequence number and is acknowledged Window: the number of segments that can be exchanged per acknowledgement Using sequence numbers, data is reassembled in its original form

Layer 4 TCP Header

28

UDP (User Datagram Protocol)


Greatly simplified
No 3-way handshake No windowing No retransmission No sequence numbers or acknowledgements

Just blasts out the data

Layer 4 UDP Header

29

A Few Useful Commands


getmac /v
Name and MAC address for network adapters

Ipconfig /all
MAC, IP, Subnet mask, WINS, DNS, Gateway information

Netstat nao | more


TCP or UDP, local IP & port, foreign IP & port, state, pid

The Big, Simplified Picture


A large amount of data needs to get from A to B:
SYN SYN-ACK ACK Segment the data How many segments can be sent per ACK Continue sending segments until completed Reassembled using sequence numbers FIN FIN-ACK ACK

30

Apply It To The OSI Model


Layer 4 protocols are either TCP or UDP They are encapsulated in a layer 3 packet Receiving end needs to de-encapsulate How does it know which TCP or UDP?
Protocol field in the Layer 3 Header

Remember
A segment is a PDU PDUs provide services to adjacent layers as well as peers

Look again at:


OSI Model and Layer 3 IP (packet) header

Horizontal and Vertical Communication


Application Presentation Session Transport Network Data-Link Physical

31

Layer 3 (Packet) Header

Headers: Protocols vs Ports


Protocols are defined in the Layer 3 header Ports are defined in the Layer 4 header Protocols defined include TCP, UDP, ICMP, more Ports are doors through which any protocol can pass Ports can be closed or open (listening)

32

More on Ports
There are 16 bits for source and destination ports (65,536)
Well-known Ephemeral e.g. HTTP usually uses port 80 Can use ANY port

Well-known ports
Well-known ports are 0 1023 A few examples:
FTP (21), SSH (22), Telnet (23), SMTP (25), DNS (53), HTTP (80), POP3 (110), HTTPS (443) The protocol defines that these services listen on these ports by default

33

Ephemeral Ports
Ephemeral ports range from 1,024 49,151 Temporary ports used to maintain a session Example: HTTP communication Requires two IPs and two ports Source & destination IPs are known Destination port is known (listen on port 80) Source port? Uses an ephemeral port Destination uses this for its destination port When the session is over, the port is recovered

Peek into Packets: Ping

34

Peek into Packets: HTTP

Peek into Packets: TCP

35

Peek into Packets: UDP

Peek into Packets: ARP

36

Objectives
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets and Subnetting Transport Layer: TCP and UDP Configuring TCP/IP in Windows

Configuring TCP / IP
Start View Network Connections Right-click the network adapter Properties Select Internet Protocol Version 4 (TCP/IPv4) Properties

37

Configuring TCP / IP
IP address, subnet mask, gateway, DNS Automatic vs DHCP All IPs unique
common network portion common subnet mask common gateway

IPv6 on the Horizon: Differences

Source: Juniper.net

38

Benefits of IPv6
Vastly more address space Simplified header decreases overhead Labeling of traffic flows Authentication of traffic

IPv6 Notation
Format
32 hex characters - 8 groups of 4 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx

39

4 Types of IPv6 Addresses


1. Unicast - identifies an interface. 4 Types of Unicast addresses:
Global aggregatable Facilitates aggregation of addresses by routers Link-local no globally unique prefix Facilitates efficient local communication Site-local Private address space Restrict communication to portions of a domain This traffic is not passed beyond the router IPv4 compatible 32-bit address in the lower-order bits ::192.168.1.X

4 Types of IPv6 Addresses


2. Multicast - traffic sent to subscribed interfaces 3. Anycast - traffic is sent to any one of a set of addresses 4. Loopback - traffic is sent to its own interface Any address space without a defined address is said to be unspecified

40

Troubleshooting TCP/IP
Command prompt
Ping to test reachability

Problem Isolation
Can you reach other sites? Can other systems reach the site? Can you reach local computers? Can you reach the local router? Can the local router reach the site?

Summary
Part I 7 Layers of the OSI Model
Adjacent and Peer Communication The Encapsulation Process The 7 Layers
Services at each layer Devices at each layer Protocols at each layer

41

Summary
Part II TCP/IP Primer
Format of IP Addresses Classes of IP Addresses Types of IP Addresses Subnets and Subnetting Transport Layer: TCP and UDP Configuring TCP/IP in Windows

Resources
Technology Training Resources ITS Training Services Web site: http://its.psu.edu/training
Register for training Request group training Take video tutorials View handouts and files Join the Training News list

Online Community: http://technologytraining.psu.edu Technology Help Resources ITS Help Desk: helpdesk@psu.edu or 814-865-HELP ITS Knowledge Base: http://kb.its.psu.edu

42

Technology Training Resources


To look for more advanced sessions of todays training topic visit: http://its.psu.edu/training/catalog/ To browse or register for future technology training visit: http://its.psu.edu/training/ To learn about Training On Demand (sessions upon request for groups of 5 or more) visit: http://its.psu.edu/training/ondemand/ To browse or join in online discussions about technology topics at Penn State visit: http://technologytraining.psu.edu/ To learn about or subscribe to receive training news (RSS) feeds through your news aggregator visit: http://its.psu.edu/training/rss/ To join the Training News List and receive monthly e-mail notification of all upcoming technology training opportunities, send a blank e-mail to: L-TRAINING-NEWS-SUBSCRIBE-REQUEST@LISTS.PSU.EDU To find free online books on a variety of popular technology topics visit: http://proquest.safaribooksonline.com/ To explore hundreds of free video tutorials that are available for self-paced learning visit: http://its.psu.edu/training/lynda/

Technology Help Resources


To contact the ITS Help Desk with general technology-related questions e-mail: helpdesk@psu.edu To search for technology-related information in the ITS Knowledge Base visit: http://kb.its.psu.edu/

Technology Training Provided by ITS Training Services 23 Willard Building University Park, PA 16802 Phone: (814) 863-9522 Fax: (814) 865-3556 itstraining@psu.edu

Visit the ITS Training Services Web site at

http://its.psu.edu/training/

Você também pode gostar