Methodology for setting up the minicom msvs program. Connecting to Cisco from Linux. Setting up phone numbers

Run "minicom -s" and select the "Serial port setup" menu item.

The first item is "Serial Device" - this is the most important setting: your modem connects to a serial device. (Who wants to make minicom work with several serial devices at the same time?) Press return to confirm and esc to exit to the initial settings menu. Select "Exit to minicom" and type "atdt99999". Your modem will immediately begin dialing the number and you will hear a click when the modem goes off-hook. Of course, "99999" is a non-existent number.

2.2 Starting PPP manually

You may have tried to call your provider's phone number instead of "99999". Did you see random characters on the screen after registering (if not, type "ppp")? They indicate that "pppd" (or its equivalent) is running on the other end of the line. If this is the case, then on your part you can try to start the "pppd" daemon and subsequently evaluate the contents of the log files.

To run "pppd" inside minicom, you can define a new upload method "upload" (that is, from you) or override the "kermit programm" setting from the "Filename and paths" configuration menu:

A - Download directory: B - Upload directory: C - Script directory: D - Script program: /usr/bin/runscript E - Kermit program: /usr/sbin/pppd file /etc/ppp/mini_options
Now, if you've seen these random characters, the next time you call your ISP you can press Alt-K to launch "pppd".

The remainder of this mini-HOWTO is devoted to automating logging and running pppd.

2.3 Studying logs

While I'm not going to explain how PPP is configured, I will briefly describe how to read the logs. To extract significant information from the log "/var/log/debug" (or "/var/log/daemon.log") run the commands

tail -n 40 /var/log/debug |\ grep -E " pppd\[*\]:" |\ sed -e "s/^.*pppd\ rcvd
which indicate that we sent a request to set the maximum receive block size (mru) to 296. The other side rejected this setting ("configuration rejected"). In this case I only removed the "mru" option from the "/etc/ppp/options" file (see below).

2.4 Setting up phone numbers

If the above steps were successful, you may want to save the phone number in minicim's database. Press Alt-D to bring up the call menu and use the cursor keys to select "Edit":

A - Name: Xeno B - Number: 022039697303 C - Dial string # : 1 D - Local echo: No E - Script: /etc/ppp/login.script F - Username: ppp-382 G - Password: top-secret H - Terminal Emulation: VT102 I - Backspace key sends: Delete J - Linewrap: Off K - Line Settings: Curr 8N1
This is an example entry for one of my providers. The script "/etc/ppp/login.script" is shown below. This script has two special variables: $(LOGIN) and $(PASS), which set the username (F) and password (G) values. This feature gives minicom some flexibility because you only need one script to automatically connect to multiple providers.

2.5 Registration scenario

"minicom" runs the login-script after it receives the "CONNECT" string. To be precise, "minicom" does not execute the script itself, but calls the "runscript" utility to do so as a child process.

Below is the example I use for my provider.

# v1.0, 08.20.96 Winfried Trêmper print "" print "Automatic login via /etc/ppp/login.script" ## uncomment if you need to push to ## get the prompt string #send "" expect ( "ogin:" "ogin>" "sername:" "sername>" "NO CARRIER" exit 1 ) send "$(LOGIN)" expect ( "assword:" " assword>" timeout 20 ) send "$(PASS)" expect ( "port" send "ppp" "Start your PPP now" ")!}" timeout 10 } print "" print "Сейчас переключаемся в ppp-режим..." print "" ! /usr/sbin/pppd file /etc/ppp/mini_options print "" print "команда killall -TERM pppd прекращает работу pppd" !}

To start "pppd" it uses the ability of "runscript" to call external programs. Copy your own options file for ppp to "/etc/ppp/options.ttyS1" (here you can replace "ttyS1" with the device your modem is connected to) and remove all lines from /etc/ppp/options that refer to your modem (like "connect", "crtscts" or "modem"). Paste the options that are specific to the ppp connection via minicom into "/etc/ppp/mini_options". One of these options would be

disconnect "chat "" "\d\d+++\d\dATH\r\c""
This option must be present because "pppd" reads data via standard input and cannot force the modem to hang up via "crtscts".

2.6 Automatic dialing at startup

To call a specific number when starting minicom, use the "-d" option. Also you can try

to transfer minicom to another console (see Consoles-Many mini-HOWTO).

2.7 Future extensions

Since "pppd" is a daemon, it is not intended for user interaction or monitoring. This is true. And after all this we use Unix...

The canonical solution is behind us. Any volunteers to hack minicom? The desired extensions are:

  • automatic creation of a registration script based on the sequence of actions performed by the user when establishing a connection manually
  • automatic evaluation of logs with adjustment of options
  • highlighting messages like those mentioned in paragraph 2.3.
Next

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 settings for the console com port in the equipment documentation. 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 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.

The article discusses the simplest way connecting to a Cisco terminal from Linux environments. Initially, you need to connect the console cable to the COM port of the machine with Linux OS installed and to the port console on Cisco. To connect to the Cisco console, you must install the minicom package. Installation varies depending on the distribution. This example describes installation from Linux Debian.

aptitude install minicom

Minicom is in the repositories of most distributions, so installing it should not cause any difficulties.

Setting up minicom

For proper operation minicom with Cisco, you need to perform its initial setup.

  1. Go to the Serial port setup and change the value of Speed/Parity/Bits (Bps/Par/Bits) to 9600.
  2. We change the serial port (Serial Device) to the port to which the Cisco equipment is connected. In this example, this is /dev/ttyS0 - the address of the COM1 port.

As a result, you need to get the following settings:

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 changed configuration as default settings in the minicom main menu (Save setup as dfl), or as a configuration with a specific name (Save setup as..).

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.