Execute a script similar to this periodically with cron:
#!/opt/bin/bash
lines=`/usr/sbin/iptables --list | /opt/bin/grep dpt:ssh | /opt/bin/wc -l`
if test $lines -eq "1"; then
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
fi
- K.C.
here is my problem,
I have a pppoe connection which i don't know why, once every 3-4 day wl700 reconnects?,... i don't know. The idea is that I get a new ip and the INPUT table is rewritten. Now the bad thing is that in the INPUT table I have this line:
iptables -I INPUT -p tcp --dport ssh -j ACCEPT witch opens's ssh from wan.
If I'm at work and want to ssh into my router, if this happens the only solution for me is to reboot the router so that rc.local might start again and open ssh from wan.
Is there any solution for my problem so I'm not forced to reset my router?
Opening ssh port from web doesen't work because it does something like iptables -A INPUT ...
Execute a script similar to this periodically with cron:
#!/opt/bin/bash
lines=`/usr/sbin/iptables --list | /opt/bin/grep dpt:ssh | /opt/bin/wc -l`
if test $lines -eq "1"; then
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
fi
- K.C.
-bash-3.2# wc -l
wc: error while loading shared libraries: wc: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
Does someone know how to fix this?
tks
I'd recommend setting:
export LD_LIBRARY_PATH=/opt/lib:/shares/lib
in the script, like is done in rc.local.
- K.C.