I'm trying to modify ICMP time-exceeded responses (type 11) for traceroute packets, but only when they're responses to traceroute probes from a specific VM. My setup is:
- Host OS running Ubuntu with nftables
- Guest VM running Ubuntu, connected via bridge interface "spod"
- Bridge interface IPs: Host 137.205.192.1, VM 137.205.192.5
- Host's internet interface: wlo1 (192.168.110.187), gateway 192.168.110.1
- VM traffic is masqueraded via the host
Current working rules (but these modify ALL type 11 packets, not just those for VM):
nft add table ip icmp_mod
nft add chain ip icmp_mod prerouting { type filter hook prerouting priority -300; }
nft add rule ip icmp_mod prerouting ip protocol icmp icmp type time-exceeded ip saddr $HOP1 counter snat ip to 146.97.180.159
nft add rule ip icmp_mod prerouting ip protocol icmp icmp type time-exceeded ip saddr $HOP2 counter snat ip to 146.97.35.246
nft add rule ip icmp_mod prerouting ip protocol icmp icmp type time-exceeded ip saddr $HOP3 counter snat ip to 146.97.35.18
nft add rule ip icmp_mod prerouting ip protocol icmp icmp type time-exceeded ip saddr $HOP4 counter snat ip to 146.97.35.197
When running traceroute from both host and VM to 1.1.1.1, the ICMP type 11 responses look identical in the prerouting chain.
I need to modify these rules to only match and modify ICMP type 11 packets that are responses to the VM's traceroute probes, not the host's probes. What's the correct nftables syntax to examine and match based on the final destination of the packets?