Professional Documents
Culture Documents
Issue:
What is Modbus and How does it work?
Product line:
All Product lines
Environment:
All Serial Numbers
Cause:
Install
Resolution:
What is Modbus?
Modbus is an open protocol, meaning that it's free for manufacturers to build into their
equipment without having to pay royalties. It has become a standard communications protocol in
industry, and is now the most commonly available means of connecting industrial electronic
devices. It is used widely by many manufacturers throughout many industries. Modbus is
typically used to transmit signals from instrumentation and control devices back to a main
controller or data gathering system, for example a system that measures temperature and
humidity and communicates the results to a computer. Modbus is often used to connect a
supervisory computer with a remote terminal unit (RTU) in supervisory control and data
acquisition (SCADA) systems. Versions of the Modbus protocol exist for serial lines
(Modbus RTU and Modbus ASCII) and for Ethernet (Modbus TCP).
The data is sent as series of ones and zeroes called bits. Each bit is sent as a voltage. Zeroes are
sent as positive voltages and a ones as negative. The bits are sent very quickly. A typical
transmission speed is 9600 baud (bits per second).
What is hexadecimal?
When troubleshooting problems, it can be helpful to see the actual raw data being transmitted.
Long strings of ones and zeroes are difficult to read, so the bits are combined and shown in
hexadecimal. Each block of 4 bits is represented by one of the sixteen characters from 0 to F.
Each block of 8 bits (called a byte) is represented by one of the 256 character pairs from 00 to
FF.
Information is stored in the Slave device in four different tables. Two tables store on/off discrete
values (coils) and two store numerical values (registers). The coils and registers each have a
read-only table and read-write table. Each table has 9999 values. Each coil or contact is 1 bit and
assigned a data address between 0000 and 270E. Each register is 1 word = 16 bits = 2 bytes and
also has data address between 0000 and 270E.
Coil/Register Numbers can be thought of as location names since they do not appear in the actual
messages. The Data Addresses are used in the messages. For example, the first Holding Register,
number 40001, has the Data Address 0000. The difference between these two values is the
offset. Each table has a different offset. 1, 10001, 30001 and 40001.
Each slave in a network is assigned a unique unit address from 1 to 247. When the master
requests data, the first byte it sends is the Slave address. This way each slave knows after the first
byte whether or not to ignore the message.
The second byte sent by the Master is the Function code. This number tells the slave which table
to access and whether to read from or write to the table.
What is a CRC?
CRC stands for Cyclic Redundancy check. It is two bytes added to the end of every modbus
message for error detection. Every byte in the message is used to calculate the CRC. The
receiving device also calculates the CRC and compares it to the CRC from the sending device. If
even one bit in the message is received incorrectly, the CRCs will be different and an error will
result. .
The example for FC03 shows that register 40108 contains AE41 which converts to the 16 bits
1010 1110 0100 0001 Great! But what does it mean? Well, it could mean a few things. Register
40108 could be defined as any of these 16-bit data types:
A 16-bit unsigned integer (a whole number between 0 and 65535) register 40108 contains
AE41 = 44,609 (hex to decimal conversion)
A 16-bit signed integer (a whole number between -32768 and 32767) AE41 = -20,927 (hex to
decimal conversion that wraps, if its over 32767 then subtract 65536)
A discrete on/off value (this works the same as 16-bit integers with a value of 0 or 1. The hex
data would be 0000 or 0001) Register 40108 could also be combined with
A 32-bit unsigned integer (a number between 0 and 4,294,967,295) 40108,40109 = AE41 5652
= 2,923,517,522
A 32-bit signed integer (a number between -2,147,483,648 and 2,147,483,647) AE41 5652 = -
1,371,449,774
A 32-bit double precision IEEE floating point number. This is a mathematical formula that
allows any real number (a number with decimal points) to represented by 32 bits with an
accuracy of about seven digits. AE41 5652 = -4.395978 E-11 Here is a spreadsheet IEEE float
calculator for inputs of 4 bytes or 2 words. To download a copy, right click and select Save
Target As...
A four character ASCII string (4 typed letters) AE41 5652 = ® A V R More registers can be
combined to form longer ASCII strings. Each register being used to store two ASCII characters
(two bytes).
What is byte and word ordering?
The Modbus specification doesn't define exactly how the data is stored in the registers.
Therefore, some manufacturers implemented modbus in their equipment to store and transmit the
higher byte first followed by the lower byte. (AE before 41). Alternatively, others store and
transmit the lower byte first (41 before AE). Similarly, when registers are combined to represent
32-bit data types, Some devices store the higher 16 bits (high word) in the first register and the
remaining low word in the second (AE41 before 5652) while others do the opposite (5652 before
AE41) It doesn't matter which order the bytes or words are sent in, as long as the receiving
device knows which way to expect it. For example, if the number 29,235,175,522 was to be sent
as a 32 bit unsigned integer, it could be arranged any of these four ways.
A modbus map is simply a list for an individual slave device that defines - what the data is (eg.
pressure or temperature readings)
- how the data is stored (data types, byte and word ordering)
Some devices are built with a fixed map that is defined by the manufacturer. While other devices
allow the operator to configure or program a custom map to fit their needs.
Modbus RTU and Modbus ASCII talk the same protocol. The only difference is that the bytes
being transmitted over the wire are presented as binary with RTU and as readable ASCII with
Modbus RTU. important to note about RTU is that the RTU message does not have a
Start_of_text indication. The receiving party in the communications uses a "silent" time in order
to determine the start of a new message. ASCII does have a start-of-text token. Binary messages
are shorter than ASCII and therefore theoretically faster to transmit/receive. You may be happy
to see update rates of about 100 ms in your HMI/SCADA and could choose either
communication.
Summary:
- use RTU is possible
- use ASCII in case RTU is giving timeout problems on WinNT or when using slow
communications media like 300 bps or dialup modems Most OPC Servers for Modbus support
ASCII as well as RTU communications..
Since the range of the analog output holding registers is 40001 to 49999, it implies that there
cannot be more than 9999 registers. Although this is usually enough for most applications, there
are cases where more registers would be beneficial. Registers 40001 to 49999 correspond to data
addresses 0000 to 270E. If we utilize the remaining data addresses 270F to FFFF, over six times
as many registers can be available, 65536 in total. This would correspond to register numbers
from 40001 to 105536. Many modbus software drivers (for Master PCs) were written with the
40001 to 49999 limits and cannot access extended registers in slave devices. And many slave
devices do not support maps using the extended registers. But on the other hand, some slave
devices do support these registers and some Master software can access it, especially if custom
software is written.
Since a single byte is normally used to define the slave address and each slave on a network
requires a unique address, the number of slaves on a network is limited to 256. The limit defined
in the modbus specification is even lower at 247. To get beyond this limit, a modification can be
made to the protocol to use two bytes for the address. The master and the slaves would all be
required to support this modification. Two byte addressing extends the limit on the number of
slaves in a network to 65535. By default, the Simply Modbus software uses 1 byte addressing.
When an address greater than 255 is entered, the software automatically switches to 2 byte
addressing and stays in this mode for all addresses until the 2 byte addressing is manually turned
off.
Enron Modbus includes commands for moving events and historical data..
OVERVIEW
Modbus RTU is an open, serial (RS-232 or RS-485) protocol derived from the Master/Slave
architecture. It is a widely accepted protocol due to its ease of use and reliability. Modbus RTU
is widely used within Building Management Systems (BMS) and Industrial Automation Systems
(IAS). This wide acceptance is due in large part to MODBUS RTU’s ease of use.
MODBUS RTU messages are a simple 16-bit CRC (Cyclic-Redundant Checksum). The
simplicity of these messages is to ensure reliability. Due to this simplicity, the basic 16-bit
MODBUS RTU register structure can be used to pack in floating point, tables, ASCII text,
queues, and other unrelated data.
In order to build the MODBUS application data unit, the client must initiate a MODBUS
transaction. It is the function which informs the server as to which type of action to perform. The
format of a request initiated by a Master is established by the MODBUS application protocol.
The function code field is then coded into one byte. Only codes within the range of 1 through
255 are considered valid, with 128-255 being reserved for exception responses. When the Master
sends a message to the Slave, it is the function code field which informs the server of what type
of action to perform.
To define multiple actions, some functions will have sub-function codes added to them. For
instance, the Master is able to read the ON/OFF states of a group of discreet outputs or inputs. It
could also read/write the data contents of a group of MODBUS registers. When the Master
receives the Slave response, the function code field is used by the Slave to indicate either an
error-free response or an exception response. The Slave echoes to the request of the initial
function code in the case of a normal response.
The MODBUS messages on a serial connection are not broadcast in plain format. They are
constructed in a way that allows receivers an easy way to detect the beginning and end of a
message. The characters start and end a frame when in ASCII mode. To flag the start of a
message, a colon ‘:’ is used, and each message is ended with a CR/LF combination. MODBUS
RTU uses a different method. In RTU, framing is constructed by measuring gaps of silence on
the communication line. Before each message, there must be a minimum gap of 3.5 characters.
To prepare for new messages, the receiver clears the buffer when a gap of 1.5 characters is
detected. One of the main differences between MODBUS/ASCII and MODBUS RTU is that
ASCII allows gaps between the bytes of a message with a maximum length of 1 second. With
MODBUS RTU, continuous streams of messages must be sent.
Properties of Modbus/ASCII and Modbus/RTU
Modbus/ASCII Modbus/RTU
Error check LRC Longitudinal Redundancy Check CRC Cyclic Redundancy Check
Start bit 1 1
Data bits 7 8
Stop bits 1 2 1 2
https://www.rtaautomation.com/technologies/modbus-rtu/
What’s The Difference Between The RS-232
And RS-485 Serial Interfaces?
Serial interfaces are used in most electronic equipment today. Some of the original serial interfaces like
RS-232 and RS-485 are still widely used. This article summarizes these interfaces and shows where they
are still used today.
Dozens of serial data interfaces are used today. Most have been developed for specific
applications. A few have become universal, such as I2C, CAN, LIN, SPI, Flex, MOST, and I2S.
Then there’s Ethernet and USB and other higher-speed serial interfaces like FireWire, HDMI,
and Thunderbolt. Two of the oldest interfaces are RS-232 and RS-485. These legacy interfaces
aren’t obsolete or discontinued, though. Both are still alive and well in many applications.
Related: What’s the Difference Between NRZ, NRZI, and Manchester Encoding?
The whole purpose of a serial interface is to provide a single path for data transmission
wirelessly or over a cable. Parallel buses are still used in some applications. But with high-speed
data so common today, a serial interface is the only practical option for communications over
any distance greater than several feet.
Serial interfaces can be used to provide standardized logic levels from transmitters to receivers,
define the transmission medium and connectors, and specify timing and data rates. In some
cases, they can perform serial-to-parallel and parallel-to-serial conversion or specify a basic data
protocol.
Related: What’s The Difference Between Bit Rate And Baud Rate?
The definition of logic levels, medium, and connectors is part of the physical layer (PHY) or
layer 1 of the Open Systems Interconnection (OSI) networking model. Any additional functions
such as data handling is part of the media access control (MAC) layer or layer 2 of the OSI
model.
RS-232
One of the oldest serial interfaces is generically called RS-232. It was originally established in
1962 as a method of connecting data terminal equipment (DTE) such as electromechanical
teletypewriters to data communications equipment (DCE). Over the years its use has included
connections to video terminals, computers, and modems. The first personal computers included
an RS-232 called a serial port for connection to a printer or other peripheral device. Today, it is
still widely used in embedded computer development systems, scientific instruments, and all
sorts of industrial control equipment.
The standard defines a logic 1 and a voltage between –3 and –25 V and a logic 0 as a voltage
level between +3 and + 25 V (Fig. 1). Signal levels are commonly referred to as a mark for logic
1 and a space for logic 0. Voltages between ±3 V are invalid, providing a huge noise margin for
the interface. Noise voltages in this range are rejected. In common practice, logic 0 and 1 levels
are typically as low as ±5 V and as high as ±12 or ±15 V. The transmitter and receiver
configurations are single-ended (not differential) with a ground reference.
1.
Voltage levels define the logic 1 or mark and the logic 0 or space characters. Voltages between
±3 V are invalid.
The cable medium can be simple parallel wires or twisted pair. The length of the cable
determines the upper data rate and generally should not exceed 50 feet. However, much longer
cable lengths can be used with low data rate conditions. Today the primary goal is to use a cable
with no more than 2500 pF of capacitance between wires. This limits the upper data rate to
roughly 20 kbits/s. Because of the low-speed data rates used with this interface, the cable
generally isn’t treated as a formal transmission line. Transmission lines require matched
generator and load impedances to eliminate reflections that cause data corruption.
The standard defined a 25-pin connector called the DB-25, which was designed to carry a variety
of control lines as well as the serial data transmit and receive lines. Such connectors are rarely
used today. Instead, a nine-pin connector called the DE-9 was defined, and today it is the de
facto standard (Fig. 2).
2.
The popular DB9 connector carries the signals shown. The numbers are the pin numbers on the
connector.
Originally, data rates for electromechanical equipment were very slow. A minimum rate was
typically 75 bits/s, but rates of 150 and 300 bits/s were common. Today, data rates are defined by
the protocol used with the interface and can range as high as 115.2 kbits/s. Typical data rates are
1200, 2400, 4800, 9600, 19,200, 38,400, and 115,200 bits/s. The data rate is limited by the
maximum allowed slew rate of 30 V/µs (volts per microsecond). For short low-capacitance
cables, data rates can be as high as several megabits per second with the appropriate drivers.
Many RS-232 connections are one-way or simplex. However, using the special signaling and
control voltages available, two-way or half-duplex operation is possible. The two connected
devices alternate transmitting and receiving operations.
The control signals in the interface define the protocol for transmitting and receiving data. These
signals tell the two communicating devices when they are busy, transmitting, ready, and
receiving. The transmitting device is the DTE such as a computer, and the receiving device is the
DCE such as a printer. The control signals used on the common nine-pin connector are:
Data carrier detect (DCD): The DCE tells the DTE it is receiving a valid input signal.
Data set ready (DSR): The DCE tells the DTE it is connected and ready to receive.
Received data (RD): This is the actual signal received from the DTE.
Request to send (RTS): This signal from the DTE tells the DCE it is ready to transmit.
Transmit data (TD): This is the transmitted signal from the DTE.
Clear to send (CTS): This line from the DCE tells the DTE it is ready to receive data.
Data terminal ready (DTR): This line is from the DTE to the DCE indicating readiness to
send or receive data.
Ring indicator (RI): This line was used in older modem connections but isn’t used
anymore.
Signal ground: This is the common ground connection for all signals.
Figure 3 shows the cable connections from the DTE to the DCE. Note the interconnections
between the control line pins. The signals on these pins occur in response to one another in what
is called a flow control or “handshaking” process.
3.
This is a common connection between the DTE and the DCE devices. Note the connections in
the cable from one connector to the other.
Although not formally part of the RS-232 standard, most serial devices using the interface also
use what is called a universal asynchronous receiver transmitter (UART). This IC, usually
separate from the line driver and receiver circuits, implements a basic communications protocol
that involves transmitting up to 8 bits at a time. It performs serial-to-parallel and parallel-to-
serial conversion, adding start and stop bits to signal the beginning and end of a data word, parity
bit error detection, and establishment of the data rate.
The data is often ASCII characters, but any data word up to 8 bits can be transmitted (Fig. 4).
The UART can usually be configured to handle different word sizes (5 to 8 bits), add 1, 1.5, or 2
stop bits, and include odd, even, or no parity bits. Data rates from 75 bits/s to 115.2 kbits/s are
selectable.
4.
This is the EIA/TIA-232 signal for transmitting a 7-bit ASCII capital letter J. A start bit signals
the beginning of the character. The LSB is transmitter first. An odd parity bit is included. The
transmission ends with a stop bit.
RS-485
Also defined by the EIA/TIA standard, this interface is now called TIA-485. It defines not only a
single device-to-device interface but also a communications bus that can be used to form simple
networks of multiple devices. Its configuration and specifications also extend the range and data
rate beyond the RS-232 interface capabilities.
The RS-485 standard specifies differential signaling on two lines rather than single-ended with a
voltage referenced to ground. A logic 1 is a level greater than –200 mV, and a logic 0 is a level
greater than +200 mV. Typical line voltage levels from the line drivers are a minimum of ±1.5 V
to a maximum of about ±6 V. Receiver input sensitivity is ±200 mV. Noise in the range of ±200
mV is essentially blocked. The differential format produces effective common-mode noise
cancellation.
The standard transmission medium is twisted-pair cable of either #22 or #24 AWG solid
wire. Two lines are minimum but a third reference wire can be used. Four-wire cables can also
be used if full-duplex operation is desired. The cables may be shielded or unshielded, with
unshielded the most common. The cable is treated as a transmission line. The nominal
characteristic impedance is 100 or 120 Ω. Terminating load resistors are required to ensure a
matched line condition, which prevents reflections that introduce data errors.
The standard does not define specific connectors. Various connection methods have been used,
including the RS-232 DE-9 connector. Simple screw terminal connections are common in some
types of industrial control equipment.
Cable length defines the upper data rate. But because of the lower logic voltage levels and the
differential connection, data rates can exceed 10 Mbits/s depending on cable length. Maximum
cable length is commonly defined as 1200 meters or about 4000 feet. The typical maximum data
rate at 4000 feet is 100 kbits/s. A general guideline is that the product of the length of the line in
meters and the data rate in bits per second should not exceed 108. A 20-meter cable, for example,
would allow a maximum data rate of 5 Mbits/s.
The RS-485 interface can be used in simplex of half-duplex modes with a single-pair cable. Full-
duplex or simultaneous transmit and receive operations can be implemented with a two-pair
cable. A common configuration is bus network with multiple drops or connections. The standard
specifies a maximum of 32 drivers (transmitters) and 32 receivers (Fig. 5). Line drivers are
disconnected from the line when not transmitting. All receivers are fully connected, and the bus
line is terminated in a load matching resistance.
5.
This is a representation of a typical TIA-485 differential bus showing individual drivers (D) and
receivers (R) as well as transceivers. Note the end of bus termination resistors.
The standard has not defined a specific communications protocol. The standard UART protocol
is sometimes used. Most applications define a unique protocol.
Interface Variations
Several variations of these two standards are occasionally found in practice. RS-422 is a
variation of RS-485 with similar specifications but is designed only for one driver and up to 10
receivers. Logic levels range from ±2 to ±6 V. RS-423 is a single-ended rather than differential
variation of RS-422. Otherwise, other specifications are similar to the RS-485 interface.
Applications
The TIA-485 interface is also widely used in industrial applications where higher speeds and
longer distances are needed. It is used in the same type of equipment as defined for the RS-232
interface plus devices like point of sale (POS) terminals, metering instruments, and large special
automated machines. Networks defined by field buses like Profibus and Modbus use it as well.
Most new equipment uses the popular USB interface. However, it is often necessary or desirable
to convert from one interface to another to allow different types or ages of equipment to be used
together. Various converters are available to convert USB to TIA-232 or TIA-485, TIA-232 to
TIA 485, or vice versa.
Summary
In general, the RS-232 is best for short-distance low-speed requirements. It is simple and low
cost, and plenty of components like line drivers and receivers, UARTs, and connectors are
available to build the interface. Some drivers permit data rates to 2 or 3 Mbits/s for short lines.
Most interface chips include a charge pump dc-dc converter that supplies the positive and
negative supply voltages allowing the IC to operate from a single 3.3- or 5-V supply.
The RS-485 is for higher speeds over longer ranges or if duplex networking capability is
required. Again, many standard parts are available to create the interface. ICs have drivers and
receivers that can permit more than 32 drops, and data rates can be as high as 40 Mbits/s. Some
ICs also include dc-dc converters to furnish dual supply voltages (see the table).
References
http://www.electronicdesign.com/what-s-difference-between/what-s-difference-between-rs-232-
and-rs-485-serial-interfaces
RS232 Serial Cable Wiring
Published 06/29/1999 09:15 AM | Updated 05/23/2016 03:21 PM
Example cables for connection from a PC to various Lantronix products with DB connectors are
provided near the end of this FAQ
Background:
When RS232 was developed the idea was that there would be 2 kinds of devices, DTE (Data
Terminal Equipment) and DCE (Data Communications Equipment). Everything would use
DB25 connectors and everyone would always connect a DTE to a DCE using a straight-through
cable and everything would be easy.
However, as time went by folks wanted to connect two DTEs (or two DCEs) to each other,
and DB9* connectors started being used, so alternative cable wirings were required.
There are no hard and fast rules but in general a DTE will have a male DB25 or possibly a male
DB9 connector and a DCE will have a female DB25 or DB9. Other connectors may be used but
these are the most common.
A typical DTE is a serial port on a terminal, a Com port on a PC or the serial port on an
MSS100.
If you're connecting a DB25M DTE to a DB25F DCE (an MSS100 to a modem for example) you
can use a straight-through cable, i.e. pin 1 wired to pin 1, pin 2 wired to pin 2, etc. Because of
this DTE connectors are labeled according to the signal on the pin, DCEs are labeled according
to the signal that should be coming from the DTE.
In other words a DCE and DTE are labeled identically even though the direction of their signals
are opposite.
1 Protective ground
2 Transmitted data (Out) (TD or TXD)
3 Received data (In) (RD or RXD)
4 Request to send (Out) (RTS)
5 Clear to send (In) (CTS)
6 Data set ready (In) (DSR)
7 Signal ground (SG)
8 Carrier detect (In) (CD or DCD)
20 Data terminal ready (Out) (DTR)
Originally all 25 pins of a DB25 were used but today the above pins are usually the only ones
used. The most common pinout for DB9 serial connectors is:
"Straight-through" cable
DTE DCE
DB25M DB25F DB25M DB25F
TXD 2>------------>2 TXD
RXD 3<------------<3 RXD
RTS 4>------------>4 RTS
CTS 5<------------<5 CTS
DSR 6<------------<6 DSR
SG 7--------------7 SG
DCD 8<------------<8 DCD
DTR 20>---------->20 DTR
To connect a DB9M DTE (e.g. the Com Port on a PC) to a DB25F DCE (e.g. a modem)
you would wire your cable like this:
Null Modems
If all anyone ever wanted to do was connect DTEs to DCEs all you would need are the above
"straight-through" cables. But what if you want to connect an MSS100's DTE serial port to a
PC's DB25 DTE Com port? That's when you need a null modem.
The simplest null modem is the 3 wire connection. On a DB25-DB25 connection it would look
like:
DB25 DB25
TXD 2----------3 RXD
RXD 3----------2 TXD
SG 7----------7 SG
DB9 DB9
RXD 2----------3 TXD
TXD 3----------2 RXD
SG 5----------5 SG
If you're using Xon/Xoff (software) flow control or no flow control this is all you need.
A "full handshake" DB25 null modem cable is often wired like this:
DB25 DB25
TXD 2----------3 RXD
RXD 3----------2 TXD
RTS 4----------5 CTS
CTS 5----------4 RTS
DSR 6---|-----20 DTR
DCD 8---|
SG 7----------7 SG
DTR 20-----|---6 DSR
|---8 DCD
This assures that all flow control (handshaking) signals are passed from one side of the
connection to the other. You should be able to buy a null modem adapter or cable wired this way
at any well-stocked electronics or computer store.
DB9 DB25
RXD 2----------2 TXD
TXD 3----------3 RXD
DTR 4------|---6 DSR
|---8 DCD
SG 5----------7 SG
DSR 6---|-----20 DTR
DCD 1---|
RTS 7----------5 CTS
CTS 8----------4 RTS
To connect a PC's DB9M to a DB25M DTE device like the MSS100 use a Null Modem cable:
DB-9F(female) DB-25F(female)
RXD 2<---------------------------<2 TXD
TXD 3>--------------------------->3 RXD
DTR 4>--------------------------->6 DSR
GND 5-----------------------------7 GND
DSR 6<---------------------------<20 DTR
RTS 7>--------------------------->5 CTS
CTS 8<---------------------------<4 RTS
If your PC has a DB25M connector for it's serial port the Null Modem cable to connect an
MSS100 or similar product is wired like this:
DB-25F(female) DB-25F(female)
TXD 2>--------------------------->3 RXD
RXD 3<---------------------------<2 TXD
RTS 4>--------------------------->5 CTS
CTS 5<---------------------------<4 RTS
DSR 6<---------------------------<20 DTR
GND 7-----------------------------7 GND
DTR 20>-------------------------->6 DSR
DB-9F(female) DB-9F(female)
RXD 2<---------------------------<3 TXD
TXD 3>--------------------------->2 RXD
DTR 4>--------------------------->6 DSR
GND 5-----------------------------5 GND
DSR 6<---------------------------<4 DTR
RTS 7>--------------------------->8 CTS
CTS 8<---------------------------<7 RTS
If your PC has a DB25M connector for it's serial port the Null Modem cable to connect an MSS4
or similar product is wired like this:
DB-25F(female) DB-9F(female)
TXD 2>--------------------------->2 RXD
RXD 3<---------------------------<3 TXD
RTS 4>--------------------------->8 CTS
CTS 5<---------------------------<7 RTS
DSR 6<---------------------------<4 DTR
GND 7-----------------------------5 GND
DTR 20>-------------------------->6 DSR
Use a standard "straight-through" serial cable, often sold as a "Modem Cable". The Lantronix
part number for this cable is 500-163:
DTE DCE
DB9M DB9F DB25M DB25F
DCD 1<------------<8 DCD
RXD 2<------------<3 RXD
TXD 3>------------>2 TXD
DTR 4>------------>20 DTR
SG 5--------------7 SG
DSR 6<------------<6 DSR
RTS 7>------------>4 RTS
CTS 8<------------<5 CTS
*Note: For decades a 9 pin D-subminiature connector has been referred to as a DB9. Recently
there has been a movement to use the more accurate DE9 designation. For consistency in our
documentation, and to avoid confusion, Lantronix will continue to use the term DB9 to describe
a 9-pin D-subminiature serial port for the forseeable future.
For more infomation on why DE9 is considered to be more accurate see:
http://en.wikipedia.org/wiki/D-subminiature
ltxfaq.custhelp.com/app/answers/detail/a_id/25/~/rs232-serial-cable-wiring
Tech Stuff - RS-232 Cables, Wiring and
Pinouts
Brief tutorial and pinouts for RS-232, RS422/485, T1/E1 and V.35. If you want to know more
about RS 232 signals then this page may help - but you may also need to lie down in a darkened
room afterwards.
Contents
Notes:
1. Signal voltages in the range >-3.0V to +3.0V are regarded as being in the 'dead area'
(indeterminate value) and allow for absorption of noise. For more on the use of signals
and other heavy stuff.
2. Control Signals (CTS, RTS, DTR, DSR etc. are ACTIVE HIGH (range +3V tp +12V).
For more on the use of signals and other heavy stuff.
3. The power level on RS232 pins is defined by TIA for short circuit protection to be
100mA. Most RS232 drivers will provide lower short circuit protection (especially for
laptops). A max of 50mA PER PIN may be available but the data sheet for the specific
interface/chip should be consulted before commiting to externally powered designs.
4. We received an email recently pointing out some issues with NULL modem cables. The
pinouts shown below will generally work. However, there are many permutations of
signal sets that can be used by either end of a connection and they may not be
SYMMETRIC. One end may expect something (a signal) that the other end cannot
generate. This typically happens with CTS/RTS (and perhaps DCD) and DTR/DSR. If
you suspect this is the case then unfortunately you need to understand the interface and
may have to 'spoof' (artifically create) certain signals. Our signal primer page may help
you. Finally, if you are having serious problems, splash out on what is frequently called a
'light box' or some other device that will show you which signals are being activated.
5. Serial communications equipment may be either a DTE (Data Terminal Equipment - a
terminal or PC) or a DCE (Data Communications Equipment - for example, a modem)
and have a direction depending on the type. All the diagrams below define the interface
from the DTE perspective.
6. The terms Data Carrier Detect (DCD) and Received Line Signal Detect (RLSD) are one
and the same. We use DCD throughout 'cos we think it's more common.
7. While the term RS232 is almost universally used these days for serial/modem
connections, outside of North America it is quite common to come across the ITU
designations V.24/V.28 when describing serial/modem communications. For all practical
purposes RS232 and V.24/V.28 are identical.
8. Like most folks we use the term DB9 which is widely - but erroneously - coined to
describe a 9-pin serial connector. We got an email pointing out the error of our ways
(hint: it is really a DE-9P). So, if you want to amaze your friends over the dinner table,
you can read more and use the technically correct terms in the future. While we get away
with DB9 most of the time (with common or garden PCs), sometimes it is essential to
know EXACTLY what connector type you are talking about. And, following a recent
email request, we discovered that the thread on RS-232 (DB9 and 25) receptacles is UNC
4-40.
9. RS-232-E is normally defined to be used with a DB25 connector, but does have a 26 pin
(a much smaller) alternative . We suggest that if you come across one of these that you do
the decent thing - use an expletive. Alternatively, with your luck, you could consider
buying a lottery ticket.
10. We have received a number of emails asking how to wire DB9's using cat5(e)/cat 6 cable.
We guess there is a lot of LAN cable lying around these days (and its cheap) so folks
naturally want to use it. We have added a null modem only section to cover this wiring.
There is absolutely no standard to cover this form of wiring. This section is simply
offered as one of many possible ways to do it. While we are on the topic of wiring,
RS232 does not define a cable standard but this may help in choosing a suitable cable.
11. We got an email asking about TTY 20ma current loop interfaces. This was an old method
used to connect teletype devices and uses current (normally 20ma but sometimes 60ma)
to indicate mark and space. A TTY system CANNOT be connected to RS-232 (which is a
voltage driven interface) and has no standard. You will need to get the manufacturer's
specifications and start reading!
12. RS-232 is probably the most widely known serial standard because of its use in PCs. It
uses unbalanced communications (single TX/RX/CTS/RTS connectors) and hence has
both speed limitations and is susceptible to noise interference. RS-422 or RS-485 are
increasingly common because they use balanced communication (two connectors for
most signals) and provide higher speeds (up to 10 mbit/s) and are significantly more
robust in electrically noisy environments - such as automotive, military,
telecommunications and marine.
13. Like most people we continue to use the term RS, as in RS-232, RS-422, etc. Many
moons ago the standardization effort was taken over by EIA/TIA (sometimes written as
TIA/EIA). Now the EIA no longer exists (as of Feb 11th, 2011) and TIA is the only man
left standing. Consequently, you will occasionally see references to TIA-232 or TIA-574
etc. Anything with a TIA designation is functionally identical to the same number with an
RS designation, thus, TIA-232 = RS-232. We will continue to use the RS term simply
because we think it is still more widely used and because old dog, new tricks.....
In serial communications the terminal end (PC) is called the Data Terminal Equipment (DTE)
and the modem end is called the Data Communications Equipment (DCE) as shown in the
diagram below.
RS-232 signals have a direction (in or out) depending on whether they are with respect to a DTE
or a DCE. In all the pinout diagrams below the signal direction is with respect to the DTE (PC)
end.
When PCs are connected back-to-back each end is acting as a DTE (there is no DCE in this case)
and consequently certain signals may have to be looped in the connection to satisfy any input
signal requirement. This is called a NULL (no) modem configuration. For example, when the
DTE raises Request to Send (RTS) it typically expects Clear to Send (CTS) from the DCE. Since
there is no DCE to raise CTS, the outgoing RTS signal is looped in the NULL modem cable to
the incoming CTS to satisfy the DTE's need for this signal. This is shown in the diagram below.
Serial Communications with a NULL modem configuration
These diagrams show the male (grey background) and female (black background) pin numbering
for DB9 and DB25 sub-miniature connectors. Generally Pin 1 is marked on the front of the
connector right next to the pin - though you may need a magnifying glass to read it. Some
manufacturers mark each pin number on the plastic housing at the rear of the connector. The
male connector has the pins sticking out!
The use of each pin including methods for spoofing signals is described in our Signal/pin primer.
The RS-232 DB25 connector is capable of supporting two separate connections - each with its
own optional clock when used in Synchronous mode or Bit-Synchronous mode. If you are using
the interface purely for Asynchronous communications then you only need those marked with
(ASYNC) below or you can use even fewer (if you understand what is happening). The column
marked Dir shows the signal direction with respect to the DTE.
Note: This is NOT the same as the DB25 Parallel port on a PC.
Pin
Name Dir Notes/Description
No.
1 - - Protective/shielded ground
11 - - Unassigned
12 SDCD IN Secondary Carrier Detect. Only needed if second channel being used.
13 SCTS IN Secondary Clear to send. Only needed if second channel being used.
14 STD OUT Secondary Transmit Data. Only needed if second channel being used.
16 SRD IN Secondary Receive Data. Only needed if second channel being used.
18 LL - Local Loopback
19 SRTS OUT Secondary Request to Send. Only needed if second channel being used.
Ring Indicator. DCE (Modem) raises when incoming call detected used for auto
22 RI IN
answer applications.
25 - - Unassigned
NOTE: Leave all pins not specified above unconnected.
Signal functions are described in detail in our Signal/pin primer. The column marked Dir shows
the signal direction with respect to the DTE.
Pin
Name Dir Notes/Description
No.
3 TD OUT Transmit Data (a.k.a TxD, Tx). Sending data from DTE.
Data Terminal Ready. Raised by DTE when powered on. In auto-answer mode raised
4 DTR OUT
only when RI arrives from DCE.
5 SGND - Ground
7 RTS OUT Request To Send. Raised by DTE when it wishes to send. Expects CTS from DCE.
More properly EIA/TIA - 561. Use when connecting to or from a serial port with a 8 position
Modular Jack (RJ45). If you are cross-connecting from a DB9 or a DB25 use the signal names to
cross connect the appropriate pins. To illustrate the process the equivalent pins used for cross-
connecting a DB9 connector signals are shown (see DB9 pin-out above).
Signal/pin primer
5 RD 2 Receive Data
6 TD 3 Transmit Data
Use when connecting two systems (e.g. PCs) via their DB25 interfaces without a modem (i.e.
back-to-back). See the full signal names in the DB25 sections.
If this pinout does not work for you then you could try our Signal/pin primer because you may
need to SPOOF connections.
Note: This DB25 is NOT the same as the DB25 Parallel port on a PC which is defined here.
3 RD 2 TD
2 TD 3 RD
5 CTS 4 RTS
7 SGND 7 SGND
22 RI 22 RI
NOTE:
Use when connecting two systems, for example two PCs, via their DB9 interfaces without a
modem. Typically called a back-to-back or NULL modem connection. See the full signal names
in the DB9 section.
If this pinout does not work for you then you could try our Signal/pin primer because you may
need to SPOOF connections.
2 RD 3 TD
3 TD 2 RD
7 RTS 8 CTS
8 CTS 7 RTS
5 SGND 5 SGND
9 RI 9 RI
NOTE:
1. We have received email suggesting that the above pinout looks like DTR from one side is
driving into DSR/DCD on the other side - not normally a healthy situation. The emails
miss the point that since this is a NULL modem connection both ends are DTEs. The two
peer DTE's treat DSR/DCD signals as RX (INPUT) only. The INPUT DSR/DCD on one
side is created by cross connecting the OUTPUT DTR signal for the other peer.
Loopback is a method of testing the RS232 connector and interface circuitry to ensure it is
functioning correctly, that is, in layman's jargon - it ain't broke! If communication fails to occur
between two machines the question that immediately arises is - which end is broken? In the
worst case both ends could even be broken in which case ritual suicide may be the best solution.
Loopback works by testing each end of the connection independently. Data is sent and received
on the same RS232 connector - which may be either DB9 or DB25. The test normally consists of
using some program to transmit data. The program then checks to ensure exactly the same data
was received. Loopback testing gives you a binary result - it works, in which case the end under
test is good, or it does not, in which case the end under test is broken. Pinouts are shown for both
DB9 and DB25. The loopback is normally constructed in the DB shell or using a diagnostic
light-box.
DB9 Loopback
DB9 Signal Loopback to Signal
2 RD 3 TD
3 TD 2 RD
7 RTS 8 CTS
5 SGND 5 SGND
NOTE:
1. We show 4 (DTR) being looped to 6 (DSR), 1 (DCD) and 9 (RI). RI (9) is included
because we understand that certain test programs use this to ensure a more complete test
of the interface signal set.
DB25 Loopack
DB25 Signal Loopback to Signal
3 RD 2 TD
2 TD 3 RD
4 RTS 5 CTS
5 CTS 4 RTS
7 SGND 7 SGND
15 DB 17 DD
23 CH/CI 23 CH/CI
NOTE:
1. For the sake of simplicity this loopback will only work for the primary channel. Full
DB25 interfaces allow a secondary channel. If a complete interface loopback is required
you will need to add pins 12, 13, 14, 16, 19, 24.
2. By looping the primary channel clocks (15 and 17) both synchronous and asynchronous
capabilities can be tested. If only asynchronous tests are being performed omit this, and
the pin 23 loopback
3. We show 20 (DTR) being looped to 6 (DSR), 8 (DCD) and 22 (RI). RI (22) is included
because we understand that certain test programs use this to ensure a more complete test
of the interface signal set.
This is in response to a number of recent emails asking how to wire both ends of a DB9
connection using cat5, cat5(e) or cat6 cable. This must not be confused with DB9 to RJ45
(RS232D). We have shown a null modem (back-to-back PCs) only configuration. And if you
want to use cat5, cat5(e) or cat 6 with a real modem (a DB25 connector)? Our advice - don't.
Warning:. There is, as far as we know, no standard to cover the use of cat5, cat5(e) or cat 6 (8
conductor) wiring when used with two DB9 connectors. Any such wiring scheme is therefore
non-standard - that includes the wiring scheme below. Specifically this means that both ends of
the cable must be wired in the same way and that no assumptions can be made about how the
other end is wired. You will have to manually inspect both ends of the connection. Damage can
result from mis-matched wiring.
A DB9 clearly has 9 connections and a cat5, cat5(e) and cat 6 cable has 8 conductors. RS232D
has chosen to use Pin 1 as a multi-function pin (DSR/RI) to provide maximum flexibility with
modems - in particular it allows for DCD which is a meaningful signal from a modem but not,
we suggest, from a peer PC. We have chosen to use a minor variation on the normal DB9 Null
modem pinout above - specifically we have allowed for RI which could be used from a peer PC
to commence a transmission sequence. The colors used are unimportant but the suggested
configuration is one way to provide the shortest use of the adjacent (twisted) pairs.
If this pinout does not work for you then you could try our Signal/pin primer because you may
need to SPOOF connections.
cat5(e) cat5(e)
DB9 Signal DB9 Signal
Color Color
2 RD Brown 3 TD Blue
3 TD Blue 2 RD Brown
9 RI Orange-white 9 RI Orange-white
NOTE:
1. We have received email suggesting that the above pinout looks like DTR from one side is
driving into DSR/DCD on the other side - not normally a healthy situation. The emails
miss the point that since this is a NULL modem connection both ends are DTEs. The two
peer DTE's treat DSR/DCD signals as RX (INPUT) only. The INPUT DSR/DCD on one
side is created by cross connecting the OUTPUT DTR signal for the other peer.
RS232 DB9 to DB25 Pinout
Use when connecting a DB9 (e.g. a PC) to a DB25 (e.g. a modem) interface. See the full signal
names in the DB9 and DB25 section.
Signal/pin primer
1 DCD 8
2 RD 3
3 TD 2
4 DTR 20
5 SGND 7
6 DSR 6
7 RTS 4
8 CTS 5
9 RI 22
Use when connecting two systems (e.g. PCs) when one has a DB9 interface and the other a
DB25 interface without a modem. Typically called a back-to-back or NULL modem connection.
See the full signal names in the DB9 and DB25 sections.
Signal/pin primer
2 RD 2 TD
3 TD 3 RD
7 RTS 5 CTS
8 CTS 4 RTS
5 SGND 7 SGND
9 RI 22 RI
DB9: View - looking into male connector
RS 530-A defines the pinout when using either balanced RS-422 (and RS-485) or unbalanced
RS-423 using a DB25 connector. The A (+) and B (-) below refer to each signal pair used in
balanced serial interfaces (A+ is non-inverting, B- is inverting). When used with RS-423
(unbalanced) the B (-) are tied to a common ground. Signals marked U under Bal/Ubal are not
balanced since they typically change very infrequently (for example once per session) and
therefore do not affect TX/RX performance sensitivity - hence speed. BEWARE: RS-530
(without the A suffix) is an earlier standard and is wired differently (in particular both DTE
Ready/DTR and DCE Ready/DSR used balanced communications - two pins). This is the RS-
530-A pinout spec in which DTE Ready/DTR, DCE Ready/DSR are unbalanced and RI is
introduced on Pin 22. The pinout supports both synchronous (V.35/v.10/V.11) which require
clocks and aynchronous systems (RS-422/RS-485) which do not require clocks. The column
marked 422/485 indicates the signals required for these interfaces - all others are N.C. (Not
connected). RS422/485 on a DB9 is separately defined.
RS-422 vs RS-485: Many of us get confused over the difference between RS-422 (multi-drop)
and RS-485 (multi-point). RS-422 allows only one master (or transmitter) all others are only
receivers.
Notes:
7 Signal Ground Y -
18 Local Loopback U
21 Remote Loopback U -
22 Ring Indicator Y RI
23 Signal Ground Y -
25 TM U Test Mode
There is no official standard for using RS-422 or RS-485 on a DB9. The following pinout is
widely used by many manufacturers but you are advised to verify with the manufacturer's
specifications before proceeding. The following pinout provides no features for signaling end-to-
end equipment readiness (for example DTE Ready/DTR and DCE Ready/DSR - see RS422/485
on DB25). Software drivers must use the CTS/RTS signals to indicate the presence and readiness
of the peer.
Notes:
1. The A (+) and B (-) below refer to each signal pair used in balanced serial interfaces (A+
is non-inverting, B- is inverting).
1 Ground
The original V.35 specification defined use of balanced signals over a huge 35 pin connector.
V.35 has been obsolete for years (replaced with V.10) though the term is still frequently used.
Most modern systems that call themselves V.35 use a DB25 connector which has more modest
dimensions and uses the RS-530-A pinout scheme and maps the V.35 signal names to the RS-
530-A names for convenience. The A (+) and B (-) below refer to each signal pair used in
balanced serial interfaces (A+ is non-inverting, B- is inverting). Signals marked U under
Bal/Ubal are not balanced since they typically change very infrequently (for example once per
session) and therefore do not affect TX/RX performance sensitivity - hence speed. BEWARE:
RS-530 (without the A suffix) is an earlier standard and is wired differently (in particular both
DTE Ready/DTR and DCE Ready/DSR used balanced communications - two pins). This is the
RS-530-A pinout spec in which DTE Ready/DTR, DCE Ready/DSR are unbalanced and RI is
introduced on Pin 22. The signal names used in the pinout below refer to the standard (original)
V.35 spec.
Signal/pin primer
18 LL U Local Loopback
21 RL U Remote Loopback
22 RI Ring Indicator
23 AC Signal Ground
25 TM U Test Mode
NOTES:
This lists the designations for DB connectors (supplied by Rob Recny - Thanks). Any errors in
this list are ours not Rob's.
T1/E1 wiring may use either a RJ45, DB15 or BNC connectors. The pinout shown uses RJ45
connectors - its formal name is USOC RJ-48C and is defined in ANSI T1-403-1989. T1 is a
North America (primarily) digital service providing 1.544 Mbps. E1 is a European/Rest of World
standard providing digital service at 2.048 Mbps. CATegory 5(e) cabling is used to provide
balanced pairs. The color coding for Cat 5(e) cabling may be 568A or 568B.
RJ45 Pin Signal Notes
7 NC Unused
8 NC Unused
NOTES:
1. NC = Not connected.
2. There are a confusing number of pinouts for use with an RJ45/48C connector. Some specs show
use of pins 7,8 for Grounds. Always consult any equipment specification if available.
3. The telecom world loves its Tip and Ring designations. Tip is assumed to carry a positive voltage
(and would carry the transmission signal), Ring a negative voltage (and would carry the inverted
transmission signal)
http://www.zytrax.com/tech/layer_1/cables/tech_rs232.htm
Fiber Optic Cable vs Twisted Pair Cable vs Coaxial Cable
Fiber optic cable, twisted pair cable and coaxial cable are three major types of network cables
used in communication systems. Each of them is different and suitable for different applications.
Since each of them can be equally applied into network communication, how they distinct from
each other in terms of features and specifications? What’s the differences between performance
and capacity when it comes to fiber optic cable vs twisted pair cable vs coaxial cable?
Fiber optic cable, also called as optical fiber cable, is a type of Ethernet cable which consists of
one or more optic fibers that are used to transmit data. Fiber optic cable transmits data as pulses
of light go through tiny tubes of glass. The transmission capacity of optical fiber cable is 26,000
times higher than that of twisted pair cable.
Fiber optic cable can be divided into single mode fiber (SMF) and multimode fiber (MMF).
Single mode optical fiber has a small core, and only allows one mode of light to propagate at a
time. While multimode fiber cable comes with a larger core and is designed to carry multiple
light rays or modes at the same time. The common single mode fiber cable is OS2 cable, and
multimode fiber cable is OM1, OM2, OM3, OM4, and OM5. And the transmission distance of
single mode fiber cable is up to several kilometers, while the multimode fiber is up to 550 meters
over 10G network. To know more details about fiber optic cable types, working principle and
installation tips, please read: A Guide on Fiber Optic Cable
Twisted pair cable is often used for telephone communications and most modern Ethernet
networks. It is a kind of wiring in which two conductors of a single circuit are twisted together.
A pair of wires forms a circuit that can transmit data. And the pairs are twisted together to
provide protection against crosstalk, the noise generated by adjacent pairs.
There are two types of twisted pair Ethernet cable: unshielded twisted pair (UTP) and shielded
twisted pair (STP). The commonly used UTP copper cable is Cat5, Cat5e, Cat6, Cat6a and Cat7.
The STP copper cable has a foil wrapped outside on each pair of wires. The four pairs of wires
then are wrapped in an overall metallic braid or foil, usually 150-ohm cable. STP cable has a
better capacity of resisting noise than UTP cable, even if both of them can be used in 10GBASE-
T. Know the difference between UTP and STP cable in 10GBASE-T network: UTP or STP
Cables for 10GBASE-T Network?
Coaxial Cable
Coaxial cable, or coax cable, is designed to transmit high-frequency signals. It’s comprised of a
round copper conductor and three layers of insulation and shielding which prevents crosstalk
from motors, lighting and other sources of EMI. With the shield construction, the coaxial cable
can support longer cable lengths between two devices.
There are a number of different types of coax, but only two—RG59 and RG6—get the most use
in residential applications. The name “RG” dates back to World War II and means “radio guide”
which doesn’t have really signify anything today.
Coaxial Cable
Description
Types
RG59 is the basic coax cable. It’s thinner and has less shielding and best suited for
RG59
cable TV transmissions and short cable runs.
RG6 coaxial cable is heavier gauge and has thicker insulation and better shielding. It is
RG6
better for digital video signals and satellite TV.
Fiber Optic Cable vs Twisted Pair Cable vs Coaxial Cable: What’s the
Difference?
Except for the construction differences of fiber optic cable vs twisted pair cable vs coaxial cable,
these three types of cables distinguish from each other in cable performance and capacity.
Coaxial cable and twisted pair cable are copper or copper-based wire surrounded by insulation
with other materials. Both of them can transmit television, telephone and data with electrical
signals. While fiber optic cable can deliver the same types of signals with much wider
bandwidth, faster speed and higher frequencies. It’s made of very thin, pliable tubes of glass or
plastic.
Cable Price
In general, fiber optic cable is more expensive than copper cable due to its high performance and
capacity. However, in the cable market, the price of fiber optic cable, twisted pair cable and
coaxial cable varies from different suppliers and vendors. Before buying these cables, making
careful comparison is important.
Fiber optic cable 50ft LC to LC duplex 9/125 single mode fiber patch cable $5.65 (FS.COM)
Coaxial cable 50ft RG6 digital shielded coaxial cable $12.99 (Amazon)
From the table, we can see fiber optic cable has the lowest price at the same cable length.
However, the total installation of optical fiber cables also can be high because of other optical
components used, especially optical transceivers. In addition, twisted pair cable with RJ45
connector cost less than coaxial cable which often comes with a BNC connector.
Installation
Though optical fiber cable offers a big benefit in terms of the flexibility of bandwidth and
reliability, but it’s not as widespread as coaxial cable or twisted pair cable. And fiber is fragile
and thinner than twisted pair cable and coaxial cable, which make it need more cares to install,
operate and maintain. Compared with twisted pair cable, coaxial cable can reach longer distance.
However, due to the dielectric insulator around the core copper in coaxial cable, it’s difficult to
install and maintain coaxial cable.
Application
Fiber optic cables are not only installed to support long distance connections between cities and
countries, but in suburban neighborhoods for direct access like the FTTH, FTTP, FTTB, FTTC,
etc., which is called “last mile” installations. And they are widely used in data centers where
large volume of data needs to be transmitted.
Twisted pair cables are majorly used in telephone networks, data networks and cable shielding.
Applications of coaxial cable include feedlines connecting radio transmitters and receivers with
their antennas, computer network (Internet) connections, digital audio (S/PDIF), and distributing
cable television signals. And they also can be used for high-definition media interface
connections.
Summary
In sum, there are obvious differences among fiber optic cable vs twisted pair cable vs coaxial
cable. Fiber optics seem to become the trend for the increasing demand of the market as the
technology develops fast. However, whether to choose twisted pair cables, coaxial cables or fiber
optic cables still depends heavily on applications, which is subject to the cost, transmission
distance and performance.
https://community.fs.com/blog/the-difference-between-fiber-optic-cable-twisted-pair-and-cable.html
TCP/IP networking basics: hubs, switches,
gateways and routing
In this document
See also
TCP/IP networks are the most common type of network today. With such a network, a number of
computers or nodes can communicate with each other. An important aspect of this
communication is routing: getting data packets from one node to another, in particular from one
node on one network to another node on another network.
A network is a collection of computers or other devices, commonly called nodes, that are able to
communicate with each other. This communication takes place on different network levels. A
network may use the Internet Protocol (IP) at one level and Ethernet at the level directly below it.
This distinction is important because some parts of the network operate at the IP level and others
at the Ethernet level.
The most common type of network (especially in the home) is the Ethernet network shown in
figure 1, where all nodes are connected to a central device. In its simplest form this central node
is called a hub.
A problem with this approach is that hubs generate a lot of traffic, especially on larger networks.
Most of this traffic is wasted, since it is intended for only one node but it is sent to all nodes on
the network.
A commonly used solution today is a switch. A switch still connects all nodes to each other, like
a hub, but is more intelligent in which messages are passed on to which node. A switch examines
incoming Ethernet messages to see which node is the intended recipient, and then directly (and
only) passes the messages to that node. This way other nodes do not unnecessarily receive all
traffic.
Since switches are more expensive than hubs, a low-traffic part of the network could be set up
using a hub, with the more high-traffic nodes being interconnected to the switch. The hub
segment is then connected to the switch as well, as shown in figure 2.
A large network can be divided into multiple parts which are called segments. Each segment can
use its own network protocol, security rules, firewalls and so on. Nodes on different segments
cannot directly communicate with each other. To make this possible, a bridge is added between
the segments, as shown in figure 3.
Figure 3: two network segments connected via a bridge
The bridge lets packet pass that are destined for a host on the other side. This seems to turn the
two segments into one big network again, but there is an important difference. Data packets
generated on one segment and intended for that same segment are not passed to the other
segment. This saves on data transmission on the network as a whole.
The above examples all presented a single network at the Internet Protocol level. Even when the
network is segmented, all nodes are still able to communicate with each other. To connect
networks, a router or gateway is used.
A router is connected to two different networks and passes packets between them, as shown in
figure 4 to the right. In a typical home network, the router provides the connection between the
network and the Internet.
A gateway is the same as a router, except in that it also translates between one network system or
protocol and another. The NAT protocol for example uses a NAT gateway to connect a private
network to the Internet.
When a node on one network needs to send a message to a node on another network, this packet
will be picked up by the router and passed on to the other network. Many nodes are programmed
with a so-called 'default gateway', which is the address of the router that is to take care of all
packets not for other nodes on the same network.
Routers maintain a so-called routing table to keep track of routes: which connections (to
different networks) are to be used for which faraway networks. Some of these routes are
programmed in manually, but many are "learned" automatically by the router. Modern routers
inform each other about new routes and no longer working routes to make this as efficient as
possible.
Figure 5 below illustrates how routers (and behind them, entire networks) may be connected.
There are now multiple routes from the node at the left to the node at the right. Since routers
transmit IP packets, and IP packets are all independent of one another, each packet can travel
along a different route to its destination.
The TCP protocol that runs in the transport layer above does not notice this, although a user may
notice if suddently the connection seems faster or slower. That could be caused by packets now
following a different route that is faster or slower than the old one.
Figure 5: how two nodes on different networks can communicate with each other
Security of routing
Routing data packets in this way is very efficient, but not very secure. Every router in between
the source and the destination can examine every packet that comes through. This enables for
example systems like Carnivore (in Dutch) to examine almost all Internet traffic. Using
encrypted Internet transmissions avoids this.
An additional risk is traffic analysis. A router can see where packets come from and where they
go to. Even if the content of the packets is encrypted, the source or destination address itself
already reveals something about the communication. For example, a corporate IP address that
sends data to a newspaper website may indicate leaking of business secrets.
Onion routing with systems like Tor avoid even this risk, although they are much slower than
traditional routing systems.