i have script running on boot (as root) on phone , cycling on timer make wifi hotspot send data through pia vpn(tun0). pia assign single port allowed used port forwarding , want forward assigned port tethered pc connected wifi hotspot (wlan0). pc's local ip address 192.168.1.252 (hotspot assigned) , port number 40212 (pia assigned). there way add routing script?
additional info:
$ netcfg wlan0 192.168.1.1/24 lo 127.0.0.1/8 tun0 10.100.1.6/30 rmnet xx.xxx.xxx.xxx/xx #didn't want phone's external(?) ip online.
script:
while sleep 30; iptables -t filter -f forward iptables -t nat -f postrouting iptables -t filter -i forward -j accept iptables -t nat -i postrouting -j masquerade iptables -t nat -a prerouting -p udp --dport 53 -j dnat --to 8.8.8.8 ip rule add 192.168.1.0/24 lookup 61 ip route add default dev tun0 scope link table 61 ip route add 192.168.1.0/24 dev wlan0 scope link table 61 ip route add broadcast 255.255.255.255 dev wlan0 scope link table 61