Ashus.ashus.net

Full Version: MiniUPNPd patched for routed network
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you have tried to forward UDP packets of UPNP (dynamic NAT port forwarding) to another network (you may have NAT further away from you), you need a little workaround for miniupnpd server to accept addresses that are not bound to any interface. The message in debug reads following: miniupnpd[3605]: get_lan_for_peer(): 192.168.5.25:1900 not found !


Let's say we have main router A, that NATs traffic of clients at A and router B. Router A also shapes traffic, so we can't use NAT on B natively and just forward everything to A. We need to forward UPNP and nat-PMP requests from clients of B to the router A. Clients of A have IP range 192.168.1.0/24, clients of B 192.168.5.0/24. The router A has IP 192.168.1.1 and 192.168.2.1 on p2p link with B. Router B has IPs 192.168.5.1 and 192.168.2.2 on p2p link with A.

Getting NAT-PMP to work is really easy, only one line is required in the firewall of B:
Code:
# NAT-PMP relay
iptables -t nat -A PREROUTING -i eth0 -p udp -d 192.168.5.1 --dport 5351 -j DNAT --to-destination 192.168.2.1


To route multicast traffic, you need to use smcroute on B. Configuration must be done per-IP:
[code]function smcroute_ip {
    smcroute -a "$2" "$1" 239.255.255.250 wlan0
}

smcroute -a wlan0 192.168.2.1 239.255.255.250 eth0

for (( i = 2 ; i