TroutTrout

Redirect traffic on your switches

Advanced

Advanced: for two machines on the same subnet, switch settings send each one's traffic to Access Gate instead of the other. Best-effort support.

6 min read · Last updated 2026-10-17

Two machines on the same subnet normally talk straight to each other, and no router sees it. With settings on your switch and a small helper device on that subnet, each machine sends its traffic to Access Gate instead, while it believes it is still talking to its neighbor. The machines are never changed. You must administer the switches, and support is best-effort.

This is an advanced option, last in the order. Prefer one rule on your router (recommended), or one machine at a time by name or by address. Use this page for the one case those do not reach: two machines on the same subnet, with no router between them, where the router and the machines' addresses are off limits but the switches are yours. If there is a router between the machines, Redirect traffic with your router's NAT is simpler.

How it works, in short

  1. Port isolation on the switch stops the two machines from reaching each other directly.
  2. The helper answers for the other machine. When a machine asks "who has this address?" (an ARP request), the helper replies with its own hardware address. The machine now sends its traffic to the helper.
  3. The helper swaps the address for the twin address and routes the traffic to Access Gate, which checks the enclave and delivers it to the real machine.

The machines keep their address, gateway and settings. Only their ARP table changes: the neighbor's address now points to the helper.

The example

A flat device subnet behind a router, with Access Gate beside the network.

WhatAddressRole
zt-a10.0.0.4Machine A (sends)
zt-b10.0.0.3Machine B (receives)
Helper (redirection element)10.0.0.2, on the bridgeAnswers ARP and translates
Router10.0.0.1Gateway, with the route to Access Gate
Access Gate100.65.0.4/29, Secure Twin 100.64.100.4/24Twin addresses, enclave rules

Each twin address keeps the last number: 10.0.0.X becomes 100.64.100.X.

1. Confirm the starting point

Both machines are on the same bridge and reach each other directly:

ping -c2 10.0.0.3      # succeeds: direct L2 switching

2. Stop the direct path

Isolate the two machine ports on the bridge. The helper's port and the uplink stay non-isolated, so both machines can still reach them.

# host-side veth for each container, set on the bridge
sudo ip link set {} type bridge_slave isolated on             # zt-a
sudo ip link set veth6680885b type bridge_slave isolated on   # zt-b

# verify
bridge -d link show | grep -B1 isolated

The other machine no longer answers ARP, so the neighbor entry stays incomplete:

ping -c2 10.0.0.3      # fails: INCOMPLETE ARP
ip neigh show          # 10.0.0.3 ... INCOMPLETE

3. Let the helper answer ARP

Give the helper an address on the bridge, then turn on private-VLAN proxy ARP. Standard proxy ARP refuses to answer for an address on the same interface as the requester; proxy_arp_pvlan is built for isolated (private-VLAN) segments and allows exactly that reply.

sudo ip addr add 10.0.0.2/24 dev zt-lab
sudo ip link set zt-lab up

sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl -w net.ipv4.conf.zt-lab.proxy_arp=1
sudo sysctl -w net.ipv4.conf.zt-lab.proxy_arp_pvlan=1

sudo ip neigh add proxy 10.0.0.3 dev zt-lab
sudo ip neigh add proxy 10.0.0.4 dev zt-lab

The machine now finds its neighbor at the helper's hardware address:

ip neigh show
# 10.0.0.3 dev eth0 lladdr 00:16:3e:84:aa:ba REACHABLE

4. Swap to the twin address

Rewrite traffic for the neighbor's real address to its twin address, and masquerade so the reply comes back to the helper to be translated back. The machines only ever see local addresses.

sudo nft add table ip zt_gate
sudo nft add chain ip zt_gate prerouting '{ type nat hook prerouting priority dstnat; }'
sudo nft add rule ip zt_gate prerouting iif zt-lab ip daddr 10.0.0.3 dnat to 100.64.100.3
sudo nft add rule ip zt_gate prerouting iif zt-lab ip daddr 10.0.0.4 dnat to 100.64.100.4
sudo nft add chain ip zt_gate postrouting '{ type nat hook postrouting priority srcnat; }'

Example configuration:

NAT Configuration pointing to the overlay
NAT Configuration pointing to the overlay

5. Route to Access Gate through the router

Send the twin range to Access Gate through the subnet's own gateway, so traffic leaves on the interface built for this segment:

sudo ip route add 100.64.100.0/24 via 10.0.0.1 dev zt-lab metric 50

# confirm the path
ip route get 100.64.100.3
# 100.64.100.3 via 10.0.0.1 dev zt-lab src 10.0.0.2

6. Set up the subnet in Access Gate

In Access Gate, create a network matching this subnet, with its twin range:

Access Gate network and overlay matching the redirection subnet
Access Gate network and overlay matching the redirection subnet

Then declare the machines you want to protect:

Declaring the protected assets on the Access Gate
Declaring the protected assets on the Access Gate

7. Check it works

The machine pings its neighbor and it works, but the traffic now goes through Access Gate:

sudo tcpdump -ni enp6s0 host 100.64.100.3 &
ping -c3 10.0.0.3
sudo pkill tcpdump

Expected capture:

tcpdump capture showing the ping translated onto the overlay through the Access Gate
tcpdump capture showing the ping translated onto the overlay through the Access Gate

The traffic leaves the helper as 10.0.0.2 -> 100.64.100.3, reaches Access Gate through the router, and returns. The lower TTL confirms it went through the gate rather than straight across the switch.

What happens to the traffic

zt-a (10.0.0.4)
  -> switch  [ARP answered by the helper, not the neighbor]
  -> helper (10.0.0.2)  [10.0.0.3 -> 100.64.100.3, masquerade]
  -> Router (10.0.0.1)
  -> Access Gate (100.64.100.3, enclave rules)
  -> and back, translated back to zt-a

Before you rely on it

Use this only when all of these hold: you administer the switches, they support port isolation or private VLAN, you can get a change window, and the router and machine addresses are off limits. Avoid it when the subnet spans switches from several vendors that isolate ports differently, or when nobody will maintain a Layer 2 change over time.

Write it into your network runbook. Someone reading ARP tables months later needs to know why a neighbor resolves to the helper's hardware address.