# Accès distants > Accès distant aux équipements Cisco. Publié le 2021-09-14 | Mis à jour le 2025-01-12 | Tags: cisco https://xsec.fr/networking/acces-distants/ --- import Callout from '@shared/components/Callout.astro' import { Tabs, Tab } from '@/components/ui/tabs' Nommer chaque équipement avec une nomenclature réfléchie permet de gagner du temps. ```txt title="SW1(config)#" SW1(config)# hostname SW1 ``` ## Telnet Telnet est le moyen le plus rapide pour configurer, mais n'est pas sécurisé. Il faut attribuer un mot de passe : ```txt title="SW1(config)#" SW1(config)# enable secret mon_mdp ``` Pour joindre votre équipement en Telnet, il faut un VLAN actif avec une adresse IP. Il est conseillé d'utiliser le VLAN 99, pour simplifier l'administration des équipements. ```txt title="SW1(config)#" SW1(config)# vlan 99 SW1(config-vlan)# exit SW1(config)# int vlan 99 SW1(config-if)# %LINK-5-CHANGED: Interface Vlan99, changed state to up SW1(config-if)# ip address 192.168.1.2 255.255.255.0 SW1(config-if)# exit SW1(config)# ip default-gateway 192.168.1.254 /* passerelle du LAN */ ``` - Activer Telnet : ```txt title="SW1(config)#" SW1(config)# line vty 0 1 ``` `0` est le numéro de la ligne. `1` est le nombre maximum de connexions simultanées. Configuration du mot de passe de la ligne : ```txt title="SW1(config-line)#" SW1(config-line)# password mon_mdp SW1(config-line)# login ``` ### Résumé des commandes Une fois votre `VLAN 99` créé et adressé, que votre `gateway` est bien définie ; vous pouvez copier/coller ces lignes directement (en adaptant votre configuration), dans votre terminal : ```txt title="Terminal" conf t int vlan 99 ip address 192.168.1.2 255.255.255.0 no shut exit ip default-gateway 192.168.1.1 line vty 0 1 password mon_mdp login ``` ```txt title="Terminal" conf t int vlan 99 ip address 192.168.1.2 255.255.255.0 no shut exit ip default-gateway 192.168.1.1 ip domain-name 1234.com crypto key generate rsa 2048 ip ssh version 2 username admin password mon_mdp line vty 0 1 login local transport input ssh ``` ## SSH Le moyen le plus sécurisé, il ajoute une couche de chiffrement. Sa configuration est initialement, similaire à Telnet : ```txt title="SW1(config)#" SW1(config)# int vlan 99 SW1(config-if)# ip address 192.168.1.2 255.255.255.0 SW1(config-if)# no shut SW1(config-if)# exit SW1(config)# ip default-gateway 192.168.1.1 /* passerelle du LAN */ ``` - Il est nécessaire d'entrer un nom de domaine : ```txt title="SW1(config)#" SW1(config)# ip domain-name 1234.com ``` - Génération des clés de chiffrement RSA : ```txt title="SW1(config)#" SW1(config)# crypto key generate rsa The name for the keys will be: sw1.1234.com Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [512]: 2048 % Generating 2048 bit RSA keys, keys will be non-exportable... [OK] ``` Pour éviter des failles de sécurité largement répandues avec SSH v1, passez en version 2 : ```txt title="SW1(config)#" SW1(config)# ip ssh version 2 ``` - Configuration d'un login/password : ```txt title="SW1(config)#" SW1(config)# username admin password mon_mdp ``` - Configuration de la ligne 0, pour déclarer que seulement 1 utilisateur sur le protocole SSH sera autorisé : ```txt title="SW1(config)#" SW1(config)# line vty 0 1 SW1(config-line)# login local SW1(config-line)# transport input ssh ```