Notes
Marie Deblon
2 novembre 2024
1
Table des matières
1 Switch layer 2 3
1.1 Création des VLANs . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Assignation des Ports aux VLANs . . . . . . . . . . . . . . . 3
1.3 Vérification configuration . . . . . . . . . . . . . . . . . . . . 4
2 Configuration du Routage 4
2.1 Routage Inter-VLAN . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Réseau entre Routeurs . . . . . . . . . . . . . . . . . . . . . . 5
3 EtherChannel (switch) 5
4 Dynamic Routing (routeur) 6
4.1 RIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2 EIGRP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 OSPF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5 DHCP (routeur) 9
6 Switch layer 3 9
2
root@mieke:~# screen /dev/ttyUSB0 115200
1 Switch layer 2
1.1 Création des VLANs
enable
configure terminal
vlan 110
name Serveur
exit
vlan 120
name Compta
exit
vlan 99
name VLAN_natif
exit
1.2 Assignation des Ports aux VLANs
• An access port can have only one VLAN configured on the interface ;
it can carry traffic for only one VLAN.
• An trunk port can have two or more VLANs configured on the interface ;
it can carry traffic for several VLANs simultaneously.
• switchport trunk native vlan 99 : Définit le VLAN 99 comme
VLAN natif. Cela signifie que toute trame non taggée sur ce trunk
sera assignée au VLAN 99.
interface FastEthernet0 /0
switchport mode access
switchport access vlan 110
no shutdown
exit
interface FastEthernet0 /2
switchport mode access
switchport access vlan 120
no shutdown
exit
interface FastEthernet0 /23
switchport mode trunk
3
switchport trunk allowed vlan 110 ,120
no shutdown
exit
interface FastEthernet0 /24
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan 10 ,20 ,30 ,99
no shutdown
1.3 Vérification configuration
show running - config
show interfaces status
show vlan brief
show ip interface brief
show interfaces trunk
show interface FastEthernet0 /24 switchport
show ip route
show arp
2 Configuration du Routage
2.1 Routage Inter-VLAN
enable
configure terminal
// Activer l' interface Gig0 /0
interface Gig0 /0
no shutdown
exit
// Créer une sous - interface pour le VLAN 110
interface Gig0 /0.110
encapsulation dot1Q 110 // Indique que cette sous - interface est
pour le VLAN 110
ip address [Link] [Link] // gateway pour VLAN 110
// Créer une sous - interface pour le VLAN 120
interface Gig0 /0.120
encapsulation dot1Q 120 // Indique que cette sous - interface est
pour le VLAN 120
ip address [Link] [Link] // gateway pour VLAN 120
exit
4
2.2 Réseau entre Routeurs
// Réseau entre les routeurs est [Link]/30
// Routeur 1
interface Se0 /0/0
ip address [Link] [Link]
no shutdown
// Routeur 2
interface Se0 /0/0
ip address [Link] [Link]
no shutdown
3 EtherChannel (switch)
Agrégation de liens permettant d’assembler plusieurs liens physiques Ethernet
en un lien logique → résoudre problème de vitesse & spanning tree.
SW( config )# port - channel load - balance _ (mode) {src -dst -ip}
SW# show etherchannel load - balance
SW(config -if)# channel -group _ ( number ) mode _ { desirable |auto|
active | passive |on} // configures an interface to be part on an
EtherChannel
SW# show etherchannel summary
SW# show etherchannel port - channel
Exemple SW layer 2:
SW > enable
SW#show spanning -tree
SW# configure terminal
SW( config )#int range g0/1-2
SW(config -if -range)#channel - group 1 mode ?
active // LACP
auto // PAgP (cisco only)
desirable // PAgP (cisco only)
on // enable Etherchannel only ( static )
passive // LACP
SW(config -if -range)#channel - group 1 mode active
SW(config -if -range)#int po1
// can arrive -> SW(config -if)# switchport trunk encapsulation dot1q
SW(config -if)# switchport mode trunk
SW(config -if)#do show running - config
SW(config -if)#do show etherchannel summary // check Po1(SU) for
S= Layer2 and U=in use and Gig0 /1(P) for P=in port - channel
SW(config -if)#do show interface trunk
Exemple SW layer 3:
SW > enable
SW# configure terminal
SW( config )# interface range g1 /0/1 -2
5
SW(config -if -range)#no switchport
SW(config -if -range)#channel -group 2 mode on // mode static
//ip address sur int po2 vu qu 'on est en layer3
SW(config -if -range)#int po2
SW(config -if)#ip address [Link] [Link]
SW(config -if)#do show etherchannel summary // check Po2(RU) for
R= layer3
SW(config -if)#exit
SW( config )#ip routing
SW( config )#so show ip route
// next step layer3 chapter ...
4 Dynamic Routing (routeur)
Maintenir la meilleure route entre les réseaux automatiquement en utilisant
la metric value.
• Metric = parameter to choose the best way IAW the protocol(a lower
metric = better)
• AD = administrative distance is used to determine which routing
protocol is preferred (a lower AD = better)
• Network route = route to a network/subnet (mask length < /32)
• Host route = route to a specific host (/32 mask)
• IGP = Interior Gateway Protocol
– Distance Vector → RIP and EIGRP = Enhanced Interior Gateway
Routing Protocol
– Link State → OSPF = Open Shortest Path First and IS-IS =
Intermediate System to Intermediate System
• EGP = Exterior Gateway Protocol
– Path Vector → BGP (Border Gateway Protocol) only EGP used
in the modern network
• ECMP = Equal Cost Multi-Path
• RIP = Routing Information Protocol
– metric = hop count
– one hop = one router
– max hop count = 15
6
• OSPF = Open Shortest Path First
– routers store information about the network in LSA (Link State
Advertisements) which are organized in a structure called the
LSBD (Link State Datebase)
– algorithme SPF pour calculer le meilleur itinéraire
Routeur > enable
Routeur #show ip route
Routeur #show ip protocols
C:\> tracert [Link]
Tracing route to [Link] over a maximum of 30 hops:
1 0ms 0ms [Link]
2 0ms 12ms [Link]
3 0ms 16ms [Link]
4 15ms 0ms [Link]
5 11ms 11ms [Link]
//" ping" mais chaque hops layer 3 le long de l' itinéraire
renvoie un message back
//" tracert " pour les windows
//" traceroute " pour cisco IOS
4.1 RIP
Routeur ( config )# router rip
Routeur (config - router )# version 2 // pour utiliser VLSM et CIDR
Routeur (config - router )#no auto - summary // pour ne pas convertir en
réseau par classe (A, B, C)
Routeur (config - router )# network [Link]
Routeur (config - router )#passive - interface g2/0 //to stop sending
RIP advertisements
Routeur (config - router )#default - information originate // route
par défaut vers l' extérieur
Routeur (config - router )#maximum -paths 8 //<1-32> Number of paths
Routeur (config - router )# distance 120 // <1 -255 > Administrative
distance
Routeur ( config )#ip route [Link] [Link] [Link]( ip interface
de sortie vers internet )
%----------------------------------------%
// Interface entre les routeurs
R1( config )# interface Serial0 /0/0
R1(config -if)# ip address [Link] [Link]
R1(config -if)# no shutdown
// Activer le routage de tous les sous - réseaux
LLN( config )# router rip
LLN(config - router )# version 2
LLN(config - router )# network [Link]
7
LLN(config - router )# network [Link]
LLN(config - router )# network [Link]
LLN(config - router )# network [Link]
LLN(config - router )# network [Link]
// Vérification
LLN#show ip route
LLN#show ip protocols
4.2 EIGRP
Routeur ( config )# router ergrp 1
Routeur (config - router )#no auto - summary
Routeur (config - router )#passive - interface g2/0
Routeur (config - router )# network [Link]
Routeur (config - router )# network [Link] [Link] // EIGRP uses a
wildcard mask instead of a subnet mask
4.3 OSPF
Routeur ( config )# router ospf ?
<1 -65535 > Process ID
Routeur ( config )# router ospf 1 // OSPF process ID is locally
significant . Routers with differnt process ID 's can become
OSPF neighbors
Routeur (config - router )# network [Link] [Link] area 0 // network
wildcard_mask area
Routeur (config - router )#passive - interface g2/0
// passive - interface command tells the router to stop sending
OSPF " hello" messages out of the interface
// router will continue to send LSA informing it 's neighbors
about the subnet configured on the interface
Routeur (config - router )#router -id ?
A.B.C.D OSPF router -id in IP address format
Routeur (config - router )# router id [Link]
OSPF : Reload or use "clear ip ospf process " command , for this to
take effect
Routeur # clear ip ospf process
Routeur #show ip ospf database
Routeur #show ip ospf neighbor
R1( config )#int l0
R1(config -if)#ip address [Link] [Link]
R1(config -if)#do show ip interface brief
R1(config -if)#do show interface l0
R1(config -if)# router ospf 4
R1(config - router )#net [Link] [Link] area 0
8
5 DHCP (routeur)
Dynamic Host Configuration Protocol, assure la configuration automatique
des pramètre IP d’une machine (IP address, masque de sous-réseau, ...)
• DHCP discover (Are there any DHCP servers in this network ?) →
DHCP offer (How about this IP address ?) → DHCP request message
(I want to use the IP address you offered me) → DHCP ack (okey,
you may use it)
• Source port 68 → destination port 67
R1( config )#ip dhcp excluded - address [Link] [Link]
R1( config )#ip dhcp pool LAB_POOL // subnet address attribuées
aux clients DHCP , ainsi que d' autres informations telles que
le server DNS et gateway
R1(dhcp - config )# network [Link] /24 // range to assigned to
clients
R1(dhcp - config )#dns - server [Link] // google server
R1(dhcp - config )#domaine -name marie .com
R1(dhcp - config )#default - router [Link] // default gateway
R1(dhcp - config )#lease 0 5 30 // TTL days hours minutes
R1#show ip dhcp binding
C:\> ipconfig /all
DHCP relay agent :
R1( config )# interface g0 /1 // interface connected to the
subnet of the client devices
R1(config -if)#ip helper - address [Link] //ip address
of the DHCP server as the " helper " address
R1(config -if#do show ip interface g0 /1
6 Switch layer 3
SW( config )# default interface g0/0 // pour réinitialiser g0/0 à
ses paramètre par défaut
SW( config )#ip routing // enables Layer 3 routing on the
switch
SW( config )# interface g0/0
SW(config -if)#no swichport // port layer 2 to a layer 3
SW(config -if)#ip address [Link] [Link]
SW(config -if)#do show interfaces status
SW( config )# interface vlan10
SW(config -if)#ip address [Link] [Link]
SW(config -if)#no shutdown
9
%----------------------------------%
Switch -L3( config )#ip routing
Switch -L3( config )# interface vlan 2
Switch -L3(config -if)#ip address [Link] [Link]
Switch -L3(config -if)#no shutdown
Switch -L3(config -if)# interface vlan 3
Switch -L3(config -if)#ip address [Link] [Link]
Switch -L3(config -if)#no shutdown
// On peut configurer une interface en layer 3 (no switchport ). Et
ensuite lui assigner une adresse IP
Switch -L3( config )#int g0/1
Switch -L3(config -if)#no switchport
Switch -L3(config -if)#ip address [Link] [Link]
Switch -L3( config )# router rip
Switch -L3(config - router )# network [Link]
Switch -L3(config - router )# network [Link]
Switch -L3(config - router )# network [Link]
Switch -L3#show ip route
[...] >
Switch -L3#
%--------------------------------%
hostname Switch -L3
!
ip routing
!
interface FastEthernet0 /1
no switchport
ip address [Link] [Link]
!
interface GigabitEthernet0 /1
switchport trunk native vlan 99
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface GigabitEthernet0 /2
switchport trunk native vlan 99
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface Vlan30
ip address [Link] [Link]
no shutdown
!
interface Vlan40
ip address [Link] [Link]
no shutdown
!
10
interface Vlan99
ip address [Link] [Link]
no shutdown
!
router rip
network [Link]
network [Link]
network [Link]
network [Link]
!
vlan 30
name user
vlan 40
name compta
vlan 99
name VLAN_natif
end
11