Diferencia entre revisiones de «Unsoloclic/RouterOS»

De Guifi.net - Wiki Hispano

(Explicación paso a paso)
Línea 277: Línea 277:
 
</pre>
 
</pre>
  
* Añade la herramienta de gráficas (?)
+
* Añade la herramienta de gráficas (accesible desde la interfaz web, p.ej.: http://192.168.88.1/graphs/)
 
* Quita bridge e ips a wLan/Lan (si hubiera)
 
* Quita bridge e ips a wLan/Lan (si hubiera)
 
<pre>
 
<pre>

Revisión de 17:19 4 nov 2014

Explicación paso a paso de la configuración de unsoloclic para RouterOSv3.x (web del nodo)

Fichero

Este es el archivo unsoloclic generado en febrero de 2013:

# Generado por:
# RouterOSv3.x
:log info "Unsolclic for 43337-MLGforjaRd1 going to be executed."
#
# Configuration for RouterOSv3.x
# Dispositivo: 43337-MLGforjaRd1
#
# Métodos para subir/ejecutar este script:
# 1.-Como un script. Sube este texto como un script bien con:
#     a.Winbox (con Linux es necesario wine)
#     b.Terminal (telnet, ssh...)
#    Entonces ejecuta el script con:
#      > /system script run nombre_del_script
# 2.-Fichero importado:
#     Guarda este texto en un fichero, luego súbelo al router
#     utilizando ftp con un nombre como "script_name.rsc".
#     (ten en cuenta que la extensión ".rsc" es necesaria)
#     Ejecuta el fichero importado utilizando el comando:
#      > /import nombre_del_script
# 3.-Telnet copiar&pegar:
#     Abre una sesión de terminal, y copia y pega el texto
#     directamente en la ventana de la terminal.
#
# Notas:
# -El paquete routing-test es necesario si utilizas RouterOSv2.9 , asegúrate de que lo tienes activado en system packages
# -las wlans deberían activarse de forma manual. Asegúrate de que están establecidas en la antena correcta (a/b)
#   de acuerdo con cómo has conectado el cable a la miniPCI. Mantén la
#   potencia al mínimo posible y comprueba el canal.
# -El script no reinicia el router. Quizá tengas que hacerlo de forma manual
# -Debes tener acceso de escritura al router
# -Se recomienda el método de acceso por MAC (winbox, telnet a la MAC...)
#   (el script reconfigura algunas direcciones IP, así que se puede perder la comunicación)
# -No se realizan cambios en las contraseñas de usuario del dispositivo
# -Se creará una cuenta de invitado de Sólo Lectura para permitir el acceso de invitados
#   al router sin riesgo de daño pero con capacidad para ver la configuración.
# -Asegúrate de que todos los paquetes están activados.
# -No ejecutes el script desde telnet si estás conectado mediante una conexión IP en
#   la interfaz: Esta interfaz será desctruida durante la ejecución del script.
#
/ system identity set name=MLGforjaRd1
#
# DNS (client & server cache) zone: 53395
:delay 1
#
# NTP (client & server cache) zone: 53395
:delay 1
#
# Servidor de ancho de banda
/ tool bandwidth-server set enabled=yes authenticate=no allocate-udp-ports-from=2000
#
# SNMP
/snmp set contact="guifi@guifi.net" enabled=yes location="MLGForja"
#
# Guest user
/user
:foreach i in [find group=read] do={/user remove $i;}
add name="guest" group=read address=0.0.0.0/0 comment="" disabled=no
#
# Gráficas
/tool graphing interface add
# Eliminar el puente (bridge) actual wLan/Lan si existe
:foreach i in [/interface bridge find name=wLan/Lan] \
do={:foreach i in [/interface bridge port find bridge=wLan/Lan] \
do={/interface bridge port remove $i; \
:foreach i in [/ip address find interface=wLan/Lan] \
do={/ip address remove $i;};};
/interface bridge remove $i;}
# Crear puente (bridge) principal entre wlan1 y ether1
/ interface bridge
add name="wLan/Lan"
/ interface bridge port
add interface=ether1 bridge=wLan/Lan
add interface=wlan1 bridge=wLan/Lan
:delay 1
#
# Radio#: 0 MLGMLGfrjRd1AP0
/interface wireless set wlan1 name="wlan1" \
radio-name="MLGMLGfrjRd1AP0" mode=ap-bridge ssid="guifi.net-MLGMLGfrjRd1AP0" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=14 \
dfs-mode=radar-detect \
antenna-mode=ant-a wds-mode=static wds-default-bridge=none wds-default-cost=100 \
wds-cost-range=50-150 wds-ignore-ssid=yes hide-ssid=no
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.64.2.161/29"] do={remove $i}
/ ip address add address=10.64.2.161/29 network=10.64.2.160 broadcast=10.64.2.167 interface=wLan/Lan disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.64.2.160/29] do={/routing bgp network remove $i;}
add network=10.64.2.160/29 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wLan/Lan] do={/routing ospf interface remove $i;}
add interface=wLan/Lan
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.2.160/29] do={/routing ospf network remove $i;}
add network=10.64.2.160/29 area=backbone disabled=no
:delay 1
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wLan/Lan] do={/ip pool remove $i;}
/ip pool add name=dhcp-wLan/Lan ranges=10.64.2.166-10.64.2.166
:foreach i in [/ip dhcp-server find name=dhcp-wLan/Lan] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wLan/Lan interface=wLan/Lan address-pool=dhcp-wLan/Lan disabled=yes
:foreach i in [/ip dhcp-server network find address="10.64.2.160/29"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.64.2.160/29 gateway=10.64.2.161 domain=guifi.net comment=dhcp-wLan/Lan
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.64.2.162 mac-address=99:99:99:99:99:9A client-id=ALHFuenteDelPerroRd1 server=dhcp-wLan/Lan
#
:delay 1
# Type: wLan
/ip address
:foreach i in [find address="10.64.2.193/27"] do={remove $i}
/ ip address add address=10.64.2.193/27 network=10.64.2.192 broadcast=10.64.2.223 interface=wlan1 disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.64.2.192/27] do={/routing bgp network remove $i;}
add network=10.64.2.192/27 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wlan1] do={/routing ospf interface remove $i;}
add interface=wlan1
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.2.192/27] do={/routing ospf network remove $i;}
add network=10.64.2.192/27 area=backbone disabled=no
:delay 1
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wlan1] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan1 ranges=10.64.2.199-10.64.2.222
:foreach i in [/ip dhcp-server find name=dhcp-wlan1] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wlan1 interface=wlan1 address-pool=dhcp-wlan1 disabled=no
:foreach i in [/ip dhcp-server network find address="10.64.2.192/27"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.64.2.192/27 gateway=10.64.2.193 domain=guifi.net comment=dhcp-wlan1
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
#
:delay 1
# Type: wds/p2p
# Eliminar todas las interfaces wds existentes
:foreach i in [/interface wireless wds find master-interface=wlan1] \
do={:foreach n in [/interface wireless wds get $i name] \
do={:foreach inum in [/ip address find interface=$n] \
do={/ip address remove $inum;};}; \
/interface wireless wds remove $i;}
#
:delay 1
#
# Routed device
#
# Otra conexiones cableadas
#
# NAT de direcciones internas
:foreach i in [/ip firewall nat find src-address="172.16.0.0/12"] do={/ip firewall nat remove $i;}
:foreach i in [/ip firewall nat find src-address="192.168.0.0/16"] do={/ip firewall nat remove $i;}
/ip firewall nat
add chain=srcnat src-address="192.168.0.0/16" dst-address=!192.168.0.0/16 action=src-nat to-addresses=10.64.2.161 comment="" disabled=no
#
# Enrutamiento BMP
# Filtros BGP & OSPF
:foreach i in [/routing filter find chain=ospf-in] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ospf-out] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ebgp-in] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ebgp-out] do={/routing filter remove $i;}
/ routing filter
add chain=ebgp-in comment="0. Set ebgp-in preferred source." set-pref-src="10.64.2.161" disabled=no
add action=discard chain=ebgp-in comment="1. Discard insert non 10.x routes from BGP peer" disabled=no invert-match=no prefix=!10.0.0.0/8 prefix-length=8-32
add action=discard chain=ebgp-out comment="2. Discard send non 10.x routes to BGP peer" disabled=no invert-match=no prefix=!10.0.0.0/8 prefix-length=8-32
add action=accept chain=ospf-in comment="3. Accept insert 10.x routes from OSPF neighbor" disabled=no invert-match=no prefix=10.0.0.0/8 prefix-length=8-32 set-pref-src="10.64.2.161"
add action=accept chain=ospf-in comment="4. Accept insert 172.x routes from OSPF neighbor" disabled=no invert-match=no prefix=172.16.0.0/12 prefix-length=8-32
add action=discard chain=ospf-in comment="5. Discard insert non 10.x and 172.x from OSPF neighbor" disabled=no invert-match=no
add action=accept chain=ospf-out comment="6. Allow send 10.x routes to OSPF neighbor" disabled=no invert-match=no prefix=10.0.0.0/8 prefix-length=8-32
add action=accept chain=ospf-out comment="7. Allow send 172.x routes to OSPF neighbor" disabled=no invert-match=no prefix=172.16.0.0/12 prefix-length=8-32
add action=discard chain=ospf-out comment="8. Discard send non 10.x and 172.x to OSPF neighbor" disabled=no invert-match=no
#
# instancia BGP
/ routing bgp instance
set default name="default" as=43337 router-id=10.64.2.161 \
redistribute-connected=yes redistribute-static=yes redistribute-rip=yes \
redistribute-ospf=yes redistribute-other-bgp=yes out-filter=ebgp-out \
client-to-client-reflection=yes comment="" disabled=no
#
# Enrutamiento OSPF
/routing ospf set router-id=10.64.2.161 distribute-default=never redistribute-connected=no \
redistribute-static=no redistribute-rip=no redistribute-bgp=as-type-1
#
:log info "Unsolclic for 43337-MLGforjaRd1 executed."
/

Explicación paso a paso

  • Empieza con un comentario
  • Guarda en el log que se empieza a ejecutar el script
# Generado por:
# RouterOSv3.x
:log info "Unsolclic for 43337-MLGforjaRd1 going to be executed."
#
# Configuration for RouterOSv3.x
# Dispositivo: 43337-MLGforjaRd1
#
# Métodos para subir/ejecutar este script:
# 1.-Como un script. Sube este texto como un script bien con:
#     a.Winbox (con Linux es necesario wine)
#     b.Terminal (telnet, ssh...)
#    Entonces ejecuta el script con:
#      > /system script run nombre_del_script
# 2.-Fichero importado:
#     Guarda este texto en un fichero, luego súbelo al router
#     utilizando ftp con un nombre como "script_name.rsc".
#     (ten en cuenta que la extensión ".rsc" es necesaria)
#     Ejecuta el fichero importado utilizando el comando:
#      > /import nombre_del_script
# 3.-Telnet copiar&pegar:
#     Abre una sesión de terminal, y copia y pega el texto
#     directamente en la ventana de la terminal.
#
# Notas:
# -El paquete routing-test es necesario si utilizas RouterOSv2.9 , asegúrate de que lo tienes activado en system packages
# -las wlans deberían activarse de forma manual. Asegúrate de que están establecidas en la antena correcta (a/b)
#   de acuerdo con cómo has conectado el cable a la miniPCI. Mantén la
#   potencia al mínimo posible y comprueba el canal.
# -El script no reinicia el router. Quizá tengas que hacerlo de forma manual
# -Debes tener acceso de escritura al router
# -Se recomienda el método de acceso por MAC (winbox, telnet a la MAC...)
#   (el script reconfigura algunas direcciones IP, así que se puede perder la comunicación)
# -No se realizan cambios en las contraseñas de usuario del dispositivo
# -Se creará una cuenta de invitado de Sólo Lectura para permitir el acceso de invitados
#   al router sin riesgo de daño pero con capacidad para ver la configuración.
# -Asegúrate de que todos los paquetes están activados.
# -No ejecutes el script desde telnet si estás conectado mediante una conexión IP en
#   la interfaz: Esta interfaz será desctruida durante la ejecución del script.
#
  • Define el nombre del sistema (nombre del nodo)
  • Configura DNS (opcional) y espera un segundo
  • Configura NTP (opcional) y espera un segundo
/ system identity set name=MLGforjaRd1
#
# DNS (client & server cache) zone: 53395
:delay 1
#
# NTP (client & server cache) zone: 53395
:delay 1
  • Activa el servidor para hacer pruebas de ancho de banda (puerto 2000 UDP y en adelante)
  • Activar SNMP
#
# Servidor de ancho de banda
/ tool bandwidth-server set enabled=yes authenticate=no allocate-udp-ports-from=2000
#
# SNMP
/snmp set contact="guifi@guifi.net" enabled=yes location="MLGForja"
  • Añade usuario invitado (guest), grupo lectura
#
# Guest user
/user
:foreach i in [find group=read] do={/user remove $i;}
add name="guest" group=read address=0.0.0.0/0 comment="" disabled=no
  • Añade la herramienta de gráficas (accesible desde la interfaz web, p.ej.: http://192.168.88.1/graphs/)
  • Quita bridge e ips a wLan/Lan (si hubiera)
#
# Gráficas
/tool graphing interface add
# Eliminar el puente (bridge) actual wLan/Lan si existe
:foreach i in [/interface bridge find name=wLan/Lan] \
do={:foreach i in [/interface bridge port find bridge=wLan/Lan] \
do={/interface bridge port remove $i; \
:foreach i in [/ip address find interface=wLan/Lan] \
do={/ip address remove $i;};};
/interface bridge remove $i;}
  • Crea puente entre wlan1 y ether1 (con nombre: "wLan/Lan")
  • Espera 1 segundo
# Crear puente (bridge) principal entre wlan1 y ether1
/ interface bridge
add name="wLan/Lan"
/ interface bridge port
add interface=ether1 bridge=wLan/Lan
add interface=wlan1 bridge=wLan/Lan
:delay 1
  • Configura la radio:
    • Nomrbe: MLGMLGfrjRd1AP0
    • Modo: ap-bridge
    • SSID: guifi.net-MLGMLGfrjRd1AP0
    • Frecuencia: 5ghz
    • Modo de frecuencia: regulatory-domain
    • País: spain
    • Ganancia antena: 14
    • Modo DFS: radar-detect
    • Modo antena: ant-a
    • Modo WDS: static
    • Sin bridge WDS
    • Otros valores WDS
    • Ocultar SSID: no
  • Configura la IP
    • Busca el rango (10.64.2.161/29) por si estuviera ya asignado y lo borra
    • Configura la interfaz wLan/Lan creada anteriormente. IP: 10.64.2.161/29, Red: 10.64.2.160, Broadcast: 10.64.2.167
  • Configura BGP
    • Busca la configuración bgp para 10.64.2.160/29 por si estuviera ya en uso y la borra
    • Añade la red 10.64.2.160/29
  • Configura la interfaz OSPF
    • Borra cualquier configuración de OSPF en la interfaz wLan/Lan
    • Añade la interfaz wLan/Lan
  • Configura la red OSPF
    • Busca la configuración ospf para 10.64.2.160/29 por si estuviera ya en uso y la borra
    • Añade la red 10.64.2.160/29 (area=backbone)
#
# Radio#: 0 MLGMLGfrjRd1AP0
/interface wireless set wlan1 name="wlan1" \
radio-name="MLGMLGfrjRd1AP0" mode=ap-bridge ssid="guifi.net-MLGMLGfrjRd1AP0" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=14 \
dfs-mode=radar-detect \
antenna-mode=ant-a wds-mode=static wds-default-bridge=none wds-default-cost=100 \
wds-cost-range=50-150 wds-ignore-ssid=yes hide-ssid=no
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.64.2.161/29"] do={remove $i}
/ ip address add address=10.64.2.161/29 network=10.64.2.160 broadcast=10.64.2.167 interface=wLan/Lan disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.64.2.160/29] do={/routing bgp network remove $i;}
add network=10.64.2.160/29 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wLan/Lan] do={/routing ospf interface remove $i;}
add interface=wLan/Lan
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.2.160/29] do={/routing ospf network remove $i;}
add network=10.64.2.160/29 area=backbone disabled=no
:delay 1
  • Configura DHCP en wLan/Lan
    • Resetea el pool de ips de dhcp-wLan/Lan
    • Añade al pool dhcp-wLan/Lan el rango 10.64.2.166-10.64.2.166
    • Elimina los servidores dhcp de dhcp-wLan/Lan
    • Añade el servidor dhcp "dhcp-wLan/Lan" a la interfaz wLan/Lan con el pool de ips "dhcp-wLan/Lan" (desactivado por defecto)
    • Borra la ip 10.64.2.160/29 del servidor dhcp
    • Añade el servidor dhcp la ip 10.64.2.160/29 con gateway 10.64.2.161 (dominio guifi.net)
    • dhcp server lease
    • Borra los comentarios
    • Reserva una ip en el servidor dhcp "dhcp-wLan/Lan" para el nodo cliente del enlace (IP: 10.64.2.162, MAC: 99:99:99:99:99:9A, ID: ALHFuenteDelPerroRd1)
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wLan/Lan] do={/ip pool remove $i;}
/ip pool add name=dhcp-wLan/Lan ranges=10.64.2.166-10.64.2.166
:foreach i in [/ip dhcp-server find name=dhcp-wLan/Lan] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wLan/Lan interface=wLan/Lan address-pool=dhcp-wLan/Lan disabled=yes
:foreach i in [/ip dhcp-server network find address="10.64.2.160/29"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.64.2.160/29 gateway=10.64.2.161 domain=guifi.net comment=dhcp-wLan/Lan
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.64.2.162 mac-address=99:99:99:99:99:9A client-id=ALHFuenteDelPerroRd1 server=dhcp-wLan/Lan
#
:delay 1
  • Busca la 10.64.2.193/27 y la borra
  • Configura la interfaz "wlan1" con ip 10.64.2.193/27, red 10.64.2.192 y broadcast 10.64.2.223
  • Configura BGP
    • Borra la ip 10.64.2.192/27
    • Añade la red 10.64.2.192/27
  • Configura la interfaz OSPF
    • Borra OSPF de la interfaz wlan1
    • Añade la interfaz wlan1
  • Configura la red OSPF
    • Borra la red 10.64.2.192/27 de OSPF
    • Añade la red 10.64.2.192/27 (area=backbone)
# Type: wLan
/ip address
:foreach i in [find address="10.64.2.193/27"] do={remove $i}
/ ip address add address=10.64.2.193/27 network=10.64.2.192 broadcast=10.64.2.223 interface=wlan1 disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.64.2.192/27] do={/routing bgp network remove $i;}
add network=10.64.2.192/27 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wlan1] do={/routing ospf interface remove $i;}
add interface=wlan1
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.2.192/27] do={/routing ospf network remove $i;}
add network=10.64.2.192/27 area=backbone disabled=no
:delay 1
  • Configura DHCP en wlan1
    • Resetea el pool de ips de dhcp-wlan1
    • Añade al pool dhcp-wlan1 el rango 10.64.2.199-10.64.2.222
    • Elimina los servidores dhcp de dhcp-wlan1
    • Añade el servidor dhcp "dhcp-wlan1" a la interfaz wlan1 con el pool de ips "dhcp-wlan1" (activado por defecto)
    • Borra la ip 10.64.2.192/27 del servidor dhcp
    • Añade el servidor dhcp la ip 10.64.2.192/27 con gateway 10.64.2.193 (dominio guifi.net)
    • dhcp server lease
    • Borra los comentarios
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wlan1] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan1 ranges=10.64.2.199-10.64.2.222
:foreach i in [/ip dhcp-server find name=dhcp-wlan1] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wlan1 interface=wlan1 address-pool=dhcp-wlan1 disabled=no
:foreach i in [/ip dhcp-server network find address="10.64.2.192/27"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.64.2.192/27 gateway=10.64.2.193 domain=guifi.net comment=dhcp-wlan1
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
#
:delay 1
  • Eliminar todas las interfaces wds existentes (master-interface=wlan1)
# Type: wds/p2p
# Eliminar todas las interfaces wds existentes
:foreach i in [/interface wireless wds find master-interface=wlan1] \
do={:foreach n in [/interface wireless wds get $i name] \
do={:foreach inum in [/ip address find interface=$n] \
do={/ip address remove $inum;};}; \
/interface wireless wds remove $i;}
#
:delay 1
  • Configura NAT
    • Busca y borra los rangos 172.16.0.0/12 y 192.168.0.0/16 del NAT
    • Configura NAT (chain srcnat), dirección fuente: 192.168.0.0/16, dirección destino: !192.168.0.0/16, acción: src-nat, a la dirección: 10.64.2.161
#
# Routed device
#
# Otra conexiones cableadas
#
# NAT de direcciones internas
:foreach i in [/ip firewall nat find src-address="172.16.0.0/12"] do={/ip firewall nat remove $i;}
:foreach i in [/ip firewall nat find src-address="192.168.0.0/16"] do={/ip firewall nat remove $i;}
/ip firewall nat
add chain=srcnat src-address="192.168.0.0/16" dst-address=!192.168.0.0/16 action=src-nat to-addresses=10.64.2.161 comment="" disabled=no
  • Borra todos los filtros en ospf-in, ospf-out
  • Borra todos los filtros en ebgp-in, ebgp-out
  • Configura ebgp
    • Define ebgp-in como la fuente preferida
    • Solo acepta rutas 10.x de peers BGP
    • Solo envía rutas 10.x a peers BGP
  • Configura ospf
    • Solo acepta rutas 10.x y 172.x de vecinos OSPF
    • Solo envía rutas 10.x y 172.x a vecinos OSPF
#
# Enrutamiento BMP
# Filtros BGP & OSPF
:foreach i in [/routing filter find chain=ospf-in] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ospf-out] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ebgp-in] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ebgp-out] do={/routing filter remove $i;}
/ routing filter
add chain=ebgp-in comment="0. Set ebgp-in preferred source." set-pref-src="10.64.2.161" disabled=no
add action=discard chain=ebgp-in comment="1. Discard insert non 10.x routes from BGP peer" disabled=no invert-match=no prefix=!10.0.0.0/8 prefix-length=8-32
add action=discard chain=ebgp-out comment="2. Discard send non 10.x routes to BGP peer" disabled=no invert-match=no prefix=!10.0.0.0/8 prefix-length=8-32
add action=accept chain=ospf-in comment="3. Accept insert 10.x routes from OSPF neighbor" disabled=no invert-match=no prefix=10.0.0.0/8 prefix-length=8-32 set-pref-src="10.64.2.161"
add action=accept chain=ospf-in comment="4. Accept insert 172.x routes from OSPF neighbor" disabled=no invert-match=no prefix=172.16.0.0/12 prefix-length=8-32
add action=discard chain=ospf-in comment="5. Discard insert non 10.x and 172.x from OSPF neighbor" disabled=no invert-match=no
add action=accept chain=ospf-out comment="6. Allow send 10.x routes to OSPF neighbor" disabled=no invert-match=no prefix=10.0.0.0/8 prefix-length=8-32
add action=accept chain=ospf-out comment="7. Allow send 172.x routes to OSPF neighbor" disabled=no invert-match=no prefix=172.16.0.0/12 prefix-length=8-32
add action=discard chain=ospf-out comment="8. Discard send non 10.x and 172.x to OSPF neighbor" disabled=no invert-match=no
  • Configura BGP
    • Nombre por defecto: default
    • AS: 43337
    • Router ID: 10.64.2.161
    • Le aplica los filtros ebgp-in y ebgp-out
    • Otros detalles de BGP
  • Configura OSPF
    • Router ID: 10.64.2.161
    • redistribute-bgp=as-type-1
  • Guarda en el log que el script ha finalizado
#
# instancia BGP
/ routing bgp instance
set default name="default" as=43337 router-id=10.64.2.161 \
redistribute-connected=yes redistribute-static=yes redistribute-rip=yes \
redistribute-ospf=yes redistribute-other-bgp=yes out-filter=ebgp-out \
client-to-client-reflection=yes comment="" disabled=no
#
# Enrutamiento OSPF
/routing ospf set router-id=10.64.2.161 distribute-default=never redistribute-connected=no \
redistribute-static=no redistribute-rip=no redistribute-bgp=as-type-1
#
:log info "Unsolclic for 43337-MLGforjaRd1 executed."
/
Herramientas personales