En Une :

Exercice de routage statique IPv4 et IPv6 en Cisco IOS

Dans ce cas d'école de routage statique simple, deux routeurs interconnectés entre eux (R1 et R2) connectent chacun un LAN adressé en IPv4 et en IPv6. L'exercice consiste à monter la topologie, à configurer les interfaces en IPv4 et en IPv6 selon le diagramme et à activer et vérifier le routage statique IPv4 et le routage statique IPv6.

1. Topologie et énoncé.

1.1. Topologie

1.2. Description

Dans ce cas d'école, deux routeurs interconnectés entre eux connectent chacun un LAN adressé en IPv4 et en IPv6.

Routeur R1 :

  • 192.168.1.0/24
  • 2001:db8:1ab:1::/64

Routeur R2 :

  • 192.168.2.0/24
  • 2001:db8:1ab:2::/64

Le routeur R1 et le routeur R2 partagent le réseau privé IPv4 192.168.3.0/24. En IPv6, seules les interfaces prennent ici une adresse routable (ici dans le préfixe de documentation 2001:db8::/32). Aussi, toutes les interfaces actives d'un routeur prennent une adresse à portée locale unique (http://cisco.goffinet.org/interfaces-ipv6-en-cisco-ios/) de type Link-Local dans le préfixe fe80::/10 : fe80::1/64 pour R1 et fe80::2/64 pour R2.

1.3. Enoncé

Les LANs sont directement connectés sur l'interface G0/0 de chaque routeur. L'interface G0/1 de R2 connecte l'interface G0/2 de R1.

Les interfaces LAN prennent la première adresse IPv4 disponible et la seconde adresse globale IPv6.

Aussi, on configure une adresse link-local sur chaque interface de R1 en FE80::1 et sur chaque interface de R2 en FE80::2.

On ne manquera pas d'activer un service DHCP et le routage IPv6.

L'exercice consiste à construire les routes IPv4 et IPv6 nécessaires à l'interconnexion des deux LANs distants.

2. Mise en place de la topologie

2.1. Configuration des interfaces sur R1

hostname R1
!
ipv6 unicast-routing
!
interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 ipv6 address fe80::1 link-local
 ipv6 address 2001:db8:1ab:1::1/64
 no shutdown
!
interface GigabitEthernet0/2
 ip address 192.168.3.1 255.255.255.0
 ipv6 address fe80::1 link-local
 no shutdown
!
ip dhcp pool LAN
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
!
end

2.2. Configuration des interfaces sur R2

hostname R2
!
ipv6 unicast-routing
!
interface GigabitEthernet0/0
 ip address 192.168.2.1 255.255.255.0
 ipv6 address fe80::2 link-local
 ipv6 address 2001:db8:1ab:2::1/64
 no shutdown
!
interface GigabitEthernet0/1
 ip address 192.168.3.2 255.255.255.0
 ipv6 address fe80::2 link-local
 no shutdown
!
ip dhcp pool LAN
 network 192.168.2.0 255.255.255.0
 default-router 192.168.2.1
!
end

2.3. Vérification des interfaces en IPv4

Vérification des interfaces : adresse IPv4, "Status" (L1), Protocol (L2), CDP.

show ip interface brief
show cdp neighbors

Sur R1 :

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         192.168.1.1     YES manual up                    up      
GigabitEthernet0/1         unassigned      YES unset  administratively down down    
GigabitEthernet0/2         192.168.3.1     YES manual up                    up      
GigabitEthernet0/3         unassigned      YES unset  administratively down down    
R1#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R2               Gig 0/2           145              R B             Gig 0/1

Total cdp entries displayed : 1


Sur R2 :

R2#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         192.168.2.1     YES manual up                    up      
GigabitEthernet0/1         192.168.3.2     YES manual up                    up      
GigabitEthernet0/2         unassigned      YES unset  administratively down down    
GigabitEthernet0/3         unassigned      YES unset  administratively down down    
R2#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R1               Gig 0/1           136              R B             Gig 0/2

Total cdp entries displayed : 1

2.4. Vérification des interfaces en IPv6

Vérification des interfaces : adresses IPv6, "Status" (L1), Protocol (L2).

show ipv6 interface brief

Sur R1 :

R1#show ipv6 interface brief
GigabitEthernet0/0     [up/up]
    FE80::1
    2001:DB8:1AB:1::1
GigabitEthernet0/1     [administratively down/down]
    unassigned
GigabitEthernet0/2     [up/up]
    FE80::1
GigabitEthernet0/3     [administratively down/down]
    unassigned

Sur R2 :

R2#show ipv6 interface brief
GigabitEthernet0/0     [up/up]
    FE80::2
    2001:DB8:1AB:2::1
GigabitEthernet0/1     [up/up]
    FE80::2
GigabitEthernet0/2     [administratively down/down]
    unassigned
GigabitEthernet0/3     [administratively down/down]
    unassigned

2.5. Vérification de la table de routage IPv4

La commande show ip route nous offre la table de routage IPv4.

Sur R1 :

R1#show ip route
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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

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, GigabitEthernet0/0
L        192.168.1.1/32 is directly connected, GigabitEthernet0/0
      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.3.0/24 is directly connected, GigabitEthernet0/2
L        192.168.3.1/32 is directly connected, GigabitEthernet0/2

Sur R2 :

R2#show ip route
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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.2.0/24 is directly connected, GigabitEthernet0/0
L        192.168.2.1/32 is directly connected, GigabitEthernet0/0
      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.3.0/24 is directly connected, GigabitEthernet0/1
L        192.168.3.2/32 is directly connected, GigabitEthernet0/1

2.6. Vérification de la table de routage IPv6

La commande show ipv6 route nous offre la table de routage IPv6.

Sur R1 :

R1#show ipv6 route
IPv6 Routing Table - default - 3 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
       IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
       ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
       RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
       OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
       lA - LISP away, a - Application
C   2001:DB8:1AB:1::/64 [0/0]
     via GigabitEthernet0/0, directly connected
L   2001:DB8:1AB:1::1/128 [0/0]
     via GigabitEthernet0/0, receive
L   FF00::/8 [0/0]
     via Null0, receive

Sur R2 :

R2#show ipv6 route
IPv6 Routing Table - default - 3 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
       IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
       ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
       RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
       OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
       lA - LISP away, a - Application
C   2001:DB8:1AB:2::/64 [0/0]
     via GigabitEthernet0/0, directly connected
L   2001:DB8:1AB:2::1/128 [0/0]
     via GigabitEthernet0/0, receive
L   FF00::/8 [0/0]
     via Null0, receive

2. Configuration des routes statiques

Sur R1 :

R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2
R1(config)#ipv6 route 2001:db8:1ab:2::/64 g0/2 fe80::2

Sur R2 :

R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
R2(config)#ipv6 route 2001:db8:1ab:1::/64 g0/1 fe80::1

3. Vérification du routage

3.1. Vérification des routes statiques

Sur R1, en IPv4 :

R1#show ip route static
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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

S     192.168.2.0/24 [1/0] via 192.168.3.2

Sur R1, en IPv6 :

R1#show ipv6 route
IPv6 Routing Table - default - 4 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
       IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
       ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
       RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
       OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
       lA - LISP away, a - Application
C   2001:DB8:1AB:1::/64 [0/0]
     via GigabitEthernet0/0, directly connected
L   2001:DB8:1AB:1::1/128 [0/0]
     via GigabitEthernet0/0, receive
S   2001:DB8:1AB:2::/64 [1/0]
     via FE80::2, GigabitEthernet0/2
L   FF00::/8 [0/0]
     via Null0, receive

Sur R2, en IPv4 :

R2#show ip route static
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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

S     192.168.1.0/24 [1/0] via 192.168.3.1

Sur R2, en IPv6 :

R2#show ipv6 route
IPv6 Routing Table - default - 4 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
       IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
       ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
       RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
       OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
       lA - LISP away, a - Application
S   2001:DB8:1AB:1::/64 [1/0]
     via FE80::1, GigabitEthernet0/1
C   2001:DB8:1AB:2::/64 [0/0]
     via GigabitEthernet0/0, directly connected
L   2001:DB8:1AB:2::1/128 [0/0]
     via GigabitEthernet0/0, receive
L   FF00::/8 [0/0]
     via Null0, receive

3.2. Configuration des clients

Rien est à faire sur des clients DHCP et en autoconfiguration.

3.3. Vérification de la connectivité de bout en bout

De PC1 (192.168.1.2) à PC2 (192.168.2.2), en IPv4 :

[[email protected] ~]# ping -c1 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=62 time=11.2 ms

--- 192.168.2.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 11.267/11.267/11.267/0.000 ms
[[email protected] ~]# traceroute 192.168.2.2
traceroute to 192.168.2.2 (192.168.2.2), 30 hops max, 60 byte packets
 1  gateway (192.168.1.1)  11.396 ms  18.836 ms  21.660 ms
 2  192.168.3.2 (192.168.3.2)  6.736 ms  7.316 ms  36.591 ms
 3  192.168.2.2 (192.168.2.2)  27.407 ms  27.245 ms  27.083 ms

De PC2 (2001:db8:1ab:2::1) à PC1 (2001:db8:1ab:1::1), en IPv6 :

[[email protected] ~]# ping6 -c 1 2001:db8:1ab:1::1
PING 2001:db8:1ab:1::1(2001:db8:1ab:1::1) 56 data bytes
64 bytes from 2001:db8:1ab:1::1: icmp_seq=1 ttl=63 time=3.64 ms

--- 2001:db8:1ab:1::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.645/3.645/3.645/0.000 ms
[[email protected] ~]# traceroute6 2001:db8:1ab:1::1
traceroute to 2001:db8:1ab:1::1 (2001:db8:1ab:1::1), 30 hops max, 80 byte packets
 1  2001:db8:1ab:2::1 (2001:db8:1ab:2::1)  10.199 ms  11.202 ms  12.447 ms
 2  2001:db8:1ab:1::1 (2001:db8:1ab:1::1)  6.955 ms  6.838 ms  13.712 ms

4. Variantes sur les routes statiques

4.1. Ajout d'un préfixe IPv6

4.2. Autres routes

  • Route par défaut IPv4.
  • Routes plus larges IPv6 : ::/0, 2000::/3, FD00::/8.
Author image
Francois Goffinet est formateur Cisco Systems depuis 2002. Passionné des technologies des réseaux, de virtualisation et en nuage, Web et de cybersécurité souvent en Open Source ou Unix-Like, devops.