Hello everyone first time posting so I apologize for any etiquette mistakes.
I’m building my first home lab and this is my first journey with Mikrotik. I have a RB5009 and I am using it to segment a bit of my home network. I have VRFs built and I am using an OPNsense firewall to be a security point between the VRFs and the main routing table.
Everything is working for the most part. I am using BGP to share routes and inter network traffic functions just fine. My problem is that once I move the networks/vlans from the main routing table to the vrf instance I no longer can get the traffic to hit any SRCNAT rules. Since it wont NAT the ISP router cannot get the traffic back.
Ill include the whole config but if that’s not generally liked let me know for future posts.
quick note that I do have fast path disabled as some posts mentioned that would not work with vrfs
2026-01-05 12:11:43 by RouterOS 7.18.2
# model = RB5009UG+S+
/interface bridge
add admin-mac=04:F4:1C:9B:C4:92 auto-mac=no comment=defconf name=bridge
add name=trunk01 vlan-filtering=yes
/interface vlan
add interface=ether3 name=fw_transit_dmz vlan-id=1099
add interface=ether3 name=fw_transit_home vlan-id=1010
add interface=ether3 name=fw_transit_office vlan-id=1333
add interface=ether3 name=fw_transit_server vlan-id=1050
add interface=ether3 name=fw_transit_work vlan-id=1020
add comment="Home Network" interface=trunk01 name=home vlan-id=10
add comment="DMZ Network" interface=trunk01 name=dmz vlan-id=99
add comment="Office Network" interface=trunk01 name=office vlan-id=333
add comment="Server Network" interface=trunk01 name=server vlan-id=50
add comment="Wireless Network" interface=trunk01 name=wireless vlan-id=100
add comment="Work Network" interface=trunk01 name=work vlan-id=20
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
add comment="Work Network DHCP" name=work_dhcp ranges=10.1.20.20-10.1.20.254
add comment="Home Network" name=home_dhcp ranges=10.1.10.20-10.1.10.254
add comment="Server Network" name=server_dhcp ranges=10.1.50.200-10.1.50.254
add comment="Wireless Network" name=wireless_dhcp ranges=192.168.4.10-192.168.7.254
add comment="Office Network" name=office_dhcp ranges=10.33.3.20-10.33.3.250
/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
add address-pool=work_dhcp interface=work name="Work DHCP Network"
add address-pool=office_dhcp interface=office name="Office DHCP Network"
add address-pool=home_dhcp interface=home name="Home DHCP Network"
add address-pool=server_dhcp interface=server name="Server DHCP Network"
add address-pool=wireless_dhcp interface=wireless name="Wireless DHCP Network"
/ip vrf
add interfaces=fw_transit_office name=office_vrf
add interfaces=dmz,fw_transit_dmz name=dmz_vrf
add interfaces=fw_transit_server name=server_vrf
add interfaces=fw_transit_work name=work_vrf
add interfaces=fw_transit_home name=home_vrf
add interfaces=none name=inet_vrf
/routing bgp template
add as=65000 disabled=no name=eBGP_vrf_template nexthop-choice=force-self output.redistribute=connected,static,bgp
/routing table
add fib name=inet_vrf
add fib name=home_vrf
add fib name=work_vrf
add fib name=dmz_vrf
add fib name=office_vrf
add fib name=server_vrf
/routing bgp template
set default disabled=yes output.redistribute=connected,static,bgp routing-table=main
add as=65099 disabled=no name=eBGP_dmz_template nexthop-choice=force-self output.keep-sent-attributes=yes .redistribute=connected,static,bgp router-id=10.255.99.1 routing-table=\
dmz_vrf vrf=dmz_vrf
add as=65010 disabled=no name=eBGP_home_template nexthop-choice=force-self output.redistribute=connected,static,bgp router-id=10.255.10.1 routing-table=home_vrf vrf=home_vrf
add as=65020 disabled=no name=eBGP_work_template nexthop-choice=force-self output.redistribute=connected,static,bgp router-id=10.255.20.1 routing-table=work_vrf vrf=work_vrf
add as=65050 disabled=no name=eBGP_server_template nexthop-choice=force-self output.redistribute=connected,static,bgp router-id=10.255.50.1 routing-table=server_vrf vrf=server_vrf
add as=65333 disabled=no name=eBGP_office_template nexthop-choice=force-self output.redistribute=connected,static,bgp router-id=10.255.3.1 routing-table=office_vrf vrf=office_vrf
add as=65000 disabled=no name=eBGP_main_template nexthop-choice=force-self output.redistribute=connected,static,bgp router-id=10.255.1.1 routing-table=main vrf=main
/disk settings
set auto-media-interface=bridge auto-media-sharing=yes auto-smb-sharing=yes
/interface bridge port
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether7
add bridge=bridge comment=defconf interface=sfp-sfpplus1
add bridge=trunk01 frame-types=admit-only-vlan-tagged interface=ether8
/ip neighbor discovery-settings
set discover-interface-list=LAN
/ip settings
set allow-fast-path=no
/interface bridge vlan
add bridge=trunk01 tagged=trunk01,ether8 vlan-ids=10
add bridge=trunk01 tagged=trunk01,ether8 vlan-ids=20
add bridge=trunk01 tagged=trunk01,ether8 vlan-ids=50
add bridge=trunk01 tagged=trunk01,ether8 vlan-ids=99
add bridge=trunk01 tagged=trunk01,ether8 vlan-ids=100
add bridge=trunk01 tagged=trunk01,ether8 vlan-ids=333
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
add comment=Test interface=*F list=LAN
add comment="Home VLAN" interface=home list=LAN
add comment="Work VLAN" interface=work list=LAN
add comment="Office VLAN" interface=office list=LAN
add comment="Server VLAN" interface=server list=LAN
add comment="DMZ VLAN" interface=dmz list=LAN
add comment="Wireless VLAN" interface=wireless list=LAN
add interface=ether2 list=LAN
add comment="Home VRF transit" interface=fw_transit_home list=LAN
add comment="Work VRF transit" interface=fw_transit_work list=LAN
add comment="Server VRF transit" interface=fw_transit_server list=LAN
add comment="DMZ VRF transit" interface=fw_transit_dmz list=LAN
add comment="Office VRF transit" interface=fw_transit_office list=LAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=192.168.88.0
add address=10.1.10.1/24 comment="Home Network SVI" interface=home network=10.1.10.0
add address=10.1.20.1/24 comment="Work Network SVI" interface=work network=10.1.20.0
add address=10.1.50.1/24 comment="Server Network SVI" interface=server network=10.1.50.0
add address=10.1.99.1/24 comment="DMZ Network SVI" interface=dmz network=10.1.99.0
add address=192.168.4.1/22 comment="Wireless Network SVI" interface=wireless network=192.168.4.0
add address=10.33.3.1/24 comment="Office Network SVI" interface=office network=10.33.3.0
add address=10.255.1.1/30 interface=ether2 network=10.255.1.0
add address=10.255.10.1/30 interface=fw_transit_home network=10.255.10.0
add address=10.255.20.1/30 interface=fw_transit_work network=10.255.20.0
add address=10.255.50.1/30 interface=fw_transit_server network=10.255.50.0
add address=10.255.3.1/30 interface=fw_transit_office network=10.255.3.0
add address=10.255.99.1/30 comment="DMZ Network Transit" interface=fw_transit_dmz network=10.255.99.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=10.1.10.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=10.1.10.1
add address=10.1.20.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=10.1.20.1 netmask=24
add address=10.1.50.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=10.1.50.1
add address=10.33.3.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=10.33.3.1
add address=192.168.4.0/22 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.4.1
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan type=A
/ip firewall filter
add action=log chain=forward log-prefix=DMZ-FWD src-address=10.1.99.0/24
add action=accept chain=input comment="Allow BGP" dst-port=179 protocol=tcp
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=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 disabled=yes 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=log chain=output log-prefix=AFTER-NAT out-interface=ether1
/ip firewall mangle
add action=log chain=prerouting log-prefix=DMZ-PRE src-address=10.1.99.0/24
add action=log chain=postrouting log-prefix=POST-NAT out-interface=ether1
/ip firewall nat
add action=masquerade chain=srcnat ipsec-policy=out,none out-interface-list=WAN src-address=10.1.99.0/24
add action=masquerade chain=srcnat comment="Internal NAT via WAN" out-interface-list=WAN src-address=10.0.0.0/8
add action=log chain=srcnat log-prefix=SRCNAT-ALL
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
add action=log chain=srcnat log-prefix=ALL-SRCNAT
/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" dst-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=fasttrack-connection chain=forward comment="defconf: fasttrack6" connection-state=established,related
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
/routing bgp connection
add as=65099 connect=yes disabled=no listen=yes local.address=10.255.99.1 .role=ebgp name=bgp_dmz_vrf nexthop-choice=force-self output.keep-sent-attributes=yes .network=\
10.1.99.0/24 .redistribute=connected,static,bgp remote.address=10.255.99.2/32 .as=65001 routing-table=dmz_vrf templates=eBGP_vrf_template vrf=dmz_vrf
add as=65020 connect=yes disabled=yes listen=yes local.address=10.255.20.1 .role=ebgp name=bgp_work_vrf nexthop-choice=force-self output.redistribute=connected,static,bgp \
remote.address=10.255.20.2/32 .as=65001 router-id=10.255.20.1 routing-table=work_vrf templates=eBGP_work_template vrf=work_vrf
add as=65333 connect=yes disabled=yes listen=yes local.address=10.255.3.1 .role=ebgp name=bgp_office_vrf nexthop-choice=force-self output.redistribute=connected,static,bgp \
remote.address=10.255.3.2/32 .as=65001 router-id=10.255.3.1 routing-table=office_vrf templates=eBGP_office_template vrf=office_vrf
add as=65050 connect=yes disabled=yes listen=yes local.address=10.255.50.1 .role=ebgp name=bgp_server_vrf nexthop-choice=force-self output.redistribute=connected,static,bgp \
remote.address=10.255.50.2/32 .as=65001 router-id=10.255.50.1 routing-table=server_vrf templates=eBGP_server_template vrf=server_vrf
add as=65010 connect=yes disabled=yes listen=yes local.address=10.255.10.1 .role=ebgp name=bgp_home_vrf nexthop-choice=force-self output.redistribute=connected,static,bgp \
remote.address=10.255.10.2/32 .as=65001 router-id=10.255.10.1 routing-table=home_vrf templates=eBGP_home_template vrf=home_vrf
add as=65000 connect=yes disabled=no listen=yes local.address=10.255.1.1 .role=ebgp name=bgp_main_vrf nexthop-choice=force-self output.default-originate=if-installed \
.redistribute=connected,static,bgp remote.address=10.255.1.2/32 .as=65001 router-id=10.255.1.1 routing-table=main templates=eBGP_main_template vrf=main
/routing filter rule
add chain=test
/system clock
set time-zone-name=America/Chicago
/system identity
set name=BTNetCore
/system logging
add topics=bgp,!packet,!raw
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
/tool sniffer
set filter-interface=ether1 filter-ip-protocol=icmp