# jan/12/2023 00:13:58 by RouterOS 7.6
# software id = 05JI-0EWS
#
# model = RB5009UG+S+
# serial number =
/interface bridge
add admin-mac=DC:2C:6E:3E:D8:82 auto-mac=no comment=defconf frame-types=\
admit-only-vlan-tagged name=bridge vlan-filtering=yes
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether2 name=\
Internet-pppoe-out1 use-peer-dns=yes user=adslppp@telefonicanetpa
/interface wireguard
add listen-port=12345 mtu=1420 name=wireguard-rw
/interface vlan
add interface=bridge name=Home vlan-id=30
add arp=reply-only interface=bridge name=Invitados vlan-id=50
add interface=bridge name=IoT vlan-id=40
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add name=ISOLATED
add name=Wireguard_Interfaces
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
add name=pool-Home ranges=192.168.30.10-192.168.30.254
add name=pool-IoT ranges=192.168.40.10-192.168.40.254
add name=pool-Invitados ranges=192.168.50.10-192.168.50.254
/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
add address-pool=pool-Home interface=Home name=dhcp-Home
add address-pool=pool-IoT interface=IoT name=dhcp-IoT
add add-arp=yes address-pool=pool-Invitados interface=Invitados name=\
dhcp-Invitados
/interface bridge port
add bridge=bridge comment=defconf frame-types=admit-only-vlan-tagged \
interface=ether1
add bridge=bridge comment=defconf frame-types=\
admit-only-untagged-and-priority-tagged interface=ether3 pvid=40
add bridge=bridge comment=defconf interface=ether4 pvid=30
add bridge=bridge comment=defconf interface=ether5 pvid=30
add bridge=bridge comment=defconf interface=ether6 pvid=30
add bridge=bridge comment=defconf interface=ether7 pvid=30
add bridge=bridge comment=defconf interface=ether8 pvid=30
add bridge=bridge comment=defconf disabled=yes interface=sfp-sfpplus1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface bridge vlan
add bridge=bridge comment=Home tagged=bridge,ether1 vlan-ids=30
add bridge=bridge comment=IoT tagged=\
bridge,ether1,ether4,ether5,ether6,ether7,ether8 vlan-ids=40
add bridge=bridge comment=Invitados tagged=bridge,ether1 vlan-ids=50
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=Internet-pppoe-out1 list=WAN
add comment=defconf interface=ether2 list=WAN
add interface=wireguard-rw list=LAN
add interface=Home list=LAN
add interface=IoT list=ISOLATED
add interface=Invitados list=ISOLATED
add interface=wireguard-rw list=Wireguard_Interfaces
/interface wireguard peers
add allowed-address=192.168.90.2/32 comment=PeerRW_MacbookPro interface=\
wireguard-rw public-key="cegu2gm2IAcYAZhvzcIVIdAxreTF14UpZzKHgrZhoBI="
add allowed-address=192.168.90.3/32 comment=PeerRW_MovilJesus interface=\
wireguard-rw public-key="39TJx/InDYvDbcfWzyRpQimRLyTN1GPtW+dTg93nBDY="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
192.168.88.0
add address=192.168.1.2/24 interface=ether2 network=192.168.1.0
add address=192.168.90.1/24 interface=wireguard-rw network=192.168.90.0
add address=192.168.30.1/24 interface=Home network=192.168.30.0
add address=192.168.40.1/24 interface=IoT network=192.168.40.0
add address=192.168.50.1/24 interface=Invitados network=192.168.50.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-server lease
add address=192.168.40.3 client-id=1:ec:71:db:aa:22:80 comment=\
"C\E1mara Entrada" mac-address=EC:71:DB:AA:22:80 server=dhcp-IoT
add address=192.168.40.14 comment="Shelly Ba\F1os" mac-address=\
84:CC:A8:7F:1E:37 server=dhcp-IoT
add address=192.168.40.13 client-id=1:84:cc:a8:7f:1e:33 comment=\
"Shelly Habitaciones" mac-address=84:CC:A8:7F:1E:33 server=dhcp-IoT
add address=192.168.30.2 client-id="Switch Netgear" comment="Switch Netgear" \
mac-address=94:A6:7E:78:4F:5B server=dhcp-Home
add address=192.168.30.3 client-id=1:70:a7:41:a6:53:29 comment=\
"Unifi AP Salon" mac-address=70:A7:41:A6:53:29 server=dhcp-Home
add address=192.168.30.4 client-id=1:70:a7:41:a6:4c:71 comment=\
"Unifi AP Pasillo" mac-address=70:A7:41:A6:4C:71 server=dhcp-Home
add address=192.168.40.12 client-id=1:84:cc:a8:7f:96:2f comment=\
"Shelly Pasillo/Entrada" mac-address=84:CC:A8:7F:96:2F server=dhcp-IoT
add address=192.168.40.10 comment="Shelly Salon" mac-address=\
84:CC:A8:7F:97:E3 server=dhcp-IoT
add address=192.168.40.11 comment="Shelly Cocina" mac-address=\
84:CC:A8:7F:09:AF server=dhcp-IoT
/ip dhcp-server network
add address=192.168.30.0/24 dns-server=192.168.30.1 gateway=192.168.30.1
add address=192.168.40.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.40.1
add address=192.168.50.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.50.1 \
netmask=32
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 domain=\
lan gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes servers=1.1.1.1,1.0.0.2,8.8.8.8
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall address-list
add address=ec190fe5bfc5.sn.mynetname.net list=public-ip
/ip firewall filter
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
"defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=accept chain=input comment="vpn: allow wireguard-rw" dst-port=\
12345 protocol=udp
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
connection-state=established,related hw-offload=yes
add action=accept chain=forward comment=\
"defconf: accept established,related, untracked" connection-state=\
established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid
add action=drop chain=forward comment=\
"defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
connection-state=new in-interface-list=WAN
add action=reject chain=forward comment=\
"Isolated VLANs: Can only access Internet" in-interface-list=ISOLATED \
out-interface-list=!WAN reject-with=icmp-net-prohibited
/ip firewall mangle
add action=change-mss chain=forward new-mss=clamp-to-pmtu out-interface-list=\
Wireguard_Interfaces passthrough=yes protocol=tcp tcp-flags=syn
/ip firewall nat
add action=masquerade chain=srcnat comment=hairpin-nat dst-address=\
192.168.88.0/24 src-address=192.168.88.0/24
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
/ip route
add comment=ruta-alternativa-HGU-multipuesto distance=2 gateway=192.168.1.1
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMPv6" protocol=\
icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" port=\
33434-33534 protocol=udp
add action=accept chain=input comment=\
"defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
ipsec-esp
add action=accept chain=input comment=\
"defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
"defconf: drop everything else not coming from LAN" in-interface-list=\
!LAN
add action=accept chain=forward comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid
add action=drop chain=forward comment=\
"defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
"defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
ipsec-esp
add action=accept chain=forward comment=\
"defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
"defconf: drop everything else not coming from LAN" in-interface-list=\
!LAN
/system clock
set time-zone-name=Europe/Madrid
/system identity
set name=Mikrotik-Jesus
/system script
add dont-require-permissions=no name=Cloud_Backup owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Crear el backup\r\
\n/system backup cloud upload-file action=create-and-upload password=MySup\
3rB4ckup!\r\
\n\r\
\n#Descargar el backup en el propio equipo\r\
\n/system backup cloud download-file action=download number=0\r\
\n\r\
\n#Borrar el backup, para dejar hueco al siguiente\r\
\n/system backup cloud remove-file 0"
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN