network/mikrotik-tool/982-v6-apply.rsc
2026-05-09 12:15:42 -05:00

119 lines
6.2 KiB
Text

# =============================================================================
# 982 — IPv6 apply script (ROS 7.21.4, BGP-only / no OSPFv3)
# =============================================================================
#
# 982 is a leaf tower. Single backbone P2P:
# * core (north) — ether7-380 (60 GHz), v6 P2P 2606:1c80:0:14::/64 (982 .2)
# Default upstream toward core via :14::1.
#
# Loopback: 2606:1c80:0:10::110/128
# /44 customer aggregate: 2606:1c80:1300::/44
# Mgmt LAN: 2606:1c80:1300::1/64 (assumes `mgmt` bridge — verify name first).
# PPPoE profile assumed `pppoe`. Customer interface-list assumed `customer`.
# =============================================================================
# -----------------------------------------------------------------------------
# WIPE
# -----------------------------------------------------------------------------
/ppp profile set [find] remote-ipv6-prefix-pool="" dhcpv6-pd-pool=""
/ipv6 dhcp-server remove [find]
/ipv6 dhcp-server option remove [find]
/ipv6 dhcp-client remove [find]
/ipv6 nd prefix remove [find]
/ipv6 nd remove [find default=no]
/ipv6 pool remove [find]
/ipv6 route remove [find dynamic=no]
/ipv6 firewall filter remove [find]
/ipv6 firewall mangle remove [find]
/ipv6 firewall raw remove [find]
/ipv6 address remove [find dynamic=no]
/routing ospf interface-template remove [find area=backbone-v3]
/routing ospf area remove [find name=backbone-v3]
/routing ospf instance remove [find name=default-v3]
/routing bgp connection remove [find name~"ibgp" and (afi~"ipv6" or address-families~"ipv6")]
# -----------------------------------------------------------------------------
# APPLY — BGP instance
# -----------------------------------------------------------------------------
/routing bgp template set [find name=default] disabled=no
/routing bgp instance
add name=bgp-instance-1 as=393837 router-id=10.254.254.110
# -----------------------------------------------------------------------------
# APPLY — addresses
# -----------------------------------------------------------------------------
/ipv6 settings set forward=yes accept-router-advertisements=no
/ipv6 address
add address=2606:1c80:0:10::110/128 interface=lo advertise=no comment="loopback"
add address=2606:1c80:0:14::2/64 interface=ether7-380 advertise=no comment="P2P 982<->core (60GHz)"
add address=2606:1c80:1300::1/64 interface=mgmt advertise=yes comment="982 mgmt LAN"
# -----------------------------------------------------------------------------
# APPLY — static routes
# -----------------------------------------------------------------------------
/ipv6 route
add dst-address=::/0 gateway=2606:1c80:0:14::1 distance=1 comment="default via core"
add dst-address=2606:1c80:0:10::253/128 gateway=2606:1c80:0:14::1 distance=1 comment="core loopback (iBGP bootstrap)"
add dst-address=2606:1c80:0:10::254/128 gateway=2606:1c80:0:14::1 distance=1 comment="edge loopback via core"
add dst-address=2606:1c80:1300::/44 blackhole distance=200 comment="982 /44 aggregate (iBGP origin)"
# -----------------------------------------------------------------------------
# APPLY — neighbour discovery on the mgmt LAN
# -----------------------------------------------------------------------------
/ipv6 nd
add interface=mgmt ra-interval=3m20s-10m managed-address-configuration=no other-configuration=yes advertise-dns=yes
/ipv6 nd prefix
add interface=mgmt prefix=2606:1c80:1300::/64 autonomous=yes on-link=yes
/ipv6 dhcp-server
add interface=mgmt name=982-mgmt-stateless address-pool=static-only
/ipv6 dhcp-server option
add name=v6-dns code=23 value="'2606:4700:4700::1111''2606:4700:4700::1001'"
# -----------------------------------------------------------------------------
# APPLY — customer PD pool + bind to PPPoE profile
# -----------------------------------------------------------------------------
/ipv6 pool
add name=982-cust-pd-1 prefix=2606:1c80:1301::/48 prefix-length=56
/ppp profile
set [find name=982] remote-ipv6-prefix-pool=982-cust-pd-1 dhcpv6-pd-pool=982-cust-pd-1
# -----------------------------------------------------------------------------
# APPLY — firewall
# -----------------------------------------------------------------------------
/ipv6 firewall filter
add chain=input action=accept connection-state=established,related comment="established"
add chain=input action=drop connection-state=invalid comment="invalid"
add chain=input action=accept protocol=icmpv6 comment="icmpv6"
add chain=input action=accept src-address=fe80::/10 comment="link-local"
add chain=input action=accept src-address=2606:1c80::/32 comment="internal"
add chain=input action=drop comment="default deny"
add chain=forward action=accept connection-state=established,related comment="established"
add chain=forward action=drop connection-state=invalid comment="invalid"
add chain=forward action=accept protocol=icmpv6 hop-limit=equal:1 comment="PMTUD"
add chain=forward action=accept protocol=icmpv6 comment="icmpv6"
add chain=forward action=accept src-address=2606:1c80::/32 dst-address=2606:1c80::/32 comment="internal-to-internal"
add chain=forward action=accept src-address=2606:1c80:1300::/44 comment="v6 outbound from 982 customers"
add chain=forward action=drop comment="default deny"
# -----------------------------------------------------------------------------
# APPLY — iBGP to core (v6 RR)
# -----------------------------------------------------------------------------
/routing filter rule
add chain=v6-ibgp-out disabled=no rule="if (dst==2606:1c80:1300::/44 || dst==2606:1c80:0:10::110/128 || (dst-len==64 && dst==2606:1c80:0:14::/64)) { accept; } else { reject; }"
/routing bgp connection
add name=ibgp-rr-core instance=bgp-instance-1 templates=default \
afi=ip,ipv6 local.role=ibgp local.address=2606:1c80:0:10::110 \
remote.address=2606:1c80:0:10::253 remote.as=393837 multihop=yes \
nexthop-choice=force-self output.filter-chain=v6-ibgp-out \
output.redistribute=connected,static \
comment="iBGP to core (v6 RR), v6 transport"