En este post se representará un escenario donde simulamos que redes de internet se están comunicando con una red ISP a través de un Carrier. Los prefijos y ASN utilizados son sólo para emular el laboratorio generado en eve-ng
Se pretende llegar al siguiente diagrama
Archivo adjunto 4281
Configuración de router Facebook
Este router se usa para simular comunicación hacia Facebook. Como el router tiene su propio ASN esta publicando el prefijo 1.1.1.0/24 mediante BGP.
1 Configurar direccionamiento en las interfaces.
Este equipo tiene dos enlaces, uno hacia el router de Alestra y otro hacia un servidor que es a donde deben conectarse los clientes de la red ISP.
Archivo adjunto 4282
/ip address
add address=1.1.1.5/30 comment=to-Server-Facebook interface=ether4 network=1.1.1.4
add address=1.1.1.1/30 comment=to-Alestra interface=ether2 network=1.1.1.0
2 Configurar el enrutamiento BGP
Agregamos el ASN dentro de la instancia default del Mikrotik.
Archivo adjunto 4283
/routing bgp instance set default as=100
Agregamos la red para que BGP se encargue de publicarlas a los demás peer.
Archivo adjunto 4284
/routing bgp network add network=1.1.1.0/24 synchronize=no
Establecemos el peer con nuestro vecino.
Archivo adjunto 4285
/routing bgp peer add name=peer-to-alestra remote-address=1.1.1.2 remote-as=300
3 Configuración Servidor Facebook
Archivo adjunto 4286
/ip 1.1.1.6 255.255.255.252 1.1.1.5
Script de router Facebook
/routing bgp instance set default as=100
/ip address
add address=1.1.1.5/30 comment=to-Server-Facebook interface=ether4 network=1.1.1.4
add address=1.1.1.1/30 comment=to-Alestra interface=ether2 network=1.1.1.0
/ip dhcp-client
add disabled=no interface=ether1
/routing bgp network
add network=1.1.1.0/24 synchronize=no
/routing bgp peer
add name=to-Alestra remote-address=1.1.1.2 remote-as=300
/system identity
set name=facebook
/tool romon
set enabled=yes
Configuración de router Google
De la misma forma en como configuramos el router Facebook, en este configuraremos el peer hacia el router Alestra con la diferencia que aquí estamos anunciando dos prefijos, el 2.2.2.0/24 y el 8.8.8.0/24.
1 Configurar direccionamiento en las interfaces.
Archivo adjunto 4291
/ip address
add address=2.2.2.1/24 comment=to-Alestra interface=ether3 network=2.2.2.0
add address=8.8.8.1/24 comment=to-Server-Google interface=ether4 network=8.8.8.0
2 Configurar el enrutamiento BGP
Archivo adjunto 4293
/routing bgp network
add network=2.2.2.0/24 synchronize=no
add network=8.8.8.0/24 synchronize=no
#
/routing bgp instance set default as=200
#
routing bgp peer add name=to-Alestra remote-address=2.2.2.2 remote-as=300
3 Configuración Servidor Google
Archivo adjunto 4294
/ip 8.8.8.8 255.255.255.0 8.8.8.1
Script de router Facebook
/routing bgp instance set default as=200
/ip address
add address=2.2.2.1/24 comment=to-Alestra interface=ether3 network=2.2.2.0
add address=8.8.8.1/24 comment=to-Server-Google interface=ether4 network=8.8.8.0
/ip dhcp-client
add disabled=no interface=ether1
/routing bgp network
add network=8.8.8.0/24 synchronize=no
/routing bgp peer
add name=to-Alestra remote-address=2.2.2.2 remote-as=300
/system identity
set name=google
/tool romon
set enabled=yes
Configuración de router Alestra
Para este laboratorio hemos colocado Alestra como representación de un Carrier, por lo cual sólo hemos puesto valores ficticios con el fin de la práctica. El prefijo anunciado por este router es el 3.3.3.0/24.
1 Configurar direccionamiento en las interfaces.
Archivo adjunto 4295
/ip address
add address=1.1.1.2/30 comment=to-Facebook interface=ether2 network=1.1.1.0
add address=2.2.2.2/24 comment=to-Google interface=ether3 network=2.2.2.0
add address=3.3.3.1/24 comment=to-ISP-Borde interface=ether4 network=3.3.3.0
2 Configurar el enrutamiento BGP
Configuramos filtro de Accept y Discard
Archivo adjunto 4296
Archivo adjunto 4297
/routing filter
add action=accept chain="BGP - Out" prefix=0.0.0.0/0
add action=discard chain="BGP - Out"
Activamos el filtro en el Peer de ISP-Borde
Archivo adjunto 4299
#
/routing bgp network
add network=3.3.3.0/24 synchronize=no
#
/routing bgp instance set default as=300 redistribute-connected=yes
#
add default-originate=always name=to-ISP-Borde out-filter="BGP - Out" remote-address=3.3.3.2 remote-as=400
#
Script de router Alestra
/routing bgp instance
set default as=300 redistribute-connected=yes
/ip address
add address=1.1.1.2/30 comment=to-Facebook interface=ether2 network=1.1.1.0
add address=2.2.2.2/24 comment=to-Google interface=ether3 network=2.2.2.0
add address=3.3.3.1/24 comment=to-ISP-Borde interface=ether4 network=3.3.3.0
/ip dhcp-client
add disabled=no interface=ether1
/routing bgp network
add network=3.3.3.0/24 synchronize=no
/routing bgp peer
add name=to-Facebook remote-address=1.1.1.1 remote-as=100
add name=to-google remote-address=2.2.2.1 remote-as=200
add default-originate=always name=to-ISP-Borde out-filter="BGP - Out" remote-address=3.3.3.2 remote-as=400
/routing filter
add action=accept chain="BGP - Out" prefix=0.0.0.0/0
add action=discard chain="BGP - Out"
/system identity
set name=alestra
/tool romon
set enabled=yes
Configuración de router ISP-Borde
Este router viene a representar a un ISP que esta haciendo peering con su Carrier (Alestra para esta práctica), por lo lo que este anuncia su prefijo hacia el Carrier mediante BGP y recibe las rutas de internet en su tabla de ruteo.
1 Configurar direccionamiento en las interfaces.
Archivo adjunto 4300
/ip address
add address=3.3.3.2/24 comment=to-Alesstra interface=ether4 network=3.3.3.0
add address=4.4.5.254/24 comment=to-ISP-Core interface=ether2 network=4.4.5.0
2 Configurar el enrutamiento BGP
Archivo adjunto 4301
#
/routing bgp network
add network=4.4.4.0/24 synchronize=no
add network=4.4.5.0/24 synchronize=no
#
/routing bgp instance set default as=400
#
/routing bgp peer add name=peer--Alestra remote-address=3.3.3.1 remote-as=300
#
Si observamos la tabla de ruteo del ISP-Borde podremos comprobar que en ves de recibir las rutas de Facebook y Google, estamos recibiendo una ruta por default mediante BGP.
Archivo adjunto 4306
Script de router ISP-Borde
/routing bgp instance
set default as=400/ip address
add address=3.3.3.2/24 comment=to-Alesstra interface=ether4 network=3.3.3.0
add address=4.4.5.254/24 comment=to-ISP-Core interface=ether2 network=4.4.5.0
/ip dhcp-client
add disabled=no interface=ether1
/routing bgp network
add network=4.4.5.0/24 synchronize=no
/routing bgp peer
add name=to--Alestra remote-address=3.3.3.1 remote-as=300
/system identity
set name=isp-borde
/tool romon
set enabled=yes
Configuración de router ISP-Core
Este router viene a representar un router de agregación donde estamos colocando a los clientes de la red. Se ha puesto que el enlace hacia el borde use las ips públicas de la red para que se pueda natear directamente desde el router core.
1 Configurar direccionamiento en las interfaces.
Archivo adjunto 4302
/ip address
add address=4.4.5.2/24 comment=to-ISP-Borde interface=ether2 network=4.4.5.0add address=192.168.9.254/24 comment=to-Cliente-Final interface=ether4 network=192.168.9.0
2 Colocamos la ruta por defecto hacia el router de borde
Archivo adjunto 4303
/ip route add distance=1 gateway=4.4.5.254
3 Agregamos el NAT para salida a internet de los clientes
Archivo adjunto 4305
/ip firewall nat add action=masquerade chain=srcnat
Script de router ISP-Core
/ip address
add address=4.4.5.2/24 comment=to-ISP-Borde interface=ether2 network=4.4.5.0add address=192.168.9.254/24 comment=to-Cliente-Final interface=ether4 network=192.168.9.0
/ip dhcp-client
add disabled=no interface=ether1
/ip firewall nat
add action=masquerade chain=srcnat
/ip route
add distance=1 gateway=4.4.5.254
/system identity
set name=isp-core
/tool romon
set enabled=yes
Verificación en cliente final
1 Configuración Laptop Cliente Final
Archivo adjunto 4307
/ip 192.168.9.2 255.255.255.0 192.168.9.254
2 Validación del Ping y Tracer
Si entramos al equipo de laptop que tenemos conectado al ISP-Core, podemos hacer un ping a 8.8.8.8 y veremos como obtenemos respuesta.
Archivo adjunto 4309
ping 8.8.8.8
tracer 8.8.8.8