What's new

nat-start not loading on reboot?

Daxx123

Occasional Visitor
/jffs/scripts/nat-start appears to not load on reboot. If I manually run nat-start from SSH it loads up and puts rules in iptables, but on next reboot everything is gone until I manually run nat-start again.

How do I get this to run on reboot?
 
/jffs/scripts/nat-start appears to not load on reboot. If I manually run nat-start from SSH it loads up and puts rules in iptables, but on next reboot everything is gone until I manually run nat-start again.

How do I get this to run on reboot?

Make sure you do have NAT enabled on the router, and that the script is executable (chmod a+rx), and has a valid shebang at the beginning.

Also add a "touch /tmp/000nat-start" line at the start to confirm if it does get executed or if it's simply the rest of the script that is having issues.
 
I put 000nat-start at beginning and 000nat-stop at eof.

Code:
#!/bin/sh
touch /tmp/000nat-start
iptables -I FORWARD 1 -s 204.15.20.0/22 -j DROP
iptables -I FORWARD 1 -s 69.63.176.0/20 -j DROP
iptables -I FORWARD 1 -s 66.220.144.0/20 -j DROP
iptables -I FORWARD 1 -s 66.220.144.0/21 -j DROP
touch /tmp/000nat-stop

The script was loading but didn't add any rules to iptables:

login@RT-N16:/tmp# ls
000firewallstarted mnt share
000nat-start nat_rules syslog.log
000nat-stop nat_rules_eth0_eth0 udhcpc
Beceem_firmware notify udhcpc0.expires
etc ppp var
filter.default qos wpa_cli
filter_rules redirect_rules wps_monitor.pid
home resolv.conf zcip
mangle_rules settings
login@RT-N16:/tmp#

I was able to fix it by changing "FORWARD 1" in rule of nat-start to just "FORWARD".

Code:
#!/bin/sh
touch /tmp/000nat-start
iptables -I FORWARD -s 204.15.20.0/22 -j DROP
iptables -I FORWARD -s 69.63.176.0/20 -j DROP
iptables -I FORWARD -s 66.220.144.0/20 -j DROP
iptables -I FORWARD -s 66.220.144.0/21 -j DROP
touch /tmp/000nat-stop

Now it loads on reboot. I thought the 1 would ensure all the rules were inserted at the top? Anyway, the rules load on reboot now.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Back
Top