I am attempting to route traffic to a specific IP to a local network IP due to loopback issues with my ISP's device. I have researched some and this command when run on the router seems to correct my issue:
So to run this automatically I telnet into the router and went to /jffs/scripts and created a file for nat-start and it does run per the log. It is also enabled in the Admin/System tab.
This is my script and it's permissions. I've also tried adding sleep to it to delay it some?
It works if I run ./nat-start and traffic is properly routed so I assume it's not a script problem... maybe it's a timing issue? But if thats the case, I would think the sleep would fix it?
Code:
iptables -t nat -A PREROUTING -p tcp -d 123.123.123.123 -j DNAT --to 192.168.2.155
Code:
Jul 31 19:00:14 custom script: Running /jffs/scripts/nat-start
Code:
#!/bin/sh
sleep 30
iptables -t nat -A PREROUTING -p tcp -d 123.123.123.123 -j DNAT --to 192.168.2.155
Code:
-rwxrwxrwx 1 me root 103 Nov 19 19:48 nat-start
-rwxrwxrwx 1 me root 103 Nov 19 19:53 services-start
It works if I run ./nat-start and traffic is properly routed so I assume it's not a script problem... maybe it's a timing issue? But if thats the case, I would think the sleep would fix it?