Connecting to Cisco from Linux and FreeBSD. Using minicom to enter modem AT commands We receive and send characters using the com port in the console

Using minicom to test a modem

The first step in using minicom is to create a global configuration file. To do this, you need to run minicom with the -s flag, logging in as the root user.

#minicom -s This command launches the minicom configuration environment (Fig. 18.8).


Rice. 18.8. Configuring minicom

Navigate through the menu using the up and down arrow keys, and select a menu item by pressing Enter.

The most important parameters are hidden behind the Serial Port Setup menu command. serial port) in the Serial Port Setup dialog box (Fig. 18.9).



Rice. 18.9. Serial Port Configuration

To change a value, press the key with the corresponding letter. First of all, you need to install the serial device by pressing the "A" (Serial Device) key and specifying the appropriate device file. If the modem is connected to the second serial port, you can specify /dev/ ttyS1 due to the use of minicom for outgoing connections.

Note

If the serial port is already connected to /dev/modem, as shown in Fig. 18.9, check its connections using the command ls -I /dev/modem. If the connection to a specific serial port is displayed, then no changes are needed.

It is also necessary to configure parameter E (Bps/Par/Bits - Speed/Parity/Stop Bits) in accordance with the requirements of the modem and the system to which you will connect (usually the Internet provider system). After pressing the "E" key, the communication parameters window will open (Fig. 18.10).

Rice. 18.10. Configuring Communication Settings

The current parameter values ​​are shown at the top of the window. To modify any of them, press the key with the corresponding letter.

For Speed, select a value equal to maximum speed modem when compressing data. Typically this value is four times its rated speed. For example, for a modem with a speed of 14.4 Kbps, you should set the value to 57,600 bps, for a 28.8 Kbps - 115,200 bps. A 56Kbps modem is set to 115200bps or 230400bps (if available).

As a rule, in modern systems the parity bit is not used, 8 data bits and one table bit are used (option Q). Find out the correct values ​​for the remaining parameters from the administrator of the system to which you will connect.

Return to the Serial Port Setup window by pressing Enter. Pressing Enter again returns you to the main menu.

This information should be enough to test the modem. Save the modified set of parameters as the default configuration by executing the Save Setup as Dfl menu command. After executing the Exit menu command, complete the configuration procedure and continue working in the minicom terminal emulator window (Fig. 18.11) with the set parameters.



Rice. 18.11. Main window of the minicom program

The message "OK" in the window indicates normal operation of the modem. To verify this again, type AT and press Enter. The response should be "OK"

AT OK

Configuration of various switches, routers and other equipment is usually done through a serial COM port (RS232). First you need to find and connect the computer and the switch (via a COM port or USB adapter) with a suitable console cable. In this article we will look at how to configure it in Linux OS.

Setup via minicom

First of all, you need to find the console settings in the documentation for the equipment. com port. To connect under Linux, you need to install the minicom program. Let's install from the package under Debian (ubuntu):

Aptitude install minicom

In order for minicom to see Cisco, it must be configured correctly, launch with the key:

Sudo minicom -s

Go to the Serial port setup and change the values ​​of Speed/Parity/Bits (Bps/Par/Bits) to 9600 8N1.

We change the serial port (Serial Device) to the port to which the equipment is connected and configure the Flow Control parameters. IN in this example this is /dev/ttyS0 - the address of the COM1 port. When connected via a mini-usb connector, the port may be /dev/ttyACM0.

Help on commands can be obtained by pressing Ctrl+A then Z.

As a result we get standard settings for Cisco and HP procurve:

A - Serial Device: /dev/ttyS0 B - Lockfile Location: /var/lock C - Callin Program: D - Callout Program: E - Bps/Par/Bits: 9600 8N1 F - Hardware Flow Control: Yes G - Software Flow Control : No

We save the configuration as the default settings in the minicom main menu (Save setup as dfl), or as a configuration with specific name(Save setup as..).

To exit minicom, press Ctrl+A then Q.

Or with saved settings.

Minicom<имя_конфигурации>

And this is an example of settings for 3com(hp) 4210 and 4500 switches

A - Serial Device: /dev/ttyUSB0 B - Lockfile Location: /var/lock C - Callin Program: D - Callout Program: E - Bps/Par/Bits: 19200 8N1 F - Hardware Flow Control: No G - Software Flow Control : Yes

The /dev/ttyUSB0 device is usually used when connecting via a usb->com adapter. The speed of 19200 is sometimes 115200 used on 3COM (now HP) switches, and they do not understand any other speed. So before connecting, you need to carefully read in the documentation what speeds and flow control you need to set. However, sometimes the connection parameters are written directly on the device next to the console port.

Settings via the cu utility

You can connect to the console with the command

Chown uucp /dev/ttyUSB0 cu -s 115200 -l /dev/ttyUSB0

If you do not set chown rights to the device file, you may receive the following message:

/dev/ttyUSB1: Device busy

The main advantage of the cu utility is that it works equally well under Linux and under freebsd, only the names of the devices differ.

On freebsd it will look like this:

Chown uucp /dev/сuaa0 cu -s 115200 -l /dev/сuaa0

The only thing you need to do is select the correct device file where the device is connected.

Minicom - a program for using the serial port in UNIX-like operating systems(analogous to Hyper Terminal in Windows).
In this example, we will look at the operation of the minicom program with the Huawei E171 modem in the Ubuntu operating system.

First, let's insert the 3G modem into USB port computer and see if Ubuntu OS sees it by typing the command in the terminal:

We'll see everything USB devices, connected and recognized by the system.

Among them there should be a line similar to this:

Bus 002 Device 005: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

Now you need to find the modem itself in the /dev/ directory by typing the command in the terminal:

Among the many devices appeared:

ttyUSB0
ttyUSB1
ttyUSB2

This is a 3G modem

If the minicom program is not installed on the system, then you need to install it by typing the command in the terminal:

sudo apt-get install minicom

To work with a specific port you need to configure configuration file by typing the command in the terminal:

The minicom configuration environment will start


Moving through the menu using the arrow keys (up or down), to the item “Setting up the serial port”, select this item by pressing Enter. The serial port setup menu appears.


In the "Serial port" item you need to install the device /dev/ttyUSB0; to do this, press the A (Latin) key and change the device file name. After editing, press Enter twice.
We don't change anything else in the settings. Use the arrow keys (up or down) to go to “Save settings as dfl” and press Enter. Next, exit the minicom configuration environment by pressing Esc or selecting the Exit menu item and get into the minicom program itself to enter AT commands.


The message "OK" in the window indicates normal operation of the modem. To verify this again, type AT and press Enter. The response should be "OK".
Now you can use AT commands to switch operating modes in Huawei and ZTE modems. These commands are given in the article AT commands for Huawei and ZTE modems.
To exit the minicom program you need to press Ctrl+A and then the Q key.

Minicom

Introduction

Minicom is a text-based serial port communications program. It is used to talk to external RS-232 devices such as mobile phones, routers, and serial console ports.

Installation

Install the program with:

sudo apt-get install minicom

Alternatively you can get Minicom via the Synaptic Package Manager.

Using the program

In order to find the name of your port(s) enter this command in terminal:

dmesg | grep tty

If it is a direct serial connection, the output will be something like this:

[ 22.587279] console enabled [ 24.186230] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 24.186860] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 51.598012] audit( 1243322582.732:2): type=1503 operation="inode_permission" requested_mask="a::" denied_mask="a::" name="/dev/tty" pid=5705 profile="/usr/sbin/cupsd" namespace= "default"

For a USB-to-Serial adapter, one may see:

[ 0.000000] console enabled [ 5.065029] usb 4-3: pl2303 converter now attached to ttyUSB0

What we are interested in is the name of the serial port. In the first section above it is ttyS0, the other is ttyUSB0. which we will need in order to use Minicom. Next, enter in a terminal enter:

sudo minicom -s

One will next choose "Serial port setup". Then, adjust the Serial Device to the device one has, for example:

A - Serial Device: /dev/ttyS0

Next, one will want to consult the hardware vendor's manual for the Bits per second, data bits, Parity, stop bits, and Flow control. Once these have been adjusted, one may want to also go to the Modem and dialing menu and remove all information in setting options A through I. Once configured, one may "Save setup as dfl", which will save these as the default configurations for future connections (/etc/minicom/minirc.dfl Once saved, one may choose). Exit, and one is at the minicom prompt. Hit enter, and you may be asked for your username, indicating a successful connection.

To exit Minicom when in terminal mode press "Ctrl-A" to get a message bar at the bottom of the terminal window and then press "X".

Another useful Option is to log all information to a file which will be saved in your Home directory. Select "Filenames and paths" and press "F" (Logging options). By default this will be saved as "minicom.log", but change it to whatever you like with the "A" key. Press "Enter" to save the changes.

Pupsen and Vupsen April 29, 2016 at 12:19 pm

Configuring the ZTE mf180 USB modem to work on Ubuntu-based systems

  • *nix,
  • Linux setup

In this publication I want to talk about how to configure the ZTE mf180/190 modem for correct operation on systems based on Linux Ubuntu.

Recently, after switching to Lunux Mint 16, I encountered a problem connecting to the Internet via my 3g usb modem. Constant disconnections forced us to look for a solution. The valiant Google did not suggest anything in its entirety, I had to collect it in parts.

Let's start in order.

We will need Minicom - a program for using the serial port in UNIX-like operating systems. It is located in the repositories of most distributions, so installing it should not cause any difficulties.

Open a terminal and enter:

Sudo apt-get update sudo apt-get upgrade sudo apt-get install minicom https://site/sandbox/edit/93467/# sudo minicom -s
The program menu will appear in the terminal.
Select the settings item “Serial port settings”
And press the A key and bring it to the form:

/dev/ttyUSB1
Then press Enter. After saving the settings, be sure to select the “Exit” item to get into the minicom console, and enter:

Ati0
The result should be something like this:

Manufacturer: ZTE CORPORATE Model: MF190 Revision: BD_BLNKZMF190V1.0.0B01 IMEI: 12345678901234 +GCAP: +CGSM,+DS,+ES OK
We copy the command, be sure to the minicom console:

Echo -e "AT+ZCDRUN=E\r\n" > /dev/ttyUSB1

The answer will be:

Enter download mode result(0:FAIL 1:SUCCESS):1
Press CTRL+A, then Q, select “Yes”.

Setting up the modem using minicom is complete.

Then go to the connection settings, select the “mobile” tab and click the “add” button. A dialog box will open, in it we press the “forward” button, select the country (I chose Kazakhstan), then select the operator (in my case Beeline - and then I will give the settings specifically for “Beeline KZ” When requested tariff plan I selected the “other” option and indicated the access point internet.beeline.kz. Click the “forward” button, then “apply”. Then you need to specify the username and password (I have .beeline and beeline), click “save”.

At this point my modem was fully configured and operational, good luck with the setup.

Tags: 3g modem, linux mint 16, Minicom, K"Cell, ZTE MF 180