Here are the iptable commands I use (on the gateway node). Your home router also needs to forward, in this example, port 8088 to your hamnet gateway node. As a live example, feel free to try out and access a remote control pan-tilt ipCam looking over Orange County, CA on this link (I reserve the right to change the password :) ). This access is over a 5 mile 2.4G link into the mesh. Note, "IR" mode icon to click and turn on if night time.
http://72.194.78.152:8088 <- User = "view" Password = "view" requires Windows Plugin
http://72.194.78.152:8081 <- To see mesh status of node
[linksys-host:/etc/config/firewall.user]
iptables -A input_wan -p tcp --dport 8085 -j ACCEPT
iptables -t nat -A prerouting_wan -p tcp --dport 8085 -j DNAT --to 10.182.194.173:80
iptables -A forwarding_wan -p tcp --dport 80 -d 10.82.194.173 -j ACCEPT
iptables -t nat -A postrouting_wan -p tcp -d 10.82.194.173 -j SNAT -dport 80 --to-source <your gateway node's mesh IP address>
[ubnt-host:/etc/config/firewall]
config 'redirect'
option 'name' 'cam1'
option 'src' 'wan'
option 'proto' 'tcp'
option 'src_dport' '8088'
option 'dest_ip' '10.182.194.173'
option 'dest_port' '80'
option 'target' 'DNAT'
option 'dest' 'lan'
config 'redirect'
option 'src' 'lan'
option 'dest' 'wifi'
option 'dest_ip' '10.182.194.173' option 'src_dip' '<your gateway node's mesh IP address>' option 'dest_port' '80'
option 'target' 'SNAT'
Note, the SNAT entries are needed so that the device "inside the mesh" (this doesn't have to be a device on the gateway node) will route the traffic back out the same gateway. In this live example, we have multiple gateways. Routers by default typically won't allow internet traffic to come in one gateway and back out another--a security issue.
To ensure your entries don't get overwritten, also put these definitions in /etc/config.mesh files. |