Diferència entre revisions de la pàgina «A3. Configuració bàsica»
De Wiki IES Marianao. Departament Informàtica
(→= Comandes bàsiques mode usuari) |
|||
(Hi ha 24 revisions intermèdies del mateix usuari que no es mostren) | |||
Línia 8: | Línia 8: | ||
− | El sistema d’ajuda del IOS es basa en el caràcter “?” | + | El sistema d’ajuda del IOS es basa en el caràcter “?” i el tabulador (per completar comandes) |
Línia 19: | Línia 19: | ||
Els diferents modes es diferencien pel prompt. | Els diferents modes es diferencien pel prompt. | ||
− | <pre> | + | <html><pre><code class="cisco"> |
/* Mode usuari*/ | /* Mode usuari*/ | ||
Switch> | Switch> | ||
Línia 34: | Línia 34: | ||
/* Mode configuració global */ | /* Mode configuració global */ | ||
Switch(config)# | Switch(config)# | ||
− | </pre> | + | </code></pre></html> |
=== Configuració del Switch === | === Configuració del Switch === | ||
Línia 49: | Línia 49: | ||
==== Comandes bàsiques mode usuari ==== | ==== Comandes bàsiques mode usuari ==== | ||
− | <pre> | + | <html><pre><code class="cisco"> |
Switch>show version | Switch>show version | ||
Switch>show flash: | Switch>show flash: | ||
Switch>show mac-address-table | Switch>show mac-address-table | ||
Switch>enable | Switch>enable | ||
− | </pre> | + | </code></pre></html> |
− | ==== Comandes bàsiques mode privilegiat === | + | ==== Comandes bàsiques mode privilegiat ==== |
− | <pre> | + | <html><pre><code class="cisco"> |
Switch#show running-config | Switch#show running-config | ||
Switch#show vlan | Switch#show vlan | ||
Línia 70: | Línia 70: | ||
/* Posar password */ | /* Posar password */ | ||
− | Switch(config)#enable secret | + | Switch(config)#enable secret marianao |
− | + | /* SMS entrada */ | |
+ | Switch(config)#banner motd # | ||
+ | Enter TEXT message. End with the character '#'. | ||
+ | Benvingut al commutador# | ||
+ | /* Configuració línia (CLI) accés consola */ | ||
+ | Switch(config)#line console 0 | ||
+ | Switch(config-line)#? | ||
+ | Line configuration commands: | ||
+ | access-class Filter connections based on an IP access list | ||
+ | databits Set number of data bits per character | ||
+ | default Set a command to its defaults | ||
+ | exec-timeout Set the EXEC timeout | ||
+ | exit Exit from line configuration mode | ||
+ | flowcontrol Set the flow control | ||
+ | history Enable and control the command history function | ||
+ | ipv6 IPv6 options | ||
+ | logging Modify message logging facilities | ||
+ | login Enable password checking | ||
+ | motd-banner Enable the display of the MOTD banner | ||
+ | no Negate a command or set its defaults | ||
+ | parity Set terminal parity | ||
+ | password Set a password | ||
+ | privilege Change privilege level for line | ||
+ | speed Set the transmit and receive speeds | ||
+ | stopbits Set async line stop bits | ||
+ | transport Define transport protocols for line | ||
+ | Switch(config-line)#password marianao | ||
+ | Switch(config-line)#login | ||
+ | Switch(config-line)#exit | ||
+ | |||
+ | </code></pre></html> | ||
==== Posar una IP d’administració VLAN 1 ==== | ==== Posar una IP d’administració VLAN 1 ==== | ||
− | <pre> | + | <html><pre><code class="cisco"> |
Switch(config)#interface VLAN 1 | Switch(config)#interface VLAN 1 | ||
Línia 85: | Línia 115: | ||
Switch(config)#ip default-gateway 192.168.140.1 | Switch(config)#ip default-gateway 192.168.140.1 | ||
− | </pre> | + | </code></pre></html> |
− | |||
==== Configurar terminal virtual (Accés Telnet) ==== | ==== Configurar terminal virtual (Accés Telnet) ==== | ||
− | <pre> | + | <html><pre><code class="cisco"> |
Switch(config)#line vty 0 | Switch(config)#line vty 0 | ||
Switch(config-line)#password **** | Switch(config-line)#password **** | ||
Switch(config-line)#login | Switch(config-line)#login | ||
+ | Switch(config-line)#exit | ||
+ | Switch(config)#service password-encryptio | ||
− | </ | + | </code></pre></html> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ==== Configurar terminal virtual (Accés SSH) ==== | ||
+ | http://www.cisco.com/en/US/docs/switches/lan/catalyst2950/software/release/12.1_22_ea11x/configuration/guide/swauthen.html | ||
− | |||
+ | Limitar accés remot al ssh | ||
+ | <html><pre><code class="cisco"> | ||
+ | switch2(config)#line vty 0 4 | ||
+ | switch2(config-line)#transport input ssh | ||
+ | switch2(config-line)#login local | ||
+ | switch2(config-line)#exit | ||
+ | switch2(config)# | ||
+ | </code></pre></html> | ||
+ | 'login local' per verificar el password amb els usuaris locals | ||
− | + | Després cal activar el protocol SSH i afegir l' usuari per connectar | |
+ | <html><pre><code class="cisco"> | ||
+ | switch2(config)#username userqualsevol secret 0 marianao | ||
+ | switch2(config)#ip domain-name test.marianao.edu | ||
+ | switch2(config)#crypto key generate rsa | ||
+ | The name for the keys will be: ..... | ||
+ | ... | ||
+ | </code></pre></html> | ||
+ | Indicant '0' el password va sense xifrar (El '5' significa password directament codificat xifrat) | ||
+ | ==== Configurar Accés Web ==== | ||
+ | Aquesta opció no està disponible per a tots els dispositius | ||
+ | <html><pre><code class="cisco"> | ||
+ | Switch(config)#ip http server | ||
− | + | </code></pre></html> | |
=== Bones pràctiques === | === Bones pràctiques === | ||
Línia 182: | Línia 176: | ||
* Posar porta d’enllaç per accedir a altres xarxes (Comprovar connectivitat) | * Posar porta d’enllaç per accedir a altres xarxes (Comprovar connectivitat) | ||
* Mantenir els dispositius de xarxa a la VLAN d’administració i posar tots els ports en una altre VLAN. Així el tràfec de les xarxes queda separat de la xarxa d’administració. | * Mantenir els dispositius de xarxa a la VLAN d’administració i posar tots els ports en una altre VLAN. Així el tràfec de les xarxes queda separat de la xarxa d’administració. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revisió de 02:58, 21 ago 2024
torna M7 - Planificació i administració de xarxes
Contingut
Configuració bàsica
IOS. Modes de funcionament
El sistema d’ajuda del IOS es basa en el caràcter “?” i el tabulador (per completar comandes)
El IOS funciona amb diferents modes de comandes, cada mode té diferents nivells de seguretat i comandes específiques.
- Mode usuari -> Consulta
- Mode privilegiat -> Consultat amb privilegis
- Modes específics (Múltiples) -> Configuració específica de cada element
Els diferents modes es diferencien pel prompt.
/* Mode usuari*/
Switch>
/* Canvi a mode privilegiat */
Switch>enable
/* Mode privilegiat */
Switch#
/* Canvia a configuració global */
Switch#configure terminal
/* Mode configuració global */
Switch(config)#
Configuració del Switch
Inicialment els valors per defecte són:
- Nom de commutador "Switch"
- Per defecte no té IP, es pot configurar una per tasques administratives (Per exemple connexió telnet).
- Tots els ports es configuren a la VLAN 1 (Xarxa Virtual 1). Anomenada d’administració.
- Spannig Tree també està actiu.
Comandes bàsiques mode usuari
Switch>show version
Switch>show flash:
Switch>show mac-address-table
Switch>enable
Comandes bàsiques mode privilegiat
Switch#show running-config
Switch#show vlan
Switch#show interfaces
Switch#configure terminal
/* Posar nom */
Switch(config)#hostname NomDelSwitch
/* Posar password */
Switch(config)#enable secret marianao
/* SMS entrada */
Switch(config)#banner motd #
Enter TEXT message. End with the character '#'.
Benvingut al commutador#
/* Configuració línia (CLI) accés consola */
Switch(config)#line console 0
Switch(config-line)#?
Line configuration commands:
access-class Filter connections based on an IP access list
databits Set number of data bits per character
default Set a command to its defaults
exec-timeout Set the EXEC timeout
exit Exit from line configuration mode
flowcontrol Set the flow control
history Enable and control the command history function
ipv6 IPv6 options
logging Modify message logging facilities
login Enable password checking
motd-banner Enable the display of the MOTD banner
no Negate a command or set its defaults
parity Set terminal parity
password Set a password
privilege Change privilege level for line
speed Set the transmit and receive speeds
stopbits Set async line stop bits
transport Define transport protocols for line
Switch(config-line)#password marianao
Switch(config-line)#login
Switch(config-line)#exit
Posar una IP d’administració VLAN 1
Switch(config)#interface VLAN 1
Switch(config-if)#ip address 192.168.140.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config)#ip default-gateway 192.168.140.1
Configurar terminal virtual (Accés Telnet)
Switch(config)#line vty 0
Switch(config-line)#password ****
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#service password-encryptio
Configurar terminal virtual (Accés SSH)
Limitar accés remot al ssh
switch2(config)#line vty 0 4
switch2(config-line)#transport input ssh
switch2(config-line)#login local
switch2(config-line)#exit
switch2(config)#
'login local' per verificar el password amb els usuaris locals
Després cal activar el protocol SSH i afegir l' usuari per connectar
switch2(config)#username userqualsevol secret 0 marianao
switch2(config)#ip domain-name test.marianao.edu
switch2(config)#crypto key generate rsa
The name for the keys will be: .....
...
Indicant '0' el password va sense xifrar (El '5' significa password directament codificat xifrat)
Configurar Accés Web
Aquesta opció no està disponible per a tots els dispositius
Switch(config)#ip http server
Bones pràctiques
Normalment és aconsellable:
- Indicar un nom al Switch
- Establir paraules de pas per consola i vty (interface virtual)
- Posar una IP per accés remot
- Posar porta d’enllaç per accedir a altres xarxes (Comprovar connectivitat)
- Mantenir els dispositius de xarxa a la VLAN d’administració i posar tots els ports en una altre VLAN. Així el tràfec de les xarxes queda separat de la xarxa d’administració.