Ferramentas do usuário

Ferramentas do site


infra-estrutura:cisco:criar_menu_cisco

Criando Menu customizavel para o Cisco

É possivel criar menu's customizavel para utilizar em um roteador cisco por exemplo vamos implementar o seguinte menu.

Acesso ao roteador

Menu de interacao




opcao 1 - show ip interface brief
opcao 2 - show ip route
opcao 3 - show version
opcao 4 - sair

Criando a configuração

!
aaa new-model
!
!
username cisco privilege 15 password 0 cisco
!

Criando o menu

Para criar o menu a sintaxe é *menu <identificador> <opcoes>*

Criando o título

R1(config)# menu cisco title $
Acesso ao roteador

Menu de interacao

$
R1(config)# 

Criando o prompt do menu

R1(config)# menu cisco prompt $
opcao 1 - show ip interface brief
opcao 2 - show ip route
opcao 3 - show version
opcao 4 - sair
$

Criando as opções

No caso a opção 1(digitar o numero 1) executa um “show ip interface brief” a opção 2(digitar o número 2) executa o “show ip route” e 3 executa “show version”.

R1(config)# menu cisco command 1 show ip interface brief
R1(config)# menu cisco command 2 show ip route
R1(config)# menu cisco command 3 show version
R1(config)# menu cisco command 4 exit
R1(config)# menu cisco clear-screen
R1(config)# menu cisco line-mode

E possível mudar os textos das opções sendo não necessário a opção prompt.

R1(config)# menu cisco text 1 Mostrar interfaces
R1(config)# menu cisco command 1 show ip interface brief
R1(config)# menu cisco text 2 Mostrar rotas
R1(config)# menu cisco command 2 show ip route
R1(config)# menu cisco text 3 Mostrar versao
R1(config)# menu cisco command 3 show version
R1(config)# menu cisco text 4 Sair
R1(config)# menu cisco command 4 exit

Aplicando o menu

iremos aplicar o menu nas conexões ssh e telnet iremos testar na telnet

line vty 0 4
 autocommand  menu cisco
 transport input telnet ssh
 transport output all

O comando que vincula o menu é “autocommand” e informamos a palavra chave menu e o nome do menu.

Vamos testar o menu

R2#telnet 192.168.1.1
Trying 192.168.1.1 ... Open


User Access Verification

Username: cisco
Password:


    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair

Opção 1

    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair


Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.1.1     YES manual up                    up
Ethernet0/1                unassigned      YES NVRAM  administratively down down
Ethernet0/2                unassigned      YES NVRAM  administratively down down
Ethernet0/3                unassigned      YES NVRAM  administratively down down
Ethernet1/0                unassigned      YES NVRAM  administratively down down
Ethernet1/1                unassigned      YES NVRAM  administratively down down
Ethernet1/2                unassigned      YES NVRAM  administratively down down
Ethernet1/3                unassigned      YES NVRAM  administratively down down
Serial2/0                  unassigned      YES NVRAM  administratively down down
Serial2/1                  unassigned      YES NVRAM  administratively down down
Serial2/2                  unassigned      YES NVRAM  administratively down down
Serial2/3                  unassigned      YES NVRAM  administratively down down
Serial3/0                  unassigned      YES NVRAM  administratively down down
Serial3/1                  unassigned      YES NVRAM  administratively down down
Serial3/2                  unassigned      YES NVRAM  administratively down down
Serial3/3                  unassigned      YES NVRAM  administratively down down

    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair

Opção 2

    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair


Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, + - replicated route

Gateway of last resort is not set

      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Ethernet0/0
L        192.168.1.1/32 is directly connected, Ethernet0/0

    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair

Opção 3

    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair

Cisco IOS Software, Linux Software (I86BI_LINUX-ADVENTERPRISEK9-M), Experimental Version 12.4(20090407:185408) [yuiu-redbuild-V124_24_5_6_PIC1 177]
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Wed 08-Apr-09 02:09 by yuiu

ROM: Bootstrap program is Linux

R1 uptime is 48 minutes
System returned to ROM by reload at 0
System image file is "unix:/opt/gns3/images/IOU/i86bi-linux-l3-adventerprisek9-12.4.bin"


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Linux Unix (Intel-x86) processor with 40401K bytes of memory.
Processor board ID 2048001
8 Ethernet interfaces
8 Serial interfaces
16K bytes of NVRAM.

Configuration register is 0x0


    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair

Opção 4

    1          Mostrar interfaces

    2          Mostrar rotas

    3          Mostrar versao

    4          Sair


[Connection to 192.168.1.1 closed by foreign host]
R2#
R2#

Att.

Discussão

Insira seu comentário. Sintaxe wiki é permitida:
 
infra-estrutura/cisco/criar_menu_cisco.txt · Última modificação: 2019/05/15 11:46 (edição externa)