Páginas

viernes, 28 de febrero de 2020

Rutas estáticas Mikrotik GNS3



Cambiar nombre a los routers y asignar las IPs que corresponden a cada interfaz

[admin@MikroTik] > system identity set name=R1
[admin@R1] > interface print
Flags: D - dynamic, X - disabled, R - running, S - slave 
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  R  ether1                              ether            1500
 1  R  ether2                              ether            1500
 2  R  ether3                              ether            1500

[admin@R1] > ip neighbor print
 # INTERFACE ADDRESS                                 MAC-ADDRESS      
 0 ether2                                            0C:12:A6:34:92:01
 1 ether3                                            0C:12:A6:62:54:01

[admin@R1] > ip address add address=10.10.10.9/30 interface=ether
ether1  ether2  ether3
[admin@R1] > ip address add address=10.10.10.9/30 interface=ether2
[admin@R1] > ip neighbor print                                    
 # INTERFACE ADDRESS                                 MAC-ADDRESS      
 0 ether2                                            0C:12:A6:34:92:01
 1 ether3                                            0C:12:A6:62:54:01
[admin@R1] > ip address add address=10.10.10.1/30 interface=ether3 
[admin@R1] > ip address add address=192.168.1.254/24 interface=ether1    
       
[admin@R1] > ip address print
Flags: X - disabled, I - invalid, D - dynamic 
 #   ADDRESS            NETWORK         INTERFACE                              
 0   10.10.10.9/30      10.10.10.8      ether2                                 
 1   10.10.10.1/30      10.10.10.0      ether3                                 
 2   192.168.1.254/24   192.168.1.0     ether1                                 
[admin@R1] > 

Rutas que se han agregado automáticamente:

[admin@R1] > ip route print
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  10.10.10.0/30      10.10.10.1      ether3                    0
 1 ADC  10.10.10.8/30      10.10.10.9      ether2                    0
 2 ADC  192.168.1.0/24     192.168.1.254   ether1                    0

R1 agregar rutas estáticas siguiendo el sentido de las agujas del reloj:

[admin@R1] > ip route add dst-address=192.168.3.0/24 gateway=10.10.10.10        
[admin@R1] > ip route add dst-address=192.168.2.0/24 gateway=10.10.10.10   
[admin@R1] > ip route add dst-address=10.10.10.4/30 gateway=10.10.10.10   

A S - rutas activas y estáticas      

[admin@R1] > ip route print
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  10.10.10.0/30      10.10.10.1      ether3                    0
 1 A S  10.10.10.4/30                      10.10.10.10               1
 2 ADC  10.10.10.8/30      10.10.10.9      ether2                    0
 3 ADC  192.168.1.0/24     192.168.1.254   ether1                    0
 4 A S  192.168.2.0/24                     10.10.10.10               1
 5 A S  192.168.3.0/24                     10.10.10.10               1
[admin@R1] > 
[admin@MikroTik] > system identity set name=R2
[admin@R2] > ip neighbor print
 # INTERFACE ADDRESS                                 MAC-ADDRESS      
 0 ether2    10.10.10.9                              0C:12:A6:51:E0:01
 1 ether3                                            0C:12:A6:62:54:02

[admin@R2] > ip address add address=10.10.10.10/30 interface=ether2
[admin@R2] > ping 10.10.10.9
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 10.10.10.9                                 56  64 18ms 
    1 10.10.10.9                                 56  64 4ms  
    sent=2 received=2 packet-loss=0% min-rtt=4ms avg-rtt=11ms max-rtt=18ms 

[admin@R2] > ip address add address=10.10.10.6/30 interface=ether3  
[admin@R2] > ip neighbor print                                     
 # INTERFACE ADDRESS                                 MAC-ADDRESS      
 0 ether2    10.10.10.9                              0C:12:A6:51:E0:01
 1 ether3                                            0C:12:A6:62:54:02

[admin@R2] > ip address print                                     
Flags: X - disabled, I - invalid, D - dynamic 
 #   ADDRESS            NETWORK         INTERFACE                              
 0   10.10.10.10/30     10.10.10.8      ether2                                 
 1   10.10.10.6/30      10.10.10.4      ether3  
                               
[admin@R2] > ip address add address=192.168.3.254/24 interface=ether
ether1  ether2  ether3
[admin@R2] > ip address add address=192.168.3.254/24 interface=ether1

[admin@R2] > ip address print                                        
Flags: X - disabled, I - invalid, D - dynamic 
 #   ADDRESS            NETWORK         INTERFACE                              
 0   10.10.10.10/30     10.10.10.8      ether2                                 
 1   10.10.10.6/30      10.10.10.4      ether3                                 
 2   192.168.3.254/24   192.168.3.0     ether1                                 
[admin@R2] > 

[admin@R2] > ip route print
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  10.10.10.4/30      10.10.10.6      ether3                    0
 1 ADC  10.10.10.8/30      10.10.10.10     ether2                    0
 2 ADC  192.168.3.0/24     192.168.3.254   ether1                    0

R2 agregar rutas estáticas siguiendo el sentido de las agujas del reloj:

[admin@R2] > ip route add dst-address=192.168.1.0/24 gateway=10.10.10.5
[admin@R2] > ip route add dst-address=192.168.2.0/24 gateway=10.10.10.5 
[admin@R2] > ip route add dst-address=10.10.10.0/30 gateway=10.10.10.5          
[admin@R2] > ip route print
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 A S  10.10.10.0/30                      10.10.10.5                1
 1 ADC  10.10.10.4/30      10.10.10.6      ether3                    0
 2 ADC  10.10.10.8/30      10.10.10.10     ether2                    0
 3 A S  192.168.1.0/24                     10.10.10.5                1
 4 A S  192.168.2.0/24                     10.10.10.5                1
 5 ADC  192.168.3.0/24     192.168.3.254   ether1                    1

[admin@MikroTik] > system identity set name=R3
[admin@R3] > ip neighbor print
 # INTERFACE ADDRESS                                 MAC-ADDRESS      
 0 ether2    10.10.10.1                              0C:12:A6:51:E0:02
 1 ether3    10.10.10.6                              0C:12:A6:34:92:02

R3 agregar rutas estáticas siguiendo el sentido de las agujas del reloj:

[admin@R3] > ip address add address=10.10.10.2/30 interface=ether2
[admin@R3] > ip address add address=10.10.10.5/30 interface=ether3 
[admin@R3] > ip address add address=192.168.2.254/24 interface=ether1
[admin@R3] > ping 10.10.10.6
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 10.10.10.6                                 56  64 17ms 
    1 10.10.10.6                                 56  64 3ms  
    2 10.10.10.6                                 56  64 1ms  
    sent=3 received=3 packet-loss=0% min-rtt=1ms avg-rtt=7ms max-rtt=17ms 

[admin@R3] > ip route print           
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  10.10.10.0/30      10.10.10.2      ether2                    0
 1 ADC  10.10.10.4/30      10.10.10.5      ether3                    0
 2 ADC  192.168.2.0/24     192.168.2.254   ether1                    0

[admin@R3] > ip route add dst-address=192.168.1.0/24 gateway=10.10.10.1
[admin@R3] > ip route add dst-address=192.168.3.0/24 gateway=10.10.10.1 
[admin@R3] > ip route add dst-address=10.10.10.8/30 gateway=10.10.10.1         

[admin@R3] > ip route print
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  10.10.10.0/30      10.10.10.2      ether2                    0
 1 ADC  10.10.10.4/30      10.10.10.5      ether3                    0
 2 A S  10.10.10.8/30                      10.10.10.1                1
 3 A S  192.168.1.0/24                     10.10.10.1                1
 4 ADC  192.168.2.0/24     192.168.2.254   ether1                    0
 5 A S  192.168.3.0/24                     10.10.10.1                1
[admin@R3]

Comprobando conectividad entre todas las redes:


[admin@R1] > ping 192.168.2.254 src-address=10.10.10.9 
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 192.168.2.254                              56  64 13ms 
    1 192.168.2.254                              56  64 3ms  
    sent=received=packet-loss=0% min-rtt=3ms avg-rtt=8ms max-rtt=13ms 

[admin@R1] > ping 192.168.3.254 src-address=10.10.10.9  
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 192.168.3.254                              56  64 2ms  
    1 192.168.3.254                              56  64 1ms  
    sent=received=packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=2ms 

[admin@R1] > ping 10.10.10.5 src-address=10.10.10.9              
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 10.10.10.5                                 56  64 2ms  
    1 10.10.10.5                                 56  64 1ms  

    sent=received=packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=2ms 


[admin@R2] > ping 192.168.1.254 src-address=10.10.10.6
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 192.168.1.254                              56  64 4ms  
    1 192.168.1.254                              56  64 1ms  
    sent=received=packet-loss=0% min-rtt=1ms avg-rtt=2ms max-rtt=4ms 

[admin@R2] > ping 192.168.2.254 src-address=10.10.10.6 
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 192.168.2.254                              56  64 3ms  
    1 192.168.2.254                              56  64 1ms  
    sent=received=packet-loss=0% min-rtt=1ms avg-rtt=2ms max-rtt=3ms 

[admin@R2] > ping 10.10.10.1 src-address=10.10.10.6              
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 10.10.10.1                                 56  64 3ms  
    1 10.10.10.1                                 56  64 1ms  


    sent=received=packet-loss=0% min-rtt=1ms avg-rtt=2ms max-rtt=3ms 

[admin@R3] > ping 192.168.1.254 src-address=10.10.10.2
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 192.168.1.254                              56  64 1ms  
    1 192.168.1.254                              56  64 1ms  
    sent=2 received=2 packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=1ms 

[admin@R3] > ping 192.168.3.254 src-address=10.10.10.2 
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 192.168.3.254                              56  64 5ms  
    1 192.168.3.254                              56  64 1ms  
    sent=2 received=2 packet-loss=0% min-rtt=1ms avg-rtt=3ms max-rtt=5ms 

[admin@R3] > ping 10.10.10.9 src-address=10.10.10.2              
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 10.10.10.9                                 56  64 2ms  
    1 10.10.10.9                                 56  64 1ms  
    sent=2 received=2 packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=2ms 

[admin@R3] > ping 10.10.10.6 src-address=10.10.10.2 
  SEQ HOST                                     SIZE TTL TIME  STATUS           
    0 10.10.10.6                                 56  64 2ms  
    1 10.10.10.6                                 56  64 1ms  

    sent=2 received=2 packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=2ms 


Averiguar que ruta ha tomado este paquete, que recordemos debe ser a través de R2:

[admin@R1] > tool traceroute 10.10.10.5
 # ADDRESS                          LOSS SENT    LAST     AVG    BEST   WORST
 1 10.10.10.10                        0%   13   1.2ms     1.7     1.2     6.7

 2 10.10.10.5                         0%   13   1.4ms     3.4     1.4    25.8

Mikrotik es genial!.