Linux系统通过com口配置交换机


1、Linux服务器配置交换机的环境

  a、通过网络远程连接到Linux服务器或在本地使用linux服务器,用linux服务器的com口连接交换机的console口,在linux服务器上面安装minicom 软件配置交换机。

  b、如果没有安装minicom , yum安装方式如下:

yum install -y minicom      安装com 串口通信工具,类似windows系统的超级终端。

安装完成,需配置才可使用minicom通过com口配置交换机;

2、配置minicom软件

  a、配置前先检查

[root@cobbler_server ~]# ll /dev/ttyS*        显示串口完整路径

crw-rw---- 1 root dialout 4, 64 Jul 2717:56 /dev/ttyS0

crw-rw---- 1 root dialout 4, 65 Jul 2701:10 /dev/ttyS1

crw-rw---- 1 root dialout 4, 66 Jul 27 01:10/dev/ttyS2

crw-rw---- 1 root dialout 4, 67 Jul 2701:10 /dev/ttyS3

[root@cobbler_server ~]# dmesg | grepttyS*      执行此命令检查

console [tty0] enabled

serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A   检查到linux com 0口识别出console线已连接

00:03: ttyS0 at I/O 0x3f8 (irq = 4) is a16550A

  b、minicom配置如下

执行命令 :minicom –s       编辑串口通信工具,使linux 可以通过com口配置交换机

 +-----[configuration]------+

 |Filenames and paths      |

 |File transfer protocols     |

 | Serial portsetup         |       选中此项,Enter进入

 |Modem and dialing         |

 |Screen and keyboard       |

 |Save setup as dfl        |

 |Save setup as..           |

 |Exit                   |

 |Exit from Minicom        |

 +--------------------------+

 

 +-----------------------------------------------------------------------+

 | A- Serial Device   : /dev/ttyS0    |    将此项改为识别到的com口路径

 | B- Lockfile Location : /var/lock      |

 | C- Callin Program   :            |

 | D- Callout Program  :            |

 | E - Bps/Par/Bits   : 9600 8N1      |  将此项交换机识别到的波特速率9600

 | F - Hardware Flow Control : No      |      将此项改为No

 | G- Software Flow Control : No       |

 |                                                                     

 | Change which setting?      |          Enter 保存退出

 +-----------------------------------------------------------------------+

 

 +-----[configuration]------+

 |Filenames and paths      |

 |File transfer protocols  |

 |Serial port setup        |  

 | Modem anddialing        |         选择此项,进入到如下界面

 |Screen and keyboard      |

 |Save setup as dfl        |

 |Save setup as..          |

 |Exit                    |

 |Exit from Minicom        |

 +--------------------------+

 

设置过程中命令的使用,例如需要修改选项A的值,在Change with setting?选项后输入A则光标转移到A选项后,可以对A选项的值进行修改。

 

 +--------------------[Modem and dialingparameter setup]---------------------+

 |                                                            |

 | A - Init string........     |               清空此项数值

 | B - Reset string........    |            清空此项数值

 | C- Dialing prefix #1....                      |                                       

 | D- Dialing suffix #1.... ^M         |

 | E- Dialing prefix #2.... ATDP       |

 | F- Dialing suffix #2.... ^M         |

 | G- Dialing prefix #3.... ATX1DT       |

 | H- Dialing suffix #3.... ;X4D^M      |

 | I- Connect string ...... CONNECT      |

 | J- No connect strings .. NO CARRIER    BUSY       

 |

 | NO DIALTONE  VOICE            |

 | K - Hang-up string......        |         清空此项数值

 | L- Dial cancel string .. ^M       |

 |                          |

 | M- Dial time ........... 45      Q - Autobps detect ..... No      |

 | N- Delay before redial . 2       R - Modemhas DCD line .. Yes      |

 | O- Number of tries ..... 10      S -Status line shows ... DTE speed   |

 | P- DTR drop time (0=no). 1       T -Multi-line untag .... No       |

 |                                                    |

 |Change which setting?       (Return orEsc to exit)    |

 +----------------------------------------------------------------------------+

                          

 +-----[configuration]------+ 

 |Filenames and paths      | 

 |File transfer protocols  | 

 |Serial port setup        | 

 |Modem and dialing        | 

 |Screen and keyboard      | 

 | Save setup asdfl        |          选择此项,保存配置

 |Save setup as..          | 

 |Exit                    | 

 | Exit fromMinicom        |        选择此项,退出minicom配置界面

 +--------------------------+ 

 

选择Save as df1。

选择Save as df1选项将修改后的配置信息进行保存为默认的配置选项。

Exit from minicom 。

选择Exit from minicom 选项从配置菜单返回到命令行。

输入 Minicom                   就可以配置交换机了

使用minicom 启动minicom在linux下通过串口连接路由器,实现超级终端的功能。

[root@cobbler_server ~]#minicom 则可以进入了

 

Welcome to minicom 2.3

 

OPTIONS: I18n

Compiled on Aug 19 2010, 05:50:19.

Port /dev/ttyS0

 

               Press CTRL-A Z for help onspecial keys

 

<H3C>   这里就是配置交换机的界面了

#Apr 27 05:34:09:611 2000 H3CSHELL/4/LOGIN:

 Trap1.3.6.1.4.1.25506.2.2.1.1.3.0.1<hh3cLogIn>: login from Console

%Apr 27 05:34:09:750 2000 H3CSHELL/5/SHELL_LOGIN: Console logged in from aux0.

 

配置完成后,想要保存退出;按下键盘ctrl+a键后再按z键,进入如下界面:

-------------------------------------------------------------------

                   Minicom CommandSummary                      

                                                                   

         Commands can be called by CTRL-A <key>                  

                                                                  

  Main Functions                  Other Functions    

                                                                   

Dialing directory..D    run script (Go)....G      | Clear Screen.......C

Sendfiles.........S     Receivefiles......R       | cOnfigureMinicom..O

commParameters....P     Addlinefeed.......A       | Suspend minicom....J

Capture on/off.....L    Hangup.............H      | eXit andreset.....X

sendbreak.........F     initializeModem...M       | Quit with no reset.Q

Terminal settings..T    run Kermit.........K      | Cursor key mode....I

lineWrap on/off....W    local Echo on/off..E      | Help screen........Z

Paste file.........Y                        | scroll Back........B

                                                                  

     Select function or press Enter for none.                    

                                                                  

            Written by Miquel van Smoorenburg 1991-1995          

            Some additions by Jukka Lahtinen 1997-2000           

            i18n by Arnaldo Carvalho de Melo 1998                

这时按下键盘x键,显示如下

----------------------+

  Leave Minicom?    |

 Yes       No   |

----------------------+

选择yes,即可退出minicom 配置界面