Linux Network Administrator Manual (4)

Source: Internet
Author: User
Article title: Linux Network Administrator Manual (4 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Chapter 4 configure serial hardware
There are rumors that there are people in the online world who only have one PC and spend money on one T1-Internet connection.
Connection. However, in order to do their daily work of news and mail
The telephone network relies on SLIP connections, UUCP networks, and [electronic] bulletin board systems BBS
'S.
This chapter is intended to help all those who rely on modem to maintain their connections. However, there are many details not described in this Chapter
For example, how to configure your modem for dial-in. All these topics will be included in the upcoming presentation of Greg Hankins.
In the HOWTO series, [1] It will be regularly delivered to comp. OS. linux. announce.
4.1 Modem-connected communication software
Linux has many communication software packages, many of which are terminal programs (terminal programs) for a user to dial
To another computer, as if she was sitting in front of a common terminal. The traditional dialing terminal program is kerm.
It. However, this software is somewhat simple. Currently, many support phone numbers, including dialing and logging on to remote computers
More suitable programs such as system scripting language. This kind of software is minicom, which may be used to the previous DOS users.
Some terminal programs are similar. There are also some X-based communication software packages, such as seyon.
Similarly, there are many Linux-based BBS software packages for those who want to run the [electronic] bulletin board system. These software
Some packages can be found in/pub/Linux/system/Network of sunsite.unc.edu.
In addition to terminal programs, there are some non-interactive software that uses serial connections for your computer to send and receive data. This
The advantage of this technology is that it can browse the announcement board than some mailbox programs that need to read emails online and find interesting articles.
It takes less time to automatically download dozens of KB data. On the other hand, because you often get
Loading of useless information requires more disk storage space.
The abstract [embodiment] of such communication software is UUCP. This is to copy files from one host to another and execute on the remote host
A program group. It is often used to send mail or news in a private network. Ian Tay running in Linux
The UUCP package of lor will be discussed in later sections. Other non-interactive communication software, such
Fidonet. There are also ports for Fidonet applications such as ifmail.
SLIP, a serial connection protocol, is relatively intermediate. it allows interactive or non-interactive
. Many people use SLIP to dial up to their campus network or some other public SLIP network servers.
FTP sessions. However, SLIP can also be used for fixed and semi-fixed network-to-network connections, although this is only
You are interested in using ISDN.
4.2 Overview of serial devices
The UNIX kernel is typically called ttys for devices that access serial devices. Is this Teletype? Abbreviation
It was once one of the major terminal manufacturers in the early UNIX era. Currently, this term is used for any structured data terminal. Guan
In this chapter, we will all use this term to refer to kernel devices [drivers].
Three types of ttys are different: (virtual) console, pseudo terminal (similar to a two-way pipeline, used
Applications) and serial devices. The latter is also called ttys because it allows interactions on a serial connection.
Regardless of whether it is a terminal connected by a fixed wiring or a remote host over a telephone line.
Ttys has many configurable parameters that can be set using the system call ioctl (2. Many of these parameters
It is only useful for serial devices because they require great flexibility to process various types of connections.
The most prominent line parameters are the line rate and parity. However, the conversion between uppercase and lowercase characters and carriage return are also supported.
Line feed and so on. Tty drivers can also support various line specifications (line disciplines) that enable device drivers
The order is completely different. For example, Linux's SLIP driver is implemented according to special line specifications.
There is some ambiguity about how to test the line speed. The correct term is bit rate, which is equivalent to the number of bits per second (or abbreviated
Bps) measured line transmission speed. Sometimes you hear people talk about it with a Baud rate,
This is not correct. However, these two terms are not interchangeable. The baud rate refers to the physical characteristics of some serial devices.
, That is, the clock rate of the pulse. Bit rate more appropriately represents the current state of a known connection between two points
Status, that is, the average number of bits transmitted per second. It is important to know that these two values are usually different because most devices
Each electric pulse must encode at least one bit.
4.3 access a serial device
Just like all devices in a UNIX system, the serial port is a specific file in the/dev directory related to the device.
. There are two device files related to the serial driver, and each port has
A device file. The device performance varies depending on the files accessed by the device.
The first type is used when a port is used as a dial-in. it has a primary number 4 and the file is named ttyS0 and ttyS1. The
The two types are used when the port is used as an outbound port. the file is called cua0 and has a primary number of 5.
The secondary number is the same for the two types. If you have a modem connected to one of the ports COM1 to COM4
Its secondary number is the COM port number plus 63. If your settings are different, for example, when you use a multi-serial line
For more information, see Serial Howto.
Assume that your modem is on COM2. In this way, its next number will be 65, and the primary number will be 5 when it is dialed out. There will be
These numbers are available in the device files cua1. List the serial ttys in the/dev directory. The fifth and sixth columns should be respectively
Display the primary and secondary numbers:
$ Ls-l/dev/cua *
Crw-rw-1 root 5, 64 Nov 30 :31/dev/cua0
Crw-rw-1 root 5, 65 Nov 30 22:08/dev/cua1
Crw-rw-1 root 5, 66 Oct 28 11: 56/dev/Cu
Crw-rw-1 root 5, 67 Mar 19 1992/dev/cua3
If there is no such device, you must create one: as a super user, type
# Mknod? M 666/dev/cua1 c 5 65
# Chown root. root/dev/cua1
Some people suggest connecting/dev/modem to your modem device, so that temporary users do not need to remember this
Intuitive cua1. However, you cannot use the modem name in one program, but use the actual device in another program.
File name. This is because these programs use the so-called lock file to notify the device that it is in use. Follow
By convention, cua1 locks the file, for example, LCK .. cua1. Using different device files for the same port means that the program
Other locked files cannot be identified and you can use this device at the same time. As a result, both applications are completely different.
Can work.
4.4 serial hardware
Currently Linux supports many types of serial boards that use RS-232 standards. RS-232 is currently the most
General standards. It uses some circuits to transmit and synchronize a single bit of data. Other connections can be used
Carrier signal (for modems) and handshake signal.
Although the hardware handshake signal is only available, it is useful. It allows either of the two sites to notify the other
Whether it is ready to receive more data, or whether another site is about to suspend until the recipient has completed receiving
. The connections used for this purpose are called "Clear to Send" (CTS) and "Ready to Send" (R
TS), which is commonly known as the hardware handshake signal, that is, "RTS/CTS ".
In PC, the RS-232 interface is usually driven by UART chip, which is derived from National Semiconductor Company's 16450 chip
Or a new version of NSC16550A. [2] Some brands (most of the notable built-in modems are equipped with Rockwell chips
These chips are programmed as if they are 16550 chips.
The main difference between 16450 and 16550 is that the latter has a 16-byte FIFO buffer, while the former has only one byte of slowness.
Punch area. This makes 16450 suitable for a speed of up to 9600 Baud, and a higher speed requires a 16550 compatible chip
. In addition to these chips, Linux also supports the 8250 chip, which is the original chip of the PC-AT.
By default, the kernel checks four standard serial ports COM1 to COM4. The number 64 to 67 will be assigned to this
As described above.
If you want to correctly configure your serial port, you should install the setserial command of Ted Tso and the rc. serial script
. This script should be called from/etc/rc during system boot. It uses setserial to configure the serial device of the kernel
. A typical rc. serial script looks like this:
#/Etc/rc. serial-serial line configuration script.
#
# Do wild interrupt detection
/Sbin/setserial-W/dev/cua *
# Configure serial devices
/Sbin/setserial/dev/cua0 auto irq skip test autoconfig
/Sbin/setserial/dev/cua1 auto irq skip test autoconfig
/Sbin/setserial/dev/cua2 auto irq skip test autoconfig
/Sbin/setserial/dev/cua3 auto irq skip test autoconfig
# Display serial device configuration
/Sbin/setserial-bg/dev/cua *
See the documentation attached with setserial to explain the relevant parameters.
If your serial card is not detected, or setserial? The bg command shows that the settings are incorrect.
Provide the correct parameter values for forced configuration. It is reported that the built-in modems with Rockwell chip is used.
Users will encounter this problem. For example, if the UART chip is detected as NSC16450, but it is actually NSC16550,
You must change the configuration command for the wrong port
/Sbin/setserial/dev/cua1 auto irq skip test autoconfig
Uart 1, 16550
The COM port, base address, and IRQ settings are similar. See the setserial manual page.
If your modem supports hardware handshakes, you must be sure to activate it. Surprisingly, most communication programs
By default, you have not tried to activate it; therefore, you must set it manually. It is best to use the stty command in the rc. serial script.
To perform the following operations:
$ Stty crtscts </dev/cua1
Check whether the hardware handshake works.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.