Openwrt proxy UUID routing

Hello Folks,
I have a single problem,
NordVpn gives the same ip addres on two diferent interfaces
I´ve made two connections to two different endpoints and both give me the same ip address.

So to try to route diferently, i installed privoxy and tinyproxy, and tryed to route by UUID.

so i created

/etc/hotplug.d/iface/99-vpn-routes

#!/bin/sh

[ "$ACTION" = ifup ] || exit 0

if [ "$INTERFACE" = "tun4" ]; then
  ip route add default dev tun4 table saida_vpn_us
  ip rule add uidrange 8119-8119 table saida_vpn_us
fi

if [ "$INTERFACE" = "tun5" ]; then
  ip route add default dev tun5 table saida_vpn_br
  ip rule add uidrange 8118-8118 table saida_vpn_br
fi

but even configuring like this it is exiting with the default route

Any hints?

I could not solve this, as I am using virtual machines, i have created two new openwrt machines, one for each vpn.
After that i configured each proxy to forward to upstream openwrt using one specific interface with a unique ip address,
that is working ok

To the original issue: if both VPN interfaces are showing the same external IP, it's likely that your VPN provider is using NAT or load balancing behind the scenes, which can make different tunnels appear to come from the same IP, especially if they exit through the same physical gateway.

Your approach using ip rule and uidrange is solid, but if it's still routing through the default interface, a few things to double-check:

  • Check route priorities: Run ip rule list and ip route show table to make sure the rules are actually being applied and not overridden by a higher-priority rule.
  • Confirm UID mapping: Ensure the processes (like privoxy/tinyproxy) are actually running under the correct UID (8118 / 8119). You can verify with ps -o pid,uid,cmd -C privoxy or similar.
  • DNS resolution: Sometimes traffic leaks occur during DNS resolution before the route policy is applied. Make sure DNS queries are routed through the correct interface or handled by the correct proxy.
  • Mark-based routing (optional alternative): Instead of UID-based rules, you can use iptables to mark packets and route based on marks—this offers more flexibility, especially for traffic not easily UID-bound.
  • To the second user's solution—spinning up separate OpenWRT VMs per VPN and routing traffic via proxies to them—is actually a clever workaround. Using each as an anonymous proxy upstream with its own interface and unique public IP helps maintain clean separation and avoids routing conflicts. This also makes traffic tracking and logging more isolated per connection.

    Let us know if you want help refining the ip rule method or scripting a cleaner VM/proxy handoff. This is a cool setup you're both working on!

Do the tunnels have the same key?

If so, you could script a change in the endpoint address using 1 config?

Different keys

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.