Download What is an IP address?

Document related concepts

Internet protocol suite wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Transcript
Networking:
Computers
talking to each
other
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Easy & Inexpensive
Our products translate the data between computers and other
machines. This translation works easily and inexpensively…
…because we design
Opto 22 products to
run on non-proprietary
communication
standards…
…like Ethernet and the
Internet Protocol (IP).
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Controlling the world using Computers
We did it first…
…and still do Pamux®, Optomux®, and mistic:
http://www.opto22.com/site/co_history.aspx
http://www.opto22.com/site/pr_cat_c.aspx?qs=10031006&
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Networking Standards, Layers, TLAs
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
OSI model
Message sent
from system A
Each layer adds
on its own header
Message passed
to system B
Header is stripped
off at each layer
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Encapsulation of data
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
An Ethernet and IP Analogy
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
An Ethernet and IP Analogy
Internet Protocol (and layers above like TCP and UDP) is like the dial tone,
and it is the core of “Ethernet in Automation”
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
MAC and PHY
Layers
Understanding the Media Access
Control (MAC) and Physical (PHY)
Layers
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
What Do We Mean by “Ethernet”?
A physical layer; the most widely used interconnect
standard for LANs
To Opto 22:
Used to describe a family of products
Used to describe a complete system architecture
TCP/IP and UDP/IP Transport are most common over Ethernet
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Introduction to Ethernet
History
Developed at the XEROX Palo Alto
Research Center (PARC)
Invented by Bob Metcalfe (and others) in
the 1970s
Formulated Metcalfe's law:
the value of a network equals
approximately the square of the number
of users of the system
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Media Access Control
Polling (master/slave)
Token passing
Special packet passed from node to node
Deterministic
Used in ARCNET
Contention (CSMA/CD)
First come, first served
Probabilistic
Used in Ethernet, most bus topologies
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Carrier Sense, Multiple Access
Carrier Sense:
Listen for presence of a signal
If all clear, send preamble, message
Multiple Access:
many nodes
all have equal access to the wire
two or more nodes may attempt to use the wire at the same time
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Collision Detection
Multiple nodes may try to transmit simultaneously due to
propagation delay
Data transmitted is useless
Backoff algorithm is used to retransmit data
Stations listen for signal,
then transmit
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Ethernet Cabling
UTP (Unshielded Twisted Pair)
10BASE-T
100BASE-TX
Use Category 5 or Cat 6 (CAT 5e) or better
Advantages
Inexpensive, widely available,
and widely used
Disadvantage
Limited segment length (100m)
Two main types
Straight-through
Crossover
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Direct vs. Crossover Cables
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Hubs, Switches, Routers
Hubs
Multi-port repeater
A virtual bus
Not recommended
Switch
Switches
“Smart” hub
Dramatically improved, deterministic
performance
Each segment is separate collision
domain
Highly recommended
Routers
Router
Commercial and consumer
Connect separate networks
Route IP traffic
Offer NAT, DHCP
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Networking Systems
SNAP on an independent Ethernet network
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Networking Systems
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Connections among networks
WAN
Router
Router
LAN 1
LAN 2
Switch
Switch
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Training Room Configuration
Station 1
Station 2
Station 3
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Networking SNAP Ethernet Systems
Telephone lines
Communicating via Modem
PPP (point-to-point protocol) on a asynchronous serial port
A Physical and Link Layer
PPP is a Data Link (L2) standard
RS-232 is an example of the Physical Layer
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
The Data Link Layer
The Media Access Controller (MAC)
framing and addressing
backoff
error detection
MAC address
unique hardware identifier
Opto: 00-A0-3D-XX-XX-XX
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
IP Layer
Understanding the role of
Internet Protocol (IP)
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Comparison of the Models
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
What is an IP address?
Identifies a device on a network
Made up of four octets separated by decimal point
octet1.octet2.octet3.octet4
Each octet (byte)
8 bit, 256 possible values
binary representation: 11001010
octet is written as decimal value (e.g. 0 – 255)
11001010 = 202
Result:
10.0.0.1
192.168.1.1
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Components of an IP address
Two parts to an IP address
Network ID
Host (Device) ID
Analogy – telephone numbers: 951-695-3000
Area code: 951
local number: 695-3000
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Default Examples
10.1.2.34
Class A
10.0.0. 0
Network ID:
0.1.2.34
Host ID:
Class B
Network ID:
Host ID:
Class C
Network ID:
Host ID:
129.224.21.253
129.224. 0.
0.
0
0.21.253
207.21.32.12
207.21.32. 0
0. 0. 0.12
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Question:
How do you determine which portion of the IP
address is the Network ID, and which portion is the
Host ID?
Answer:
Use the subnet mask!
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
A special octet
2
7
128
6
5
4
2
2
2
64
32 16
3
2
1
0
2
2
2
2
8
4
2
1
11111111 = 255
because:
1(128)+1(64)+1(32)+1(16)+1(8)+1(4)+1(2)+1(1) =
128 + 64 + 32 + 16 + 8 + 4 + 2 +1 = 255
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Default Subnet Mask Example
IP address – Class A:
Default subnet mask:
10
10.192.16.5
255.0.0.0
192
16
5
IP Address: 00001010 11010100 00010000 00000101
Subnet mask: 11111111 00000000 00000000 00000000
Network ID
Network ID:
Host ID:
Host ID
10.0.0.0
0.192.16.5
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Default Subnet Mask Example
IP address – Class C:
Default subnet mask:
192
192.168.54.2
255.255.255.0
168
54
2
IP Address: 11000000 10101000 00110110 00000010
Subnet mask: 11111111 11111111 11111111 00000000
Network ID
Network ID:
Host ID:
Host ID
192.168.54.0
0.0.0.2
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Complex Subnet Mask Example
IP address:
Subnet mask:
10
10.192.96.5
255.255.192.0
192
96
5
IP Address: 11000000 10101000 01100000 00000101
Subnet mask: 11111111 11111111 11000000 00000000
Network ID: 11000000 101010000 10—— —————
Network ID
Network ID:
Host ID:
Host ID
10.192.64.0
0.0.96.5
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Assigning IP Addresses
Network IDs
All devices in network must have same network ID
Cannot be all 1s or 0s
Host IDs
All devices in network must have unique host ID
Cannot be all 1s (broadcast)
Cannot be all 0s (designates network ID)
Cannot be 127.0.0.1 (loopback address)
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Example 1
Network ID: 10.0.0.0
Subnet mask for all devices: 255.0.0.0
10.3.22.4
10.1.2.34
10.0.23.4
10.3.22.5
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Example 2
Network ID: 192.10.32.0
Subnet mask for all devices: 255.255.255.0
192.10.32.5
192.10.32.15
192.10.32.115
192.10.32.8
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
What You Need To Remember:
For devices to be able to communicate directly
(i.e. not through a gateway)
All network IDs must be the same
All devices must have unique host ID
All devices must have same subnet mask
For more info, see:
http://www.learntosubnet.com
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Will It Work?
IP Address:
10.0.1.3
IP Address:
10.1.2.3
Subnet mask:
255.0.0.0
Subnet mask:
255.0.0.0
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Will It Work?
IP Address: 10.0.1.3
IP Address: 10.1.2.3
Subnet mask: 255.0.0.0
Subnet mask: 255.0.0.0
Net ID: 10.0.0.0
same
Host ID: 0.0.1.3
different
Net ID: 10.0.0.0
Host ID: 0.1.2.3
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Will It Work?
IP Address:
168.20.64.1
IP Address:
168.20.127.254
Subnet mask:
255.255.255.0
Subnet mask:
255.255.255.0
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Will It Work?
Brain IP address:
Subnet mask:
168.20.64.1
255.255.255.0
IP Address:
00000001
Subnet:
10101000 00010100 01000000
Network ID:
168.20.64.0
PC IP address:
Subnet mask:
11111111 11111111 11111111 00000000
Host ID: 0.0.0.1
168.20.127.254
255.255.255.0
IP Address:
Subnet:
10101000 00010100 01111111 11111110
11111111 11111111 11111111 00000000
Network ID:
168.20.127.0
Host ID: 0.0.63.1
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Will It Work?
IP Address:
193.20.64.8
IP Address:
193.20.64.118
Subnet mask:
255.255.255.0
Subnet mask:
255.255.255.0
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Will It Work?
IP Address:
193.20.64.0
IP Address:
193.20.64.255
Subnet mask:
255.255.255.0
Subnet mask:
255.255.255.0
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
IP Addressing Guidelines
Getting a public Internet Protocol (IP) address
Contact your ISP (Internet Service Provider)
Private LAN
Class A – 10.0.0.0 - 10.255.255.255
From your IT group or network administrator
Any valid address can be used
IANA/ICANN has reserved IP address blocks for private networks
Class B – 172.16.0.0 - 172.31.255.255
Class C – 192.168.0.0 - 192.168.255.255
Popular home networks use classic Class C network/default masks with
network ID of 192.168.1.x and subnet mask of 255.255.255.0
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
IP Exercise
Assign an IP address
to a SNAP PAC S-series controller using OptoBootP
Change IP address
using PAC Manager
Assign secondary IP address
using PAC Manager
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Some Internet Layer Protocols
Address Resolution Protocol (ARP)
Internet Protocol (IP)
Boot Protocol (BootP)
Dynamic Host Configuration Protocol (DHCP)
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Addressing Problem
Ethernet cards have 48-bit MAC (physical addresss)
Software uses 32-bit IP addresses (logical address)
No direct correlation between the MAC and IP addresses
MAC address larger than 32-bit IP address
One address (MAC or IP) may remain fixed, while the other changes
Solution: Address Resolution Protocol (ARP)
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Address Resolution Cache
Stores MAC and IP addresses
Before sending an ARP request, host checks its ARP cache
When sending an ARP request, host also includes own IP and
MAC addresses
Entries have limited life span
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
ARP example
Machine A wants to send a message to 10.20.30.40
1.
Machine A
10.20.30.50
A checks its
ARP cache for
an entry for
10.20.30.40
Machine B
10.20.30.60
2. Broadcasts an ARP request:
I am 10.20.30.50
MAC 00:aa:00:aa:00:aa
Who is 10.20.30.40?
Machine C
10.20.30.40
Machine D
10.20.30.70
Machine E
10.20.30.80
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
ARP example, con’t
Machine A
10.20.30.50
1. Machine C adds Machine A’s info to its
ARP cache:
2. Machine C then sends an ARP reply
to Machine A:
A’s IP:10.20.30.50
A’s MAC address: 00:aa:00:aa:00:aa
I am: 10.20.30.40
My MAC address: 0:cc:00:cc:00:cc
Machine C
10.20.30.40
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
ARP example, con’t
Machine A
10.20.30.50
1. Machine A adds Machine C’s info to its
ARP cache:
C’s IP:10.20.30.40
C’s MAC address: 00:cc:00:cc:00:cc
2. Machine A now knows that
10.20.30.40 is associated with
00:cc:00:cc:00:cc and can send
Machine C the datagram.
Machine C
10.20.30.40
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
ARP Exercise
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Transport
Layer
Understanding
TCP and UDP
Transmission Control Protocol
and User Datagram Protocol
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Comparison of the Models
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
TCP and UDP Protocols
Transmission Control Protocol (TCP)
Connection oriented
Reliable data flow
Full duplex
Acknowledgement required
Significant overhead to implement reliability mechanisms
May exhibit slow response to network failures
Data integrity with checksum and sequence numbers
User Datagram Protocol (UDP)
Connectionless
Unconfirmed or “unreliable” delivery
Less overhead and much faster
Datagrams rather than byte stream
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
TCP: reliable data flow
Reliable delivery
Receipt acknowledgment
Retry timers (Opto 22 products default: 3 sec)
Maximum # of retries (Opto 22 products default: 5)
Data integrity
Checksum
Sequence numbers
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
TCP analogy
Establish a session (RING)
Acknowledge (Hello?)
Acknowledge (Hi)
Transfer Data (The reason I’m calling…)
Acknowledge (Okay..)
Close session (Bye)
Acknowledge (Bye)
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
User Datagram Protocol (UDP)
connectionless: packets delivered to sockets,
but no connection established beforehand
“unconfirmed delivery”: no retries, no ordering,
no flow control
less overhead: much smaller header & simpler
protocol
faster
datagrams rather than byte stream
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
UDP analogy
If you have a mailbox, anyone can send you mail
(UDP datagram)
US Mail = UDP transport
Mailbox = Port #
Return
Address
Destination Address
(Destination Port)
To see who sent the mail, look at
the return address
(source address in UDP header)
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
TCP Ports
Port number: refers to a process (i.e. software program)
Ports 1-1023 assigned by IANA for standard applications
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
TCP Sockets
Socket: IP address (location) and port number (process)
IP address stored in IP header
Port number stored in TCP header
Uniquely identifies a TCP connection
All four components cannot be the same
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Opto 22 and TCP vs. UDP
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Application
Layer
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Application-Layer Protocols
The new “fieldbus” war zone
Many protocols to choose from, both vendor and standards
organization developed and/or supported
Choose based on task you need to accomplish
Sample of application-layer protocols supported by Opto 22
OptoMMP
FTP – File Transfer Protocol
SNMP – Simple Network Management Protocol
SMTP – Simple Mail Transfer Protocol
Modbus/TCP
Streaming
OPC
More to come…
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.
Resources
For more information, see
http://computer.howstuffworks.com/internet-infrastructure.htm/printable
http://www.learntosubnet.com
http://en.wikipedia.org/wiki/Ethernet
http://en.wikipedia.org/wiki/Internet_Protocol
For industrial Ethernet tutorials and more, see
Industrial Ethernet University, sponsored by Contemporary Controls
http://www.industrialethernetu.com/index.html
©2008 Opto 22 – All rights reserved. Contents of this document may
not be used without the express written permission of Opto 22.