Skip to main content

Switchs & routeurs Cisco

Aide mémoire des commandes de commutateurs Cisco

Changer de mode :
switch> enable				# Commande pour passer du Mode 1 au Mode 2. 
switch# conf t				# Commande pour passer du Mode 2 au Mode 3.
switch(config)#             # Nous sommes désormais dans le mode 3
 
Afficher les VLANs : 
switch# show vlan
 
Configurer un port : 
switch(config)# interface fastEthernet 0/1
switch(config-if)# switchport access vlan 50
switch(config-if)# exit
switch(config)# 

 

Configurer une plage de port :
switch(config)# interface range fastEthernet 0/1-24
switch(config-if)# switchport access vlan 30
switch(config-if-range)# exit
switch(config)#  
 
Réinitialiser le switch :
switch# write erase
switch# reload
Configurer SSH : 
SW_POD4_BOT(config)#username pod4-user password P@ssw0rd
SW_POD4_BOT(config)#ip domain-name gsb.local
SW_POD4_BOT(config)#crypto key generate rsa general-keys modulus 1024
SW_POD4_BOT(config)# line vty 0 4
SW_POD4_BOT(config-line)# transport input ssh
SW_POD4_BOT(config-line)# login local
SW_POD4_BOT(config-line)# exit

 

Configurer le routage : 
# VLAN SORTIE
switch(config)# interface vlan 400
switch(config-if)# ip address 172.31.192.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)# 

# VLAN GSB
switch(config)# interface vlan 300
switch(config-if)# ip address 172.31.64.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)# 

# VLAN SUPERVISION
switch(config)# interface vlan 200
switch(config-if)# ip address 172.31.128.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)# 

# Route par défaut
switch(config)#ip route 0.0.0.0 0.0.0.0 172.31.192.2
Relai DHCP : 
switch(config)# interface vlan 100
switch(config-if)# ip helper-address 172.31.64.2

 

Activation du routage statique :
switch(config)#sdm prefer landbase-routing
switch(config-if)#switch#write
switch#reload

 

Activation du routage :
switch(config)#ip routing
 
Affichage du routage :
switch#show ip route

Activer le trunk : 

SW_POD4_BOT#configure terminal
SW_POD4_BOT(config)#interface gigabitEthernet 0/2
SW_POD4_BOT(config-if)#switchport mode trunk
W_POD4_BOT(config-if)#switchport trunk allowed vlan none
SW_POD4_BOT(config-if)#switchport trunk allowed vlan add 400
SW_POD4_BOT(config-if)#switchport trunk allowed vlan add 300
SW_POD4_BOT(config-if)#switchport trunk allowed vlan add 200
SW_POD4_BOT(config-if)#switchport trunk allowed vlan add 100

Routage sur un routeur 

 

# VLAN SORTIE
switch(config)# Interface GigabitEthernet 0/1.400
switch(config-if)# encapsulation dot1q 400
switch(config-if)# ip address 172.31.192.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)#

# VLAN SERVEURS
switch(config)# Interface GigabitEthernet 0/1.300
switch(config-if)# encapsulation dot1q 300
switch(config-if)# ip address 172.31.64.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)#

# VLAN SUPERVISION
switch(config)# Interface GigabitEthernet 0/1.200
switch(config-if)# encapsulation dot1q 200
switch(config-if)# ip address 172.31.128.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)#

# VLAN SERVICES UTILISATEURS
switch(config)# Interface GigabitEthernet 0/1.100
switch(config-if)# encapsulation dot1q 100
switch(config-if)# ip address 172.31.0.1 255.255.192.0
switch(config-if)# no shutdown
switch(config-if)# exit
switch(config)#

# Route par défaut

interface GigabitEthernet 0/1
switch(config)#ip route 0.0.0.0 0.0.0.0 172.31.192.2
switch(config)#no shutdown