This is a continuation of my first post. Thanks @kraal
tl;dr - I either have a misconfiguration or found a bug on snat/vrf setups; please help.
I’m not sure I’m doing this right, but I’m trying to use VRFs to segment my home network from my “datacenter” lab. I hope the firewall diagram provides enough information to follow along; treat the interfaces as directly connected to end devices for testing. Off of the bond I have a Catalyst 3850 also with VRFs and I’m using loopbackk7724 (10.255.24.2) on the cisco to generate traffic through VLAN 1700 (172.17.0.11). Off of ether3 is also the 3850 using VRF Temp1 (203.0.113.1) and loopback1111 (1.1.1.1) to simulate the internet. I had the default firewall config to start with, but have deleted everything trying to find why the srcnat chain isn’t matching the outbound traffic. If I remove the interface match statement, ping through the firewall works, but it’s doing SNAT on every interface hop (as you’d expect with no filter).
I’ll add more posts with the tests to keep this first section “shorter”
/interface bridge
add frame-types=admit-only-vlan-tagged name=br_main vlan-filtering=yes
add name=lo_tun_vrf-datacenter protocol-mode=none
add name=lo_tun_vrf-edge protocol-mode=none
add name=lo_tun_vrf-home protocol-mode=none
add name=lo_vrf-datacenter protocol-mode=none
add name=lo_vrf-edge protocol-mode=none
add name=lo_vrf-home protocol-mode=none
/interface ethernet
set [ find default-name=ether3 ] comment=vrf-edge_wan1
set [ find default-name=ether4 ] comment=vrf-edge_wan2
set [ find default-name=ether5 ] l2mtu=9198
set [ find default-name=ether6 ] l2mtu=9198
set [ find default-name=ether7 ] l2mtu=9198
set [ find default-name=ether8 ] l2mtu=9198
/interface ipip
add comment=vrf-datacenter local-address=198.51.100.3 name=ipip_vrf-datacenter_vrf-edge remote-address=198.51.100.2
add comment=vrf-edge local-address=198.51.100.2 name=ipip_vrf-edge_vrf-datacenter remote-address=198.51.100.3
add comment=vrf-edge local-address=198.51.100.2 name=ipip_vrf-edge_vrf-home remote-address=198.51.100.1
add comment=vrf-home local-address=198.51.100.1 name=ipip_vrf-home_vrf-edge remote-address=198.51.100.2
/interface vlan
add comment=vrf-home interface=br_main name=vlan255 vlan-id=255
add comment=vrf-datacenter interface=br_main name=vlan1700 vlan-id=1700
add comment=vrf-datacenter interface=br_main name=vlan1710 vlan-id=1710
add comment=vrf-edge interface=br_main name=vlan2540 vlan-id=2540
/interface bonding
add lacp-rate=1sec min-links=1 mode=802.3ad mtu=9198 name=bond_3850-1_po10 slaves=ether5,ether6 transmit-hash-policy=layer-3-and-4 up-delay=250ms
add lacp-rate=1sec min-links=1 mode=802.3ad mtu=9198 name=bond_3850-2_po10 slaves=ether7,ether8 transmit-hash-policy=layer-3-and-4 up-delay=250ms
/interface vrrp
add interface=vlan1710 name=vrrp1710 priority=250 remote-address=172.17.10.3 sync-connection-tracking=yes vrid=2
/interface list
add comment=vrf-edge name=WAN
add comment=vrf-edge name=vrf-edge
add comment=vrf-datacenter name=vrf-datacenter
add comment=vrf-home name=vrf-home
add comment=vrf-edge name=LAN
add exclude=vrf-home,vrf-datacenter,WAN name=vrf-edge_inside
/interface bridge msti
add bridge=br_main comment=vrf-edge identifier=2 priority=0xF000 vlan-mapping=2540-2549
add bridge=br_main comment=vrf-home identifier=1 priority=0xF000 vlan-mapping=128-255
add bridge=br_main comment=vrf-datacenter identifier=3 priority=0xF000 vlan-mapping=1700-1799
/interface bridge port
add bridge=br_main frame-types=admit-only-vlan-tagged interface=bond_3850-1_po10
add bridge=br_main frame-types=admit-only-vlan-tagged interface=bond_3850-2_po10
add bridge=br_main fast-leave=yes frame-types=admit-only-untagged-and-priority-tagged interface=ether2 point-to-point=yes pvid=1710 trusted=yes
/interface bridge vlan
add bridge=br_main tagged=bond_3850-1_po10,bond_3850-2_po10,br_main vlan-ids=2540
add bridge=br_main tagged=bond_3850-1_po10,bond_3850-2_po10,br_main vlan-ids=1700
add bridge=br_main tagged=br_main,bond_3850-1_po10,bond_3850-2_po10 vlan-ids=255
add bridge=br_main tagged=br_main untagged=ether2 vlan-ids=1710
/interface list member
add interface=ether3 list=WAN
add interface=ipip_vrf-datacenter_vrf-edge list=vrf-datacenter
add interface=vlan1700 list=vrf-datacenter
add interface=vlan1710 list=vrf-datacenter
add interface=lo_vrf-datacenter list=vrf-datacenter
add interface=vrrp1710 list=vrf-datacenter
add interface=ether3 list=vrf-edge
add interface=ether4 list=vrf-edge
add interface=ipip_vrf-edge_vrf-datacenter list=vrf-edge
add interface=ipip_vrf-edge_vrf-home list=vrf-edge
add interface=lo_vrf-edge list=vrf-edge
add interface=vlan2540 list=vrf-edge
add interface=ipip_vrf-home_vrf-edge list=vrf-home
add interface=vlan255 list=vrf-home
add interface=lo_vrf-home list=vrf-home
add interface=br_main list=LAN
/ip vrf
add interfaces=lo_vrf-datacenter,ipip_vrf-datacenter_vrf-edge,vlan1700,vlan1710,vrrp1710 name=vrf-datacenter
add interfaces=lo_vrf-home,ipip_vrf-home_vrf-edge,vlan255 name=vrf-home
add interfaces=ether3,ether4,lo_vrf-edge,ipip_vrf-edge_vrf-home,ipip_vrf-edge_vrf-datacenter,vlan2540 name=vrf-edge
/ip address
add address=198.51.100.1 comment=main interface=lo_tun_vrf-home network=198.51.100.1
add address=198.51.100.2 comment=main interface=lo_tun_vrf-edge network=198.51.100.2
add address=198.51.100.3 comment=main interface=lo_tun_vrf-datacenter network=198.51.100.3
add address=10.254.7.1/30 comment=vrf-edge interface=ipip_vrf-edge_vrf-home network=10.254.7.0
add address=10.254.7.5/30 comment=vrf-edge interface=ipip_vrf-edge_vrf-datacenter network=10.254.7.4
add address=10.254.7.2/30 comment=vrf-home interface=ipip_vrf-home_vrf-edge network=10.254.7.0
add address=10.254.7.6/30 comment=vrf-datacenter interface=ipip_vrf-datacenter_vrf-edge network=10.254.7.4
add address=172.17.10.2/24 comment=vrf-datacenter interface=vlan1710 network=172.17.10.0
add address=10.254.0.1/24 comment=vrf-edge interface=vlan2540 network=10.254.0.0
add address=172.17.0.10/24 comment=vrf-datacenter interface=vlan1700 network=172.17.0.0
add address=192.168.255.1/26 comment=vrf-home interface=vlan255 network=192.168.255.0
add address=10.254.9.255 comment=vrf-edge interface=lo_vrf-edge network=10.254.9.255
add address=172.17.10.1/24 interface=vrrp1710 network=172.17.10.0
add address=172.17.99.255 comment=vrf-datacenter interface=lo_vrf-datacenter network=172.17.99.255
/ip dhcp-client
add interface=ether3 use-peer-dns=no use-peer-ntp=no
/ip dns
set servers=4.2.2.1,1.1.1.1
/ip firewall address-list
add address=192.168.128.0/17 list=vrf-home_192.168.128.0-192.168.255.255
add address=172.17.0.0/16 list=vrf-datacenter_172.17.0.0-172.17.255.255
add address=10.254.0.0/21 list=vrf-edge_10.254.0.0-10.254.7.255
add address=198.51.100.0/24 list=main_198.51.100.0-198.51.100.255
add address=0.0.0.0/8 list=not_internet_routable-RFC6890
add address=172.16.0.0/12 list=not_internet_routable-RFC6890
add address=192.168.0.0/16 list=not_internet_routable-RFC6890
add address=10.0.0.0/8 list=not_internet_routable-RFC6890
add address=169.254.0.0/16 list=not_internet_routable-RFC6890
add address=127.0.0.0/8 list=not_internet_routable-RFC6890
add address=224.0.0.0/4 list=not_internet_routable-RFC6890
add address=198.18.0.0/15 list=not_internet_routable-RFC6890
add address=192.0.0.0/24 list=not_internet_routable-RFC6890
add address=192.0.2.0/24 list=not_internet_routable-RFC6890
add address=198.51.100.0/24 disabled=yes list=not_internet_routable-RFC6890
add address=203.0.113.0/24 list=not_internet_routable-RFC6890
add address=100.64.0.0/10 list=not_internet_routable-RFC6890
add address=240.0.0.0/4 list=not_internet_routable-RFC6890
add address=192.88.99.0/24 list=not_internet_routable-RFC6890
add address=172.17.10.10 list=firewall_interfaces
add address=192.168.255.1 list=firewall_interfaces
add address=10.254.9.255 list=firewall_interfaces
add address=10.254.0.1 list=firewall_interfaces
add address=127.0.0.0/8 comment="defconf: RFC6890" list=bad_ipv4
add address=192.0.0.0/24 comment="defconf: RFC6890" list=bad_ipv4
add address=192.0.2.0/24 comment="defconf: RFC6890 documentation" list=bad_ipv4
add address=198.51.100.0/24 comment="defconf: RFC6890 documentation" disabled=yes list=bad_ipv4
add address=203.0.113.0/24 comment="defconf: RFC6890 documentation" list=bad_ipv4
add address=240.0.0.0/4 comment="defconf: RFC6890 reserved" list=bad_ipv4
add address=0.0.0.0/8 comment="defconf: RFC6890" list=not_global_ipv4
add address=10.0.0.0/8 comment="defconf: RFC6890" list=not_global_ipv4
add address=100.64.0.0/10 comment="defconf: RFC6890" list=not_global_ipv4
add address=169.254.0.0/16 comment="defconf: RFC6890" list=not_global_ipv4
add address=172.16.0.0/12 comment="defconf: RFC6890" list=not_global_ipv4
add address=192.0.0.0/29 comment="defconf: RFC6890" list=not_global_ipv4
add address=192.168.0.0/16 comment="defconf: RFC6890" list=not_global_ipv4
add address=198.18.0.0/15 comment="defconf: RFC6890 benchmark" list=not_global_ipv4
add address=255.255.255.255 comment="defconf: RFC6890" list=not_global_ipv4
add address=224.0.0.0/4 comment="defconf: multicast" list=bad_src_ipv4
add address=255.255.255.255 comment="defconf: RFC6890" list=bad_src_ipv4
add address=0.0.0.0/8 comment="defconf: RFC6890" list=bad_dst_ipv4
add address=224.0.0.0/4 comment="defconf: RFC6890" list=bad_dst_ipv4
add address=10.254.7.6 list=vrf-datacenter_172.17.0.0-172.17.255.255
/ip firewall nat
add action=masquerade chain=srcnat log=yes out-interface=ether3
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=10.254.7.5%ipip_vrf-datacenter_vrf-edge@vrf-datacenter pref-src="" routing-table=vrf-datacenter scope=30 \
suppress-hw-offload=no target-scope=10 vrf-interface=ipip_vrf-datacenter_vrf-edge
add disabled=no dst-address=0.0.0.0/0 gateway=10.254.7.1%ipip_vrf-home_vrf-edge@vrf-home routing-table=vrf-home suppress-hw-offload=no
add disabled=yes distance=1 dst-address=0.0.0.0/0 gateway=10.254.7.2%ipip_vrf-edge_vrf-home@vrf-edge pref-src="" routing-table=vrf-edge scope=30 suppress-hw-offload=no target-scope=\
10
add disabled=no dst-address=172.17.0.0/16 gateway=10.254.7.6%ipip_vrf-edge_vrf-datacenter@vrf-edge routing-table=vrf-edge suppress-hw-offload=no
